同事的Java项目,在别人机器上都好好的,拿到我的环境下同样的配置,MyEclipse导入工程,发布Tomcat启动就报错,错误信息如下:
1 严重: Exception starting filter struts2
2 Unable to load configuration. - bean - jar:file:/E:/apache-tomcat-6.0.20/webapps/nmns/WEB-INF/lib/struts2-core-2.1.8.1.jar!/struts- default.xml:29:72
3 at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:431)
4 at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:190)
5 at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
6 at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
7 at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:115)
8 at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4071)
9 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4725)
10 at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
11 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
12 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
13 at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
14 at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
15 at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
16 at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1315)
17 at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
18 at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
19 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1061)
20 at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
21 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
22 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
23 at org.apache.catalina.core.StandardService.start(StandardService.java:525)
24 at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
25 at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
26 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
27 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
28 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
29 at java.lang.reflect.Method.invoke(Method.java:597)
30 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
31 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
32 Caused by: Unable to load configuration. - bean - jar:file:/E:/apache-tomcat-6.0.20/webapps/nmns/WEB-INF/lib/struts2-core-2.1.8.1.jar!/struts- default.xml:29:72
33 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
34 at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)
35 at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418)
36 ... 28 more
37 Caused by: Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/E:/apache-tomcat-6.0.20/webapps/nmns/WEB-INF/lib/struts2-core-2.1.8.1.jar!/struts- default.xml:29:72
38 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:221)
39 at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
40 at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:169)
41 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
42 ... 30 more
43 Caused by: Bean type class com.opensymphony.xwork2.ObjectFactory with the name xwork has already been loaded by bean - jar:file:/E:/apache-tomcat-6.0.20/lib/struts2-core-2.1.8.1.jar!/struts- default.xml:29:72 - bean - jar:file:/E:/apache-tomcat-6.0.20/webapps/nmns/WEB-INF/lib/struts2-core-2.1.8.1.jar!/struts- default.xml:29:72
44 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:205)
45 ... 33 more
2 Unable to load configuration. - bean - jar:file:/E:/apache-tomcat-6.0.20/webapps/nmns/WEB-INF/lib/struts2-core-2.1.8.1.jar!/struts- default.xml:29:72
3 at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:431)
4 at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:190)
5 at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
6 at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
7 at org.apache.catalina.core.ApplicationFilterConfig.
8 at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4071)
9 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4725)
10 at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
11 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
12 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
13 at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
14 at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
15 at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
16 at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1315)
17 at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
18 at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
19 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1061)
20 at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
21 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
22 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
23 at org.apache.catalina.core.StandardService.start(StandardService.java:525)
24 at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
25 at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
26 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
27 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
28 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
29 at java.lang.reflect.Method.invoke(Method.java:597)
30 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
31 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
32 Caused by: Unable to load configuration. - bean - jar:file:/E:/apache-tomcat-6.0.20/webapps/nmns/WEB-INF/lib/struts2-core-2.1.8.1.jar!/struts- default.xml:29:72
33 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
34 at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)
35 at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418)
36 ... 28 more
37 Caused by: Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/E:/apache-tomcat-6.0.20/webapps/nmns/WEB-INF/lib/struts2-core-2.1.8.1.jar!/struts- default.xml:29:72
38 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:221)
39 at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
40 at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:169)
41 at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
42 ... 30 more
43 Caused by: Bean type class com.opensymphony.xwork2.ObjectFactory with the name xwork has already been loaded by bean - jar:file:/E:/apache-tomcat-6.0.20/lib/struts2-core-2.1.8.1.jar!/struts- default.xml:29:72 - bean - jar:file:/E:/apache-tomcat-6.0.20/webapps/nmns/WEB-INF/lib/struts2-core-2.1.8.1.jar!/struts- default.xml:29:72
44 at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:205)
45 ... 33 more
网上查阅了一下,基本都说是jar缺失的问题,并且列出了必备的几个jar包,但是我这个项目的jar包全部都在项目里,并没有缺失,而且只是我个人的环境才这样。虽然进行了排除,但是不放心还是把网上说的几个jar包又重新覆盖了一遍,当然问题依旧。
不甘心,又折腾了大半天,偶然发现一处留言讨论这种情况,原因是Tomcat自己的lib目录下有jar包和发布webapps下jar包重复,眼前一亮,赶紧去我的Tomcat的lib下看了看,由于我这个tomcat用了很久了,lib果然有很多的jar包,确实和工程下的重复了,于是全部删除掉,恢复为默认的几个jar,于是问题解决了。
原来Tomcat下的Lib目录下,确实很多……
恢复为默认的初始: