Question

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

Was it helpful?

Solution

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

OTHER TIPS

I had a problem like that with JBoss 4: ClassNotFoundException and NoClassDefFoundError at runtime even if the code compiled well. It took me 4 hours to find out the cause.

The BuildPath of my projects were ok, the problem was actually in the ClassPath of JBoss. I solved it by doing : JBoss 4.2 RunTime Server > Open launch configuration > Edit Configuration > ClassPath > adding JARs and projects to link to JBoss with "Add JARs" / "Add Projects".

Eclipse knew the classes in the JARs and the related projects thanks to the BuildPath, so there was no error in the IDE, but the JBoss server didn't know where to find these classes...

This could also be due to classloader isolation issues if you have multiple war/ear files

check ur ear file . the structure like this?

myapp.ear
|+ META-INF
   |+ applications.xml and jboss-app.xml
|+ myapp.war
   |+ web pages and JSP /JSF pages
   |+ WEB-INF
      |+ web.xml, jboss-web.xml, faces-config.xml etc.
      |+ lib
         |+ tag library JARs
      |+ classes
         |+ servlets and other classes used by web pages
|+ myapp.jar
   |+ EJB3 bean classes
   |+ META-INF
      |+ ejb-jar.xml and persistence.xml
|+ lib
   |+ Library JARs for the EAR

if not , u should repackage ur ear file.

Check property "Class-Path:" in META-INF/MANIFEST.MF.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top