尝试使用 Maven 在我的应用程序中集成 Struts2 和 Spring。我已将所有依赖项放在与 Spring-web、Spring、Struts2-spring 插件相关的 Pom 文件中
<!-- Spring framework -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<type>jar</type>
<version>2.5.6</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>2.5.6</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
<version>2.2.3</version>
</dependency>
我在 Web.xml 文件中包含以下内容,
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
当我使用 Maven 运行时生成战争文件并且当我在我的服务器(glassfish)中部署我的战争文件时,错误消息显示如下
"Error An error has occurred
Error occurred during deployment: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.NoClassDefFoundError: Could not initialize class org.springframework.web.context.ContextLoader. Please see server.log for more details."
所以任何人都请帮我解决这个问题。