Java.lang.NoClassDefFoundError when the file is

I tried to look back at messages that could help me, but could not find.

I am using the ear for a JBoss4 server and I am having this problem since I added a new project.

This new project is defined as a Java project in eclipse, and the EAR project has an EJB project, which has a new Java project as one of the projects, because it depends on it - if it is deployed to JBoss locally through eclipse, there are no problems and everything goes smoothly

But when deploying to JBoss in a test environment (outside of eclipse), getting java.lang.NoClassDefFoundError on one of the classes defined in the new Java project continued.

I looked into the EAR file to get to the jar (EJB project), and then inside the jar, I see the directory structure and all the class files from the new Java project - that is. The class he complains about is right inside the EAR-> JAR and matches the exact structure he is looking for.

I'm lost, what else can I look at.

Any pointers are welcome!

thanks

+6
java classnotfoundexception jboss
source share
5 answers

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

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

+6
source share

It could also be due to Loader class isolation problems if you have multiple war / ear files

+1
source share

I had a problem with JBoss 4: ClassNotFoundException and NoClassDefFoundError at runtime, even if the code was compiled. It took me 4 hours to find out the reason.

BuildPath of my projects was fine, the problem was in ClassPath JBoss. I solved this by doing: JBoss 4.2 RunTime Server> Open Launch Configuration> Change Configuration> ClassPath> add JAR and projects to link to JBoss using "Add JAR" / "Add Projects".

Eclipse knew the classes in the JAR and related projects thanks to BuildPath, so there were no errors in the IDE, but the JBoss server did not know where to find these classes ...

+1
source share

check ur ur file. such a structure?

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 repack the ear cheers file.

0
source share

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

0
source share

All Articles