eclipse struts2 无法加载配置

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13258125/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 19:21:26  来源:igfitidea点击:

struts2 Unable to load configuration

eclipseapachestruts2tomcat7

提问by Sudhanshubliz

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

回答by Dave Newton

You have put the Struts 2 jars in the Tomcat library directory:

您已将 Struts 2 jar 放在 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

Remove Struts-related libraries from the servlet container; deploy them onlywith your app.

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

回答by Praful

check your libraries.Make sure you donn have struts2-core-2.3.1.2.jar libraary more than one.like struts2-core-2.3.1.2.jar(1) or kind of.

检查你的库。确保你没有 struts2-core-2.3.1.2.jar 库不止一个。比如 struts2-core-2.3.1.2.jar(1) 或类似的。

回答by Nicola Baldissin

The error about the struts-default.xml at row 29 means that you don't have all the needed struts2 libs.

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