Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>According to Oracle:</strong></p> <blockquote> <p><code>NoClassDefFoundError</code> is 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.</p> </blockquote> <p>In simple language, it means "At compile-time <code>class</code> was there but at run-time, it failed to find/load the <code>class</code><br/><br/> <strong>Question comes : How come my code compile?</strong></p> <p>Answer maybe because you added <code>jars</code> using Eclipse. But Eclipse does not actually move those <code>jars</code> into you <code>classpath</code>.It just uses those referenced <code>jars</code> while compilation. So your code compiles fine. <br/> After, you move your project to tomcat, when it tries to load some class inside those 'jars', it fails to find the <code>class</code>,because you never moved those <code>jars</code> to the classpath.<br/><br/> <strong>Solution:</strong><br/> Move all the <code>libraries(jars)</code> into your project's <code>/WEB-INF/lib</code>. Now all the <code>libraries/jars</code> under <code>/WEB-INF/lib</code> will come under <code>classpath</code>. </p> <p>You can read more on <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/NoClassDefFoundError.html" rel="nofollow">Oracle's Docs</a> &amp; <a href="http://javarevisited.blogspot.in/2011/06/noclassdeffounderror-exception-in.html" rel="nofollow">this article</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload