aspose file tools*
The moose likes Struts and the fly likes No Class def found error 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 "No Class def found error" Watch "No Class def found error" New topic
Author

No Class def found error

leo jacob
Greenhorn

Joined: May 02, 2011
Posts: 17
hi,

while running a struts2 small application I got the following error with eclipse indigos console. Please help me in tracing the root cause. I have already made the jar files in build path. I got the following error:



May 2, 2011 3:56:54 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre6\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre6/bin/client;C:/Program Files/Java/jre6/bin;C:/Program Files/Java/jre6/lib/i386;D:\oracle\product\10.2.0\db_1\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jdk1.6.0_23\bin;D:\eclipseIndigo\eclipse;
May 2, 2011 3:56:55 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:webApps3' did not find a matching property.
May 2, 2011 3:56:55 PM org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
May 2, 2011 3:56:55 PM org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
May 2, 2011 3:56:55 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 575 ms
May 2, 2011 3:56:55 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
May 2, 2011 3:56:55 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.12
May 2, 2011 3:57:07 PM com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
WARNING: Could not create JarEntryRevision for [jar:file:/D:/eclipseIndigo/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/webApps3/WEB-INF/lib/struts2-core-2.2.1.1.jar]!
java.lang.NoClassDefFoundError: org/apache/commons/io/output/NullOutputStream
at com.opensymphony.xwork2.util.FileManager$JarEntryRevision.build(FileManager.java:307)
at com.opensymphony.xwork2.util.FileManager.loadFile(FileManager.java:145)
at com.opensymphony.xwork2.util.FileManager.loadFile(FileManager.java:105)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:898)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:154)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:121)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:179)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:415)
at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:190)
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:4562)
at org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5240)
at org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5235)
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: java.lang.ClassNotFoundException: org.apache.commons.io.output.NullOutputStream
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
... 23 more
May 2, 2011 3:57:07 PM com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
INFO: Parsing configuration file [struts-default.xml]
May 2, 2011 3:57:07 PM com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
SEVERE: Dispatcher initialization failed
Unable to load configuration. - bean - jar:file:/D:/eclipseIndigo/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/webApps3/WEB-INF/lib/struts2-core-2.2.1.1.jar!/struts-default.xml:48:178
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:415)
at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:190)
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:4562)
at org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5240)
at org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5235)
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: typerg.apache.struts2.dispatcher.multipart.MultiPartRequest classrg.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest - bean - jar:file:/D:/eclipseIndigo/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/webApps3/WEB-INF/lib/struts2-core-2.2.1.1.jar!/struts-default.xml:48:178
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:232)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:180)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
... 15 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:222)
... 18 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.fileupload.FileUploadException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
... 22 more
May 2, 2011 3:57:07 PM org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter struts2
Unable to load configuration. - bean - jar:file:/D:/eclipseIndigo/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/webApps3/WEB-INF/lib/struts2-core-2.2.1.1.jar!/struts-default.xml:48:178
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:428)
at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:190)
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:4562)
at org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5240)
at org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5235)
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:/D:/eclipseIndigo/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/webApps3/WEB-INF/lib/struts2-core-2.2.1.1.jar!/struts-default.xml:48:178
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:415)
... 13 more
Caused by: Unable to load bean: typerg.apache.struts2.dispatcher.multipart.MultiPartRequest classrg.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest - bean - jar:file:/D:/eclipseIndigo/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/webApps3/WEB-INF/lib/struts2-core-2.2.1.1.jar!/struts-default.xml:48:178
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:232)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:180)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
... 15 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:222)
... 18 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.fileupload.FileUploadException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
... 22 more
May 2, 2011 3:57:07 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error filterStart
May 2, 2011 3:57:07 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/webApps3] startup failed due to previous errors
May 2, 2011 3:57:07 PM org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["http-bio-8080"]
May 2, 2011 3:57:07 PM org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
May 2, 2011 3:57:07 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 12155 ms


Mikke Haelstrom
Greenhorn

Joined: Sep 11, 2011
Posts: 2

(Even though you might have fixed it.)

Looks like the Struts2 app is missing the commons-io* and commons-fileupload* jars.

At a minimum to run a helloworld kind Struts2 app would require these jars.
- struts2-core-*.jar
- xwork-core-*.jar
- ognl-*.jar
- commons-logging-*.jar
- commons-io*.jar
- commons-lang*.jar
- commons-fileupload*.jar
- freemarker-*.jar
- javaassist-*.jar

The jars will be available in the Struts2 distribution (download from struts.apache.org), in the lib folder.

Note: I use Struts2.2.x and higher.
Ravindra B Pawar
Greenhorn

Joined: Jul 18, 2010
Posts: 9
Hi Mikke ,

I wanted to know how can we come to know which jars are required to run the struts2 project

and how can we know struts dependencies and all

with new version some new jars are needed and it becomes really difficult for newcomers till they figure out what really is going on


appreciate your help in this

Mikke Haelstrom
Greenhorn

Joined: Sep 11, 2011
Posts: 2

In general, I personally make it a point to refer *first* core documentation.

For Struts2 - http://struts.apache.org/2.2.3.1/docs/home.html

What we all do when starting something new, is to build a -helloworld- sort of application. Sometimes the documentation will miss a few things. In that case refer to the exceptions when Tomcat is loading the Struts2 application.

(And post how you solved it, for developers referring to it later know what the problem was and the resolution)

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: No Class def found error