Difference between version and version      View first change»»

Back to Java.lang.NoClassDefFoundError, or Java.lang.NoClassDefFoundError version history

At line 7 added 25 lines.
!!java.lang.NoClassDefFoundError: Could not initialize class (some class name)
Submitter: [Neale Rudd]
{{{
java.lang.NoClassDefFoundError: Could not initialize class (some class, such as gwtserver.upload.UploadAction)
at org.apache.jsp.a_jsp._jspService(a_jsp.java:72)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at sun.reflect.GeneratedMethodAccessor593.invoke(Unknown Source)
}}}
This exception is thrown when initialization of a class fails, unfortunately it can be quite time consuming to find the cause.
An example is that an exception is being thrown and silently ignored by the initializer or static initialization area of code in the class or a class which it relies on, preventing this class to be properly initialized.
A common cause is that log4j is being used, but not being correctly initialized. log4j is known to silently hide the error, rather than outputing it to the System.log. For example, the gwtupload serlet fails (up to version 1.0.1 anyway) with the message "INFO: Marking servlet uploadServlet as unavailable". By attempting to instantiate the class using a simple JSP test file, you can see the NoClassDefFoundError, and then looking into it further, it is caused by log4j not being initialized, due to an invalid path for the log file.
* You may see a [java.security.AccessControlException] or a log4j error of some type, even higher up, complaining that the log file could not be written.
* Ensure the log4j.properties file has an absolute path specified for the log file, such as /cust/myaccount/home/sample.log instead of simply sample.log
* Try instantiating the parent class of the class, and see if it can be initialized. Also check other classes that are used until you find the problem class.
\\
At line 51 changed 1 line.
[research paper|http://iresearchpapers.com/]
navigation
metawerx specific
search
Share
tools
help

referring pages

Share