我正在尝试将Struts 2与Hibernate ORM集成。我在eclipse中创建了一个Maven项目。我添加了项目所需的所有依赖项。我在尝试在Tomcat 7中部署和运行应用程序时收到HTTP状态500 - java.lang.NoClassDefFoundError:com / opensymphony / xwork2 / util / ValueStack。
我已查看此论坛中与此问题相关的所有帖子,其中我发现的解决方案是添加xwork-xxx.jar文件。我添加了xwork2.3.4.1 jar,它是Struts2-core.jar附带的依赖项的一部分。依赖关系已存在于pom.xml中。我还能够在war文件中看到所需的jar文件,该文件是在maven中构建的并部署在tomcat服务器中。但我仍然得到HTTP状态500 - java.lang.NoClassDefFoundError:com / opensymphony / xwork2 / util / ValueStack Exception。
List of Jars in war:
javax.servlet-api-3.1.0.jar
struts2-core-2.3.4.1.jar
xwork-core-2.3.4.1.jar
commons-lang3-3.1.jar
asm-commons-3.3.jar
asm-tree-3.3.jar
freemarker-2.3.19.jar
ognl-3.0.5.jar
javassist-3.11.0.GA.jar
commons-fileupload-1.2.2.jar
commons-io-2.0.1.jar
hibernate-core-5.2.10.Final.jar
jboss-logging-3.3.0.Final.jar
hibernate-jpa-2.1-api-1.0.0.Final.jar
javassist-3.20.0-GA.jar
antlr-2.7.7.jar
jboss-transaction-api_1.2_spec-1.0.1.Final.jar
jandex-2.0.3.Final.jar
classmate-1.3.0.jar
dom4j-1.6.1.jar
hibernate-commons-annotations-5.0.1.Final.jar
ojdbc6-11.2.0.3.jar
我无法找到解决此问题需要做的工作。任何帮助都非常感谢。 TIA。
以下是异常跟踪。
SEVERE: Servlet.service() for servlet [jsp] in context with path [/StrutsMavenDemo] threw exception [java.lang.NoClassDefFoundError: com/opensymphony/xwork2/util/ValueStack] with root cause
java.lang.ClassNotFoundException: com.opensymphony.xwork2.util.ValueStack
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1892)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetPublicMethods(Class.java:2902)
at java.lang.Class.getMethods(Class.java:1615)
at java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1336)
at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1197)
at java.beans.Introspector.getBeanInfo(Introspector.java:426)
at java.beans.Introspector.getBeanInfo(Introspector.java:173)
at java.beans.Introspector.getBeanInfo(Introspector.java:260)
at java.beans.Introspector.<init>(Introspector.java:407)
at java.beans.Introspector.getBeanInfo(Introspector.java:173)
at java.beans.Introspector.getBeanInfo(Introspector.java:260)
at java.beans.Introspector.<init>(Introspector.java:407)
at java.beans.Introspector.getBeanInfo(Introspector.java:173)
at java.beans.Introspector.getBeanInfo(Introspector.java:260)
at java.beans.Introspector.<init>(Introspector.java:407)
at java.beans.Introspector.getBeanInfo(Introspector.java:173)
at org.apache.jasper.compiler.Generator$TagHandlerInfo.<init>(Generator.java:4044)
at org.apache.jasper.compiler.Generator$GenerateVisitor.getTagHandlerInfo(Generator.java:2289)
at org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1717)
at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1553)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2392)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2444)
at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2450)
at org.apache.jasper.compiler.Node$Root.accept(Node.java:474)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2392)
at org.apache.jasper.compiler.Generator.generate(Generator.java:3591)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:251)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:374)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:354)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:341)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:660)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:364)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
POM.XML:
========
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.3.4.1</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.2.10.Final</version>
</dependency>
</dependencies>