struts2无法加载配置

问题描述 投票:-1回答:3
SEVERE: Exception starting filter struts2
  Unable to load configuration. - bean -  jar:file:/C:/Users/vaio/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/StrutsCRUD/WEB-INF/lib/struts2-core-2.3.4.1.jar!/struts-default.xml:29:72
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.initFilter(ApplicationFilterConfig.java:277)
    at
org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)
    at
org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382)
    at
org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:103)
    at
org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4638)
    at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5294)
    at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1568)
    at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1558)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)    at
java.util.concurrent.FutureTask.run(Unknown Source)     at
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)   at
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)  at
java.lang.Thread.run(Unknown Source) Caused by: Unable to load
configuration. - bean -
jar:file:/C:/Users/vaio/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/StrutsCRUD/WEB-INF/lib/struts2-core-2.3.4.1.jar!/struts-default.xml:29:72
    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)
    ... 16 more Caused by: Unable to load bean: type:
class:com.opensymphony.xwork2.ObjectFactory - bean -
jar:file:/C:/Users/vaio/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/StrutsCRUD/WEB-INF/lib/struts2-core-2.3.4.1.jar!/struts-default.xml:29:72
    at
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:243)
    at
org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102)
    at
com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:210)
    at
com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
    ... 18 more Caused by: Bean type class
com.opensymphony.xwork2.ObjectFactory with the name xwork has already
been loaded by bean -
jar:file:/C:/apache-tomcat-7.0.25-windows-x86/apache-tomcat-7.0.25/lib/struts2-core-2.3.4.1.jar!/struts-default.xml:29:72
- bean - jar:file:/C:/Users/vaio/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/StrutsCRUD/WEB-INF/lib/struts2-core-2.3.4.1.jar!/struts-default.xml:29:72
    at
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:227)
    ... 21 more Nov 06, 2012 10:46:46 PM
org.apache.catalina.core.StandardContext startInternal SEVERE: Error
filterStart Nov 06, 2012 10:46:46 PM
org.apache.catalina.core.StandardContext startInternal SEVERE: Context
[/StrutsCRUD] startup failed due to previous errors Nov 06, 2012
10:46:46 PM org.apache.coyote.AbstractProtocol start INFO: Starting
ProtocolHandler ["http-bio-8786"] Nov 06, 2012 10:46:46 PM
org.apache.coyote.AbstractProtocol start INFO: Starting
ProtocolHandler ["ajp-bio-8009"] Nov 06, 2012 10:46:46 PM
org.apache.catalina.startup.Catalina start INFO: Server startup in
3977 ms
eclipse apache struts2 tomcat7
3个回答
5
投票

您已将Struts 2罐子放置在Tomcat库目录中:

Caused by: Bean type class com.opensymphony.xwork2.ObjectFactory with 
the name xwork has already been loaded by bean - 
jar:file:/C:/apache-tomcat-7.0.25-windows-x86/apache-tomcat-7.0.25/lib/struts2-core-2.3.4.1.jar!/struts-default.xml:29:72

从servlet容器中删除与Struts相关的库;使用您的应用程序only部署它们。


0
投票

关于struts-default.xml在第29行的错误意味着您没有所有需要的struts2库。


0
投票

检查您的库。请确保您没有struts2-core-2.3.1.2.jar库,例如struts2-core-2.3.1.2.jar(1)或其他种类。

© www.soinside.com 2019 - 2024. All rights reserved.