my dog learned polymorphism*
The moose likes Struts and the fly likes Error while trying to run struts2-blank-2.1.8.1 sample application in Eclipse and Tomcat 6 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Error while trying to run struts2-blank-2.1.8.1 sample application in Eclipse and Tomcat 6" Watch "Error while trying to run struts2-blank-2.1.8.1 sample application in Eclipse and Tomcat 6" New topic
Author

Error while trying to run struts2-blank-2.1.8.1 sample application in Eclipse and Tomcat 6

p karnam
Greenhorn

Joined: Jan 20, 2010
Posts: 7
Hi,

I am trying to run a sample struts2-blank-2.1.8.1 (by unzipping into Tomcat webapps directory) application using Eclipse and Tomcat 6. I am getting the following error not sure what is the issue. I am able to start and stop Tomcat 6 successfully if I remove this sample application from Tomcat Webapps directory. Can anyone let me know what is going on here, is it some incompatibility in versions?


INFO: Initializing Coyote HTTP/1.1 on http-8080
Feb 2, 2010 7:22:12 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1254 ms
Feb 2, 2010 7:22:12 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Feb 2, 2010 7:22:12 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.20
Feb 2, 2010 7:22:14 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive struts2-blank-2.1.8.1.war
Feb 2, 2010 7:22:15 PM com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
INFO: Parsing configuration file [struts-default.xml]
Feb 2, 2010 7:22:16 PM com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
INFO: Parsing configuration file [struts-plugin.xml]
Feb 2, 2010 7:22:17 PM com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
INFO: Parsing configuration file [struts.xml]
Feb 2, 2010 7:22:17 PM com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
SEVERE: Dispatcher initialization failed
Unable to load configuration. - [unknown location]
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418)
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3800)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4450)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:850)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:724)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:493)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1206)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:314)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: Cannot locate the chosen ObjectFactory implementation: spring - [unknown location]
at org.apache.struts2.config.BeanSelectionProvider.alias(BeanSelectionProvider.java:293)
at org.apache.struts2.config.BeanSelectionProvider.alias(BeanSelectionProvider.java:264)
at org.apache.struts2.config.BeanSelectionProvider.register(BeanSelectionProvider.java:203)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:169)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
... 31 more
Feb 2, 2010 7:22:17 PM org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter struts2
Unable to load configuration. - [unknown location]
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:431)
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3800)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4450)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:850)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:724)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:493)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1206)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:314)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: Unable to load configuration. - [unknown location]
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418)
... 29 more
Caused by: Cannot locate the chosen ObjectFactory implementation: spring - [unknown location]
at org.apache.struts2.config.BeanSelectionProvider.alias(BeanSelectionProvider.java:293)
at org.apache.struts2.config.BeanSelectionProvider.alias(BeanSelectionProvider.java:264)
at org.apache.struts2.config.BeanSelectionProvider.register(BeanSelectionProvider.java:203)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:169)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
... 31 more
Feb 2, 2010 7:22:17 PM org.apache.catalina.core.StandardContext start
SEVERE: Error filterStart
Feb 2, 2010 7:22:17 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/struts2-blank-2.1.8.1] startup failed due to previous errors
Feb 2, 2010 7:22:18 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Feb 2, 2010 7:22:18 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Feb 2, 2010 7:22:18 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/94 config=null
Feb 2, 2010 7:22:18 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 5714 ms
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Did you modify the deployment in any way?
p karnam
Greenhorn

Joined: Jan 20, 2010
Posts: 7
No, I didn't modify the deployment.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

What libraries does it deploy? Can you post the config (I don't have the latest blank app in front of me)?
p karnam
Greenhorn

Joined: Jan 20, 2010
Posts: 7
Following are the files in the lib directory of blank application

xwork-core-2.1.6.jar
ognl-2.7.3.jar
freemarker-2.3.15.jar
commons-io-1.3.2.jar
commons-fileupload-1.2.1.jar

please note that I have removed struts2-core-2.1.8.1.jar for Prj lib dir, as the server was complaining about duplication in project lib and Tomcat lib directories.

Following is web.xml contents


Following is struts.xml contents



Please let me know if any other info required.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Please UseCodeTags when posting code or configuration. Unformatted code and configuration is very difficult to read. You can edit your post to include them by using the button.

Remove the shared Struts 2 lib; only deploy it in your project.

What's in example.xml? It shouldn't be complaining about missing Spring stuff from what I see so far.
p karnam
Greenhorn

Joined: Jan 20, 2010
Posts: 7
Tried moving the Struts 2 to project library from shared lib, but now getting error similar to following. Moving Struts 2 core file to project dir from common/share directory of Tomcat doesn't make sense to me, ideally the common jars should be in shared drive and project specific should be in project directory, correct me if I am wrong?

Caused by: Unable to load bean: type:com.opensymphony.xwork2.ObjectFactory classrg.apache.struts2.osgi.DelegatingObjectFactory - bean - jar:file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%206.0/lib/struts2-osgi-plugin-2.1.8.1.jar!/struts-plugin.xml:18:126

Yes, this is Struts application not a Spring application, not sure why it is complaining about spring?

Following is example.xml file.


David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Because you've deployed a random collection of Struts 2 libraries in the Tomcat lib directory. Remove them. The exception says exactly what's wrong:You can't just deploy any old Struts 2 plugin you want: plugins introduce their own dependencies and configuration requirements.
p karnam
Greenhorn

Joined: Jan 20, 2010
Posts: 7
Thank you David. I have removed all the plugins from Tomcat lib directory, now the application is working fine. I appreciate your help in resolving this.
roshan we
Greenhorn

Joined: Feb 10, 2010
Posts: 1
As I see this is not a spring application, but if it was and if it gives this error add the following jar file to your lib to solve the problem: struts2-spring-plugin.jar
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Late, and wrong. You'd also need to add all of Spring's dependencies. Please try to make sure the information you're adding is timely and appropriate.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Error while trying to run struts2-blank-2.1.8.1 sample application in Eclipse and Tomcat 6
 
Similar Threads
BeanDefinitionStoreException on application deployment
Unable to load configuration-struts2
SEVERE: Dispatcher initialization failed
Struts2 & XWork
Struts 2 problem in Tomcat