Issue
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
Solution
You have put the Struts 2 jars in the Tomcat library directory:
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 only with your app.
Answered By - Dave Newton