• Post Reply Bookmark Topic Watch Topic
  • New Topic

NoClassDefFoundError problem with WAR in 8.1  RSS feed

 
Noel Kendall
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Am deploying an app as separate WAR and ejb-jar. Using ANT to build both pieces. Have successfully built and deployed WAR on JBoss 3.0 with Tomcat.
War contains:
web.xml, and weblogic.xml where they should be.
WEB-INF/lib contains several jar files, as follows:
web.jar (web tier only classes)
properties.jar (just contains a .properties resource file)
common.jar (common to web tier and ejb tier, contains ejb interfaces)
log4j and similar utility jars
schemas.jar containing some xml schema documents for messaging
There are only two servlets in the app. Both servlets are configured to load on startup, but neither succeeds. A servlet exception is thrown, the stack trace of the cause is not logged by WLS. If I subsequently attempt to drive the servlet with an http request, I get a NoClassDefFoundError thrown out of one of my classes in common.jar. This to me means: the servlet in web.jar was found, the class was loaded, and began execution; the class that caused the exception was found in common.jar, loaded, and was successfully called by the servlet. Problem is, the class that is not found does indeed exist, and is found in common.jar.
I have tried the war file with and without a manifest. My understanding is that if the jars are located in WEB-INF/lib, then no manifest is required. This is indeed the case under Tomcat.
At this point, I am stumped.
Any ideas?
 
Sai Prasad
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My guess is that one of your EJBs is trying to access the class which is loaded by web application classloader and not the enterprise class loader.
 
Noel Kendall
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anticipating that very issue, I did this test without deploying the ejb-jar on the server - to isolate just the .WAR issues.
There are no EJBs in this instance.
This has the appearance of WLS classloaders not functioning correctly if no parent EAR classloader exists.
 
Chris Mathews
Ranch Hand
Posts: 2712
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just for fun , unpack the web.jar and common.jar to WEB-INF/classes and see if you get the same results. I realize that this is ultimately not what you want but it will be helpful for troubleshooting.
 
Chris Mathews
Ranch Hand
Posts: 2712
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Noel Kendall:
This has the appearance of WLS classloaders not functioning correctly if no parent EAR classloader exists.

Number one rule in debugging: Always blame yourself first.
 
Noel Kendall
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
New information: the problem is related to loading a properties file from a jar using resource input stream facilities of class loader. The jar containing the resource file exists, and sits alongside the other application class file jars in WEB-INF/lib. A static initializaer in a superclass of a servlet references a resource, hence the failure on load. The same structure works under JBoss, so it has to be a class loader difference between JBoss and WebLogic.
Can anyone illuminate? Is there something special that has to be done to get WebLogic to find and load resources out of jar in WEB-INF/lib in a WAR?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!