此问题已在此处有答案:
HTTP Status 404 while running struts2 application(1个答案)
13小时前关闭
最新版本6.* Struts2是否支持Tomcat 10?
启动筛选器时出现异常[struts2]
java.lang.ClassCastException: class org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter cannot be cast to class jakarta.servlet.Filter (org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter is in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @13e547a9; jakarta.servlet.Filter is in unnamed module of loader java.net.URLClassLoader @2d209079)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:252)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:103)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4562)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5205)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919)
1条答案
按热度按时间lmyy7pcs1#
该错误表明它不支持Tomcat 10。“问题”是Tomcat 10切换到了Jakarta EE 9规范。Jakarta EE 9从
javax.*
包命名空间切换到jakarta.*
包命名空间。根据version notes,Struts2 6.0.0 GA是Servlet 3.1(Java EE 7),它使用
javax.*
命名空间,这意味着它通常与JavaEE 7和8以及Jakarta EE 8兼容,但不与Jakarta EE 9及更高版本兼容。这意味着您需要使用Tomcat 9。根据WW-5141 Jakarta EE 9(或更高版本),Struts2 7.0.0中 * 计划 * 支持。