Why do I get java.lang.NoClassDefFoundError or java.lang.ClassNotFoundException ............
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   veena_yadav
Posted On:   Sunday, February 19, 2006 12:58 AM

Why do I get java.lang.NoClassDefFoundError or java.lang.ClassNotFoundException and javax.servlet.ServletException: Servlet execution threw an exception when I run my code on local host for Java? All the classes are there and copied in the class directory of servlet and it compiles fine.

Re: Why do I get java.lang.NoClassDefFoundError or java.lang.ClassNotFoundException ............

Posted By:   Anonymous  
Posted On:   Monday, February 20, 2006 06:37 AM

The problem, which I could see, during runtime the servlet trying to access some class but it is not available.

First check what external classes/JARS this servlet is dependent on.

You need to put these classes under
%CONTEXT-ROOT%/WEB-INF/Classes(Servlet directory) or

If the dependent classes availble to you as JAR then put it inside %CONTEXT-ROOT%/WEB-INF/lib/xyz.jar

Remember the container needs to access these classes during runtime!



Hope this helps!!!

Re: Why do I get java.lang.NoClassDefFoundError or java.lang.ClassNotFoundException ............

Posted By:   santosh_pahariya  
Posted On:   Sunday, February 19, 2006 03:44 AM

whenever u get this error you should first confirm ur classpath.if you are getting again and again try to set classpath once again with following syntax on command prompt

set classpath=%classpath%;your foldername;.;
for example:-
c:javaprogram>setpath=%classpath%;c:javaprogram;.;
About | Sitemap | Contact