wood burning stoves 2.0*
The moose likes Struts and the fly likes Struts 2 Starting Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2 Starting Problem" Watch "Struts 2 Starting Problem" New topic
Author

Struts 2 Starting Problem

Sven Beckmann
Greenhorn

Joined: May 06, 2010
Posts: 6
Hi Folks,

I am new to Struts 2 and I've been trying to get some sample applications running for example this one:
http://www.benmccann.com/dev-blog/struts-2-tutorial-getting-started/
or this one:
http://viralpatel.net/blogs/2009/12/tutorial-create-struts-2-application-eclipse-example.html
But every sample application that is using a <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
in the struts.xml file is causing the following errors:

INFO: Parsing configuration file [struts-default.xml]
06.05.2010 22:12:46 com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
SCHWERWIEGEND: Dispatcher initialization failed
Unable to load configuration. - bean - jar:file:/C:/Users/Sven/Programmierung/Java/UniHausarbeit/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Struts2/WEB-INF/lib/struts2-core-2.1.8.1.jar!/struts-default.xml:47:178
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.FilterDispatcher.init(FilterDispatcher.java:190)
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.start(ContainerBase.java:1045)
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(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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 bean: typerg.apache.struts2.dispatcher.multipart.MultiPartRequest classrg.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest - bean - jar:file:/C:/Users/Sven/Programmierung/Java/UniHausarbeit/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Struts2/WEB-INF/lib/struts2-core-2.1.8.1.jar!/struts-default.xml:47:178
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:221)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:169)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
... 21 more
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileUploadException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getDeclaredConstructors(Unknown Source)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:211)
... 24 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.fileupload.FileUploadException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
... 28 more
06.05.2010 22:12:46 org.apache.catalina.core.StandardContext filterStart
SCHWERWIEGEND: Exception starting filter struts2
Unable to load configuration. - bean - jar:file:/C:/Users/Sven/Programmierung/Java/UniHausarbeit/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Struts2/WEB-INF/lib/struts2-core-2.1.8.1.jar!/struts-default.xml:47:178
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:431)
at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:190)
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.start(ContainerBase.java:1045)
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(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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. - bean - jar:file:/C:/Users/Sven/Programmierung/Java/UniHausarbeit/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Struts2/WEB-INF/lib/struts2-core-2.1.8.1.jar!/struts-default.xml:47:178
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)
... 19 more
Caused by: Unable to load bean: typerg.apache.struts2.dispatcher.multipart.MultiPartRequest classrg.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest - bean - jar:file:/C:/Users/Sven/Programmierung/Java/UniHausarbeit/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Struts2/WEB-INF/lib/struts2-core-2.1.8.1.jar!/struts-default.xml:47:178
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:221)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:169)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
... 21 more
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileUploadException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getDeclaredConstructors(Unknown Source)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:211)
... 24 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.fileupload.FileUploadException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
... 28 more
06.05.2010 22:12:46 org.apache.catalina.core.StandardContext start
SCHWERWIEGEND: Error filterStart

Sorry for the long stack trace, but I really don't know how to fix it. I checked the following topic, but the suggestions didn't help.
http://www.coderanch.com/t/479592/Struts/Getting-Dispatcher-initialization-failed-error

Even if i add the all jars from thestruts-2.1.8.1 package.
Has anyone any ideas or suggestions for me?

Edit:

IDE: Eclipse 3.5
Tomcat 6.0.20
struts-2.1.8.1

Need help...

Thanks anyway!
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Seems pretty clear: you're not including the commons-fileupload and/or commons-io libraries.

Do *not* just randomly add "all the Struts 2.1.8.1" libraries, *particularly* the plugins: this will cause your application to fail if you have not also included their transitive dependencies. It can also affect baseline behavior with potentially unintended consequences.

And welcome to JavaRanch!
Sven Beckmann
Greenhorn

Joined: May 06, 2010
Posts: 6
Hey,

thanks for your reply.
Addind commons-fileupload and/or commons-io won't resolve the problem.
Maybe I've got the wrong versions of them?

I find it very interesting, that the struts sample applications don't use the FilterDispatcher and are therefore working.
I am using the book "Struts 2 in Action" to help me get into the topic a little easier. Their sample applications available at: http://www.manning.com/dbrown/SampleApplication.zip
is using the FieldDispatcher and it is working... so I am probably doing something wrong here...
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Sven Beckmann wrote:Addind commons-fileupload and/or commons-io won't resolve the problem.

It'll resolve the problem above, because that's what the problem was.

What libraries are you deploying? (List the libraries you're deploying.)
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You should be using the ng dispatcher if you're using Struts 2.1; the original FilterDispatcher is deprecated. Look at the sample apps that come with the distribution.

But the stack trace above is due to the missing dependencies.
Sven Beckmann
Greenhorn

Joined: May 06, 2010
Posts: 6
Is that the actual name "ngdispatcher"? What it the classpath to it?

Missing dependencies means I have to not only add the files to the web-Inf/lib folder, but also as dependencies to the project?

Thanks!
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I don't remember the full path off the top of my head; "ng" is one of the package name. Hang on...

*googling*

org.apache.struts2.dispatcher.ng.filter maybe?

Libraries needed by the web app must be deployed with the web app.
Sven Beckmann
Greenhorn

Joined: May 06, 2010
Posts: 6
Hey

Solved the problem.
The FilterDispatcher is simply not available in the newer StrutsCore jarlibrary.
It exists in 2.0.11 thoug, so i simply use an old core and it works.

I find it very surprising that there I couldn't find any hint on that online, with the error message I got.

The package you said, nd.Filter is not working either, but I am gonna google it myself...

Thanks anyway!

Edit
{
New filter is this:
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
from the new Struts 2 exmaple applications
}
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

http://struts.apache.org/2.1.8/struts2-core/apidocs/deprecated-list.html
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts 2 Starting Problem
 
Similar Threads
struts2 error
Getting "Dispatcher initialization failed" error message while running Struts 2 example in Eclipse
No Class def found error
Exception in struts2 server startup
File not found error