Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

WAS 5.1 Classloaders

 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm getting some strange behavior with WAS 5.1 and finding resources. I deploy an EAR, which contains a WAR, an JAR of EJBs and the necessary 3rd party JAR libraries common to both the web layer and the ejb layer. The WAR contains an implementation of ServletContextListener which does some config stuff when the web app is started, for which it relies on these 3rd party libraries and a config file deployed in the EJB JAR file. However I'm getting NullPointerExceptions and NoClassDefFoundExceptions from the ServletContextListener when it tries to use one of these common files. I can deploy this fine in other application servers, and I have always understood that EAR files are largely used to bundle up all the applciation components and dependencies for easy deployment. Can anyone explain what's going on?
 
Sudhir Meduri
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assume you must be having the common jars in a seperate directory
provide that path in the WEB and EJB MANIFEST.MF file.

Class-Path: dir/Common.jar

Please let us know how did it go

Thanks
Sudhir
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Manifest is relative to the root of the WAR file though - I don't see how I can set a Class-path entry in therte for something outside of the WAR.
 
Sudhir Meduri
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hmm..

path of mycommon/common.jar needs to be relative to the root of the EAR file

Try this:

In the Manifest file for the Web.war
Manifest-Version:1.0
add this line
Class-Path: mycommon<relative_to_ear>/common.jar
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes that's how I'd expect it to work. Unfortunately it doesn't. If I watch a trace of the classloaders the manifest is just ignored (even if I include some junk it should at least complain about).
 
Sudhir Meduri
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Strange!!

The only thing I could think of with out the log feed back is to try edit the manifest using the Assembly tookit instead of manual editing(technically shouldn't make a diff but never know)
I'll try my side too.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic