用eclipse配置好了struts2,一运行tomcat就报错,我这里原因是我吧struts2的jar包都放进去了,太多了所以报错,然后我去掉了大部分留下几个核心jar包,还是报错,
java.lang.NoClassDefFoundError: com/opensymphony/xwork2/ActionContext
at org.apache.struts2.dispatcher.ng.InitOperations.cleanup(InitOperations.java:114)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:69)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:283)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:264)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4546)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5191)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1412)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1402)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:830)
Caused by: java.lang.ClassNotFoundException: com.opensymphony.xwork2.ActionContext
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1358)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1180)
... 14 more
原因是jar包不够,在Console可以看到具体缺少什么,这里从第一行可以看出缺少xwork2,再导入,然后就可以正常运行了。
原文地址:https://www.cnblogs.com/8023spz/p/12555374.html