What is a NoClassDefFoundError in java exception Reason and when will occur the error
NoClassDefFoundError is another common exception thrown by the class loader during the loading phase. The JVM specification defines NoClassDefFoundError as follows:
Thrown if the Java virtual machine or a ClassLoader instance tries to load in the definition of a class (as part of a normal method call or as part of creating a new instance using the new expression) and no definition of the class could be found.
The searched-for class definition existed when the currently executing class was compiled, but the definition can no longer be found.
Essentially, this means that a NoClassDefFoundError is thrown as a result of a unsuccessful implicit class load.
Note :
Another One Reason occure the “ NoClassDefFoundError”
Our Server have the jre 1.5 But you local system jre 1.6
Your local system class file generated by jdk 1.6 . that file uploed to the server . Then show the error. Because server have jdk 1.5. So version one problem.
Example Error Code
500 Servlet Exception
java.lang.NoClassDefFoundError: yellowpages/helper/AllCategoryDAO
at yellowpages.action.AllCategoryAction.execute(AllCategoryAction.java:27)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:413)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:225)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1858)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:446)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:114)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:91)
at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:103)
at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:181)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:266)
at com.caucho.server.hmux.HmuxRequest.handleRequest(HmuxRequest.java:435)
at com.caucho.server.port.TcpConnection.run(TcpConnection.java:602)
at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:690)
at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:612)
at java.lang.Thread.run(Thread.java:619)
Good definition of the NoClassDefFoundError
ReplyDelete