开发者

NoClassDefFoundError when class is in JBoss 6 WAR WEB-INF/classes folder

My problem is that I have a web application built and deployed as a WAR file to JBoss 6. My servlet fails to load a class in my app and throws a NoClassDefFoundError.

I confirmed that this class exists in the correct location of the WAR file. All of my application classes exist in the WEB-INF/classes folder, along with my servlet class which executes without a hitch. In fact, it seems it is just this one class that is not on the classpath because other aspects of the application run great.

JBoss is running on JDK 1.6_21, the app was built with JDK 1.6_24, this shouldn't be an issue right?

Further this app runs fine locally within Eclipse, and when I deploy the WAR file to a seperate Tomcat 7 and Glassfish 3 server they both find this class without a problem.

I am not expecting anybody to just instantly know whats wrong, if anybody has seen something like this happen before then please share your experiences, or if you have good tips开发者_开发技巧 or know of good tools for REALLY getting deep into classpath issues then please share.


NoClassDefFoundError means that the class was "loaded" but the class definition could not be built. It usually happen when there is an exception in the static initialization of the class. I have seen more than once in AppServers that exceptions during the static initialization is not reported in the log file.

Check the static blocks and initialization of static attributes of the class that is failing for potential causes of exceptions.

Another cause that I have seen in JBoss and WebSphere is that the web application is distributing some library that conflicts with a library in the app server (like servlet.jar or something). Usually the problem is solved by removing the offending library or tweaking the classloading mechanism to "parent first".

hope this helps

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜