Spring+Hibernate+Struts2框架里面要是用刀struts2相关的5个jar包,每个jar包里面都有struts配置文件
struts2-core-2.3.15.3.jar
struts2-convention-plugin-2.3.15.3.jar
struts2-json-plugin-2.3.15.3.jar
struts2-spring-plugin-2.3.15.3.jar
xwork-core-2.3.15.3.jar
使用maven-tomcat
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<hostName>localhost</hostName>
<port>39393</port>
<path>/xxxx</path>
<uriEncoding>UTF-8</uriEncoding>
<finalName>xxxx</finalName>
<server>tomcat7</server>
<warSourceDirectory>${project.build.directory}/${project.build.finalName}</warSourceDirectory>
<!-- <addWarDependenciesInClassloader>false</addWarDependenciesInClassloader>-->
</configuration>
</plugin>
不配置warSourceDirectory的话,默认使用src/mai/webapp作为服务发布目录,因为我的配置文件是放在src/main/resources下面,webapp里面是不存在的
目前解决方法是:
将这5个包去掉xml配置文件后放到src/mai/webapp/WEB-INF/lib下面,启动成功
struts2-core-2.3.15.3.jar
struts2-convention-plugin-2.3.15.3.jar
struts2-json-plugin-2.3.15.3.jar
struts2-spring-plugin-2.3.15.3.jar
xwork-core-2.3.15.3.jar
使用maven-tomcat
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<hostName>localhost</hostName>
<port>39393</port>
<path>/xxxx</path>
<uriEncoding>UTF-8</uriEncoding>
<finalName>xxxx</finalName>
<server>tomcat7</server>
<warSourceDirectory>${project.build.directory}/${project.build.finalName}</warSourceDirectory>
<!-- <addWarDependenciesInClassloader>false</addWarDependenciesInClassloader>-->
</configuration>
</plugin>
不配置warSourceDirectory的话,默认使用src/mai/webapp作为服务发布目录,因为我的配置文件是放在src/main/resources下面,webapp里面是不存在的
目前解决方法是:
将这5个包去掉xml配置文件后放到src/mai/webapp/WEB-INF/lib下面,启动成功