• Post Reply Bookmark Topic Watch Topic
  • New Topic

java.lang.NoClassDefFoundError  RSS feed

 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am trying to call an EJB 3.0 code from a servlet and when i execute the servlet, I get the following error. I am using JBoss 5.1.0 for the EJB and am running the Servlet in Tomcat 6.0.

Here's the error log:


My servlet code is:


Please help!!!

 
amit punekar
Ranch Hand
Posts: 544
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
As your servlet is running in different JVM, you would need to put the required EJB classes (earlier were known as EJB client JAR, I am not sure if they call it the same now as well) in the classpath. This way your webapplication containing Servlet would be able to locate it.

Regards,
Amit
 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That error has gone away... but unfortunately i am plagued by another!!! When i run the JSP now.. I get the following error...



Now i searched www.findjar.com for javax.naming.Reference and i found out that it is in the jar called rt.jar. So i copied the rt.jar from my jdk 1.6 to my classpath. But still the error persists!
 
amit punekar
Ranch Hand
Posts: 544
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
You do not need to copy rt.jar as it is always in the Classpath.
The exception you are facing is ClassCastException , meaning you are using wrong typecast in your code.
Check the java documentation and you would be able to resolve this as well.

Regards,
Amit
 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well its done. It turned out that the JBoss EJB 3.0 jars were missing in the classpath and also added to the servlet class:



Found out out the problem after a little googling and an old thread in coderanch!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!