Language Translator

Showing posts with label Error. Show all posts
Showing posts with label Error. Show all posts

java.lang.ClassNotFoundException:Error in loading of User Libraries, JARS not getting loaded

java.lang.ClassNotFoundException:
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1701)

Hi Folks, I got above error while deploying some Dynamic Web project in the Apache tomcat web-server using Eclipse Indigo.

POSSIBLE CAUSE(S):
a) This error may be caused due to missing of class/jar from application classpath.
              i) Project Properties ---> Java Build Path ---> Libraries---> jars
             ii) Project Properties ---> Java Build Path ---> Libraries---> UserLibrary ---> jars
            iii) YourProject/WebApp/WEB-INF/lib/----> jars
           
b) Required JARS are not included/checked in the "Order and Export" tab. i.e.
             Project Properties ---> Java Build Path ---> Order and Export

CAUSE OF ERROR IN MY CASE & SOLUTION:
I was using option a) part ii) (highlighted above in red color), that I had included libraries (jars) as "USER LIBRARY" (feature in eclipse).
But, I missed to check/include the "USER LIBRARY" entries in Java EE Module dependencies.
Due to this, 
Classpath entries <JAR name> not get exported or published, Leading to Runtime "ClassNotFoundExceptions" as a result.

To remove this error, 
a) Prior to Eclipse Helios version:
Go to Build Path ---> Configure Build Path ---> Java EE Module Dependencies and click to include the library in Eclipse's deployment.
b) After Eclipse Helios version:

i)  Right-click on the project in the Project explorer 
ii ) Choose properties --> Deployment Assembly option.
iii) Click on src, then click on the Add button.
iv) Then, in the New Assembly Directive dialog, click...
v) Java Build Path Entries, Next--> Finish.

Restart your server and I believe this ERROR will be GONE!!!

Thanks,
Ravinderjeet.