maven项目打包成war包,放到tomcat下运行报错

时间:2022-06-11 09:40:45
maven项目用eclipse+jetty能正常运行起来    但成war包,放到tomcat下运行报错
报错如下:

2015-7-18 14:52:12 org.apache.catalina.core.AprLifecycleListener init
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: 
C:\Program Files (x86)\Java\jdk1.6.0_10\bin;.;C:\windows\Sun\Java\bin;C:\windows\system32;
C:\windows;%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin;C:\Program Files (x86)\Intel\iCLS Client\;
C:\Program Files\Intel\iCLS Client\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;
C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;
C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;
C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;
C:\Program Files (x86)\Lenovo\Lenovo Home\;C:\Program Files (x86)\Common Files\lenovo\easyplussdk\bin
2015-7-18 14:52:12 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2015-7-18 14:52:12 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 346 ms
2015-7-18 14:52:12 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2015-7-18 14:52:12 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.44
2015-7-18 14:52:12 org.apache.catalina.loader.WebappClassLoader validateJarFile
信息: validateJarFile(C:\Users\scott\Desktop\apache-tomcat-6.0.44\webapps\trj\WEB-INF\lib\servlet-api-2.5.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
2015-7-18 14:52:14 org.apache.catalina.core.StandardContext start
严重: Error filterStart
2015-7-18 14:52:14 org.apache.catalina.core.StandardContext start
严重: Context [/trj] startup failed due to previous errors
2015-7-18 14:52:15 org.apache.catalina.loader.WebappClassLoader validateJarFile
信息: validateJarFile(C:\Users\scott\Desktop\apache-tomcat-6.0.44\webapps\tangrenji\WEB-INF\lib\servlet-api-2.5.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
2015-7-18 14:52:16 org.apache.catalina.core.StandardContext start
严重: Error filterStart
2015-7-18 14:52:16 org.apache.catalina.core.StandardContext start
严重: Context [/tangrenji] startup failed due to previous errors
2015-7-18 14:52:17 org.apache.catalina.startup.HostConfig deployDescriptor

严重: Exception starting filter struts2
Unable to load configuration. - package - jar:file:/C:/Users/scott/Desktop/apache-tomcat-6.0.44/webapps/trj/WEB-INF/lib/ss-0.0.1-SNAPSHOT.jar!/struts.xml:23:58
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:450)
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:298)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:119)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4076)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4730)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1060)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:822)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1060)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:759)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: Unable to load configuration. - package - jar:file:/C:/Users/scott/Desktop/apache-tomcat-6.0.44/webapps/trj/WEB-INF/lib/ss-0.0.1-SNAPSHOT.jar!/struts.xml:23:58
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:390)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:437)
... 19 more
Caused by: The package name 'struts-backend' at location package - jar:file:/C:/Users/scott/Desktop/apache-tomcat-6.0.44/webapps/trj/WEB-INF/lib/ss-0.0.1-SNAPSHOT.jar!/struts.xml:23:58 is already been used by another package at location package - file:/C:/Users/scott/Desktop/apache-tomcat-6.0.44/webapps/trj/WEB-INF/classes/struts.xml:23:58 - package - jar:file:/C:/Users/scott/Desktop/apache-tomcat-6.0.44/webapps/trj/WEB-INF/lib/ss-0.0.1-SNAPSHOT.jar!/struts.xml:23:58
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.addPackageConfig(DefaultConfiguration.java:152)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:502)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:286)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:112)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:234)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
... 21 more
2015-7-18 14:52:14 org.apache.catalina.core.ApplicationContext log
信息: Closing Spring root WebApplicationContext
2015-7-18 14:52:15 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
2015-7-18 14:52:16 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter struts2
Unable to load configuration. - package - jar:file:/C:/Users/scott/Desktop/apache-tomcat-6.0.44/webapps/tangrenji/WEB-INF/lib/ss-0.0.1-SNAPSHOT.jar!/struts.xml:23:58
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:450)
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:298)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:119)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4076)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4730)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1060)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:822)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1060)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:759)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: Unable to load configuration. - package - jar:file:/C:/Users/scott/Desktop/apache-tomcat-6.0.44/webapps/tangrenji/WEB-INF/lib/ss-0.0.1-SNAPSHOT.jar!/struts.xml:23:58
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:390)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:437)
... 19 more
Caused by: The package name 'struts-backend' at location package - jar:file:/C:/Users/scott/Desktop/apache-tomcat-6.0.44/webapps/tangrenji/WEB-INF/lib/ss-0.0.1-SNAPSHOT.jar!/struts.xml:23:58 is already been used by another package at location package - file:/C:/Users/scott/Desktop/apache-tomcat-6.0.44/webapps/tangrenji/WEB-INF/classes/struts.xml:23:58 - package - jar:file:/C:/Users/scott/Desktop/apache-tomcat-6.0.44/webapps/tangrenji/WEB-INF/lib/ss-0.0.1-SNAPSHOT.jar!/struts.xml:23:58
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.addPackageConfig(DefaultConfiguration.java:152)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:502)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:286)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:112)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:234)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
... 21 more
2015-7-18 14:52:16 org.apache.catalina.core.ApplicationContext log
信息: Closing Spring root WebApplicationContext
2015-7-18 14:52:17 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
2015-7-18 14:52:17 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()

3 个解决方案

#1


异常提示很详细啊!
Caused by: The package name 'struts-backend' at location package - jar:file:/C:/Users/scott/Desktop/apache-tomcat-6.0.44/webapps/trj/WEB-INF/lib/ss-0.0.1-SNAPSHOT.jar!/struts.xml:23:58 is already been used by another package at location package - file:/C:/Users/scott/Desktop/apache-tomcat-6.0.44/webapps/trj/WEB-INF/classes/struts.xml:23:58 - package - jar:file:/C:/Users/scott/Desktop/apache-tomcat-6.0.44/webapps/trj/WEB-INF/lib/ss-0.0.1-SNAPSHOT.jar!/struts.xml:23:58

有冲突啊。

#2


Caused by: The package name 'struts-backend' at location package - jar:file:/C:/Users/scott/Desktop/apache-tomcat-6.0.44/webapps/tangrenji/WEB-INF/lib/ss-0.0.1-SNAPSHOT.jar!/struts.xml:23:58 is already been used by another package at location package - file:/C:/Users/scott/Desktop/apache-tomcat-6.0.44/webapps/tangrenji/WEB-INF/classes/struts.xml:23:58 - package - jar:file:/C:/Users/scott/Desktop/apache-tomcat-6.0.44/webapps/tangrenji/WEB-INF/lib/ss-0.0.1-SNAPSHOT.jar!/struts.xml:23:58


看看这个jar

#3


struts.xml:23行58个字符有问题,请自己去修复。

#1


异常提示很详细啊!
Caused by: The package name 'struts-backend' at location package - jar:file:/C:/Users/scott/Desktop/apache-tomcat-6.0.44/webapps/trj/WEB-INF/lib/ss-0.0.1-SNAPSHOT.jar!/struts.xml:23:58 is already been used by another package at location package - file:/C:/Users/scott/Desktop/apache-tomcat-6.0.44/webapps/trj/WEB-INF/classes/struts.xml:23:58 - package - jar:file:/C:/Users/scott/Desktop/apache-tomcat-6.0.44/webapps/trj/WEB-INF/lib/ss-0.0.1-SNAPSHOT.jar!/struts.xml:23:58

有冲突啊。

#2


Caused by: The package name 'struts-backend' at location package - jar:file:/C:/Users/scott/Desktop/apache-tomcat-6.0.44/webapps/tangrenji/WEB-INF/lib/ss-0.0.1-SNAPSHOT.jar!/struts.xml:23:58 is already been used by another package at location package - file:/C:/Users/scott/Desktop/apache-tomcat-6.0.44/webapps/tangrenji/WEB-INF/classes/struts.xml:23:58 - package - jar:file:/C:/Users/scott/Desktop/apache-tomcat-6.0.44/webapps/tangrenji/WEB-INF/lib/ss-0.0.1-SNAPSHOT.jar!/struts.xml:23:58


看看这个jar

#3


struts.xml:23行58个字符有问题,请自己去修复。