aspose file tools*
The moose likes Struts and the fly likes Problem in struts 2.3- Dispatcher initialization failed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem in struts 2.3- Dispatcher initialization failed" Watch "Problem in struts 2.3- Dispatcher initialization failed" New topic
Author

Problem in struts 2.3- Dispatcher initialization failed

maitrey mehta
Greenhorn

Joined: Mar 30, 2013
Posts: 1
I am trying a simple struts2 application with struts2.3 jars but tomcat is giving error SERVERispatcher initialization failed

at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:429)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:473)
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:273)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:254)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:372)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:98)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4382)
at org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5040)
at org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5035)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/E:/MyWorkspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/test2/WEB-INF/lib/struts2-core-2.3.12.jar!/struts-default.xml:29:72
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:245)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:226)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
... 16 more
Caused by: Bean type class com.opensymphony.xwork2.ObjectFactory with the name xwork has already been loaded by bean - jar:file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%207.0/lib/struts2-core-2.3.12.jar!/struts-default.xml:29:72 - bean - jar:file:/E:/MyWorkspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/test2/WEB-INF/lib/struts2-core-2.3.12.jar!/struts-default.xml:29:72
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:229)
... 19 more
Mar 30, 2013 10:44:22 PM org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter struts2
Unable to load configuration. - bean - jar:file:/E:/MyWorkspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/test2/WEB-INF/lib/struts2-core-2.3.12.jar!/struts-default.xml:29:72
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:485)
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:273)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:254)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:372)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:98)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4382)
at org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5040)
at org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5035)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(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:/E:/MyWorkspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/test2/WEB-INF/lib/struts2-core-2.3.12.jar!/struts-default.xml:29:72
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:429)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:473)
... 14 more
Caused by: Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/E:/MyWorkspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/test2/WEB-INF/lib/struts2-core-2.3.12.jar!/struts-default.xml:29:72
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:245)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:226)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
... 16 more
Caused by: Bean type class com.opensymphony.xwork2.ObjectFactory with the name xwork has already been loaded by bean - jar:file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%207.0/lib/struts2-core-2.3.12.jar!/struts-default.xml:29:72 - bean - jar:file:/E:/MyWorkspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/test2/WEB-INF/lib/struts2-core-2.3.12.jar!/struts-default.xml:29:72
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:229)
... 19 more
Mar 30, 2013 10:44:22 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error filterStart

2.3 Jars included are:
struts2-codebehind-plugin-2.3.12.jar
commons-lang3-3.1.jar
struts2-core-2.3.12.jar
xwork-core-2.3.12.jar
ognl-3.0.6.jar
javassist-3.11.0.GA.jar
asm-3.3.jar
asm-commons-3.3.jar
asm-tree-3.3.jar
freemarker-2.3.19.jar
commons-fileupload-1.2.2.jar
commons-io-2.0.1.jar
struts2-convention-plugin-2.3.12.jar
struts2-javatemplates-plugin-2.3.12.jar
struts2-config-browser-plugin-2.3.12.jar
struts2-dojo-plugin-2.3.12.jar
struts2-dwr-plugin-2.3.12.jar
dwr-1.1.1.jar
commons-logging-1.1.1.jar
struts2-jasperreports-plugin-2.3.12.jar
struts2-jfreechart-plugin-2.3.12.jar
struts2-jsf-plugin-2.3.12.jar
struts2-junit-plugin-2.3.12.jar
aopalliance-1.0.jar
struts2-pell-multipart-plugin-2.3.12.jar
struts2-plexus-plugin-2.3.12.jar
plexus-container-default-1.0-alpha-10.jar

plexus-utils-1.2.jar
classworlds-1.1.jar
struts2-portlet-plugin-2.3.12.jar
struts2-rest-plugin-2.3.12.jar
xstream-1.4.2.jar
xmlpull-1.1.3.1.jar
xpp3_min-1.1.4c.jar
json-lib-2.3-jdk15.jar
commons-beanutils-1.8.0.jar
commons-collections-3.1.jar
commons-lang-2.4.jar
ezmorph-1.0.6.jar
struts2-sitegraph-plugin-2.3.12.jar
struts2-sitemesh-plugin-2.3.12.jar
struts-core-1.3.10.jar
antlr-2.7.2.jar
commons-chain-1.2.jar
commons-digester-2.0.jar
commons-validator-1.3.1.jar
oro-2.0.8.jar
struts2-testng-plugin-2.3.12.jar
testng-5.1-jdk15.jar
struts2-tiles-plugin-2.3.12.jar
commons-logging-api-1.1.jar
struts2-json-plugin-2.3.12.jar
struts2-embeddedjsp-plugin-2.3.12.jar
struts2-gxp-plugin-2.3.12.jar
struts2-osgi-plugin-2.3.12.jar


velocity-1.6.4.jar
struts2-osgi-admin-bundle-2.3.12.jar
struts2-osgi-demo-bundle-2.3.12.jar
Saif Asif
Ranch Hand

Joined: Aug 11, 2011
Posts: 440

If you read the stack trace


...
Caused by: Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/E:/MyWorkspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/test2/WEB-INF/lib/struts2-core-2.3.12.jar!/struts-default.xml:29:72
...

And your library files you added

struts2-core-2.3.12.jar
xwork-core-2.3.12.jar


The struts2 core jar already has the xwork core jar included in it . Explicitely declaring it twice is what is causing the isuse. The Dispatcher first registers the xwork bean from struts2-core jar and then when it comes to read the xwork-core jar , it finds the same bean name again and thus throws the excpetion. So remove the xwork-core.

Handling these inner dependencies can become a difficult job , i suggest you use a build management tool like maven to handle the dependencies for you


Muhammad Saif Asif Mirza
OCJA(5/6) OCJP(6) OCJWCD(6)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in struts 2.3- Dispatcher initialization failed