Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.NoClassDefFoundError when the file is there

I've tried to look around for postings that might help me, cant find any.

I am deploying an ear to JBoss4 server, and I started having this problem since I added a new project.

this new project is defined as Java project in eclipse, and the EAR project has an EJB project that has the new Java project as one of the projects as its dependent upon - if deployed on JBoss locally through eclipse, there's no problem and everything goes smoothly

But when being deployed to JBoss in test environment (outside eclipse), kept getting java.lang.NoClassDefFoundError on one of the classes that are defined in the new Java project.

I looked inside the EAR file to get to the jar (EJB project), and then inside the jar, I can see the directory structure and all the class files from the new Java project - ie. The class that it complains about is right there inside the EAR->JAR and matching the exact structure that it's looking for.

I am at lost to what else I can look at.

Any pointers are greatly appreciated!

Thanks

like image 635
TS- Avatar asked Jan 14 '11 04:01

TS-


1 Answers

You often get this error if there is a mismatch in the way some of the classes were compiled. For example if you compiled some of the classes in a later version of the JDK without setting the java compliance level and you are running it with an earlier version.

My suggestion is to check the JDK you are running JBoss with, then check how you compiled your classes

like image 194
Dunderklumpen Avatar answered Oct 31 '22 23:10

Dunderklumpen