Title: Message
David,
 
AFAIK you should be able to have:
 
  app.ear
  +-- shared-utils.jar
  |   +-- /com/dummy/my.class
  +-- first.war
  |   +-- /META-INF/manifest.mf - Class-Path: shared-utils.jar
  +-- second.war
      +-- /META-INF/manifest.mf - Class-Path: shared-utils.jar
 
This also applies to EJB jar files, etc. - they can use the Class-Path to refer to a shared jar. There is no need to reference the shared jar in your application.xml (unless it also happens to be a bean jar, etc.)
 
I am not sure if JBoss' UnifiedClassLoader would interfere with this or not. Frankly, the UCL scares me silly - I like the idea of being able to deploy different versions of the same library (say, Struts) in different EAR files if I wish to - so I invariable add a jboss-app.xml to my EAR to turn UCL "off".
 
One use of this technique would be to take all the libraries out of the WAR file lib directory and move them into the EAR. This would prevent duplicate copies of libraries, etc.
 
Another thing to keep in mind is that if you use Class.forName() you may have classloading problems. (Again, this seems particularly prevalent with JBoss - although JBoss is still spec compliant, AFAIK). I *think* the correct technique is:
 
    Class clazz = Thread.currentThread().getContextClassLoader().loadClass(className);
    Object obj = clazz.newInstance();
 
Hope that helps,
 
Dan.
 
--
Danny Yates
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 13 June 2003 14:07
To: [EMAIL PROTECTED]
Subject: [JBoss-user] Multiple WARs; classloader & ClassNotFoundExceptions


Hi,

Is it possible to have multiple WARs in an EAR which share classes? I have
tried this on a project we're on, with what seemed like all of the correct
module declarations in the application.xml and also w/ a Class-Path entry
in the manifests of the WARs. I've tried several permutations of this idea
and had continuous problems w/ ClassNotFoundExceptions and "no classLoader
found for class ..." exceptions.

Is this something that simply doesn't work? I would have thought that
running under JBoss-Jetty, everything would be using the
UnifiedClassLoader, and thus all the classes would be available.

Are there certain classes which simply MUST be in the WAR file itself?

Dave


_____________________________________________________________________

Notice to recipient:

The information in this internet e-mail and any attachments is confidential and may be privileged. It is intended solely for the addressee. If you are not the intended addressee please notify the sender immediately by telephone. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful.


When addressed to external clients any opinions or advice contained in this internet e-mail are subject to the terms and conditions expressed in any applicable governing terms of business or client engagement letter issued by the pertinent Bank of America group entity.


If this email originates from the U.K. please note that Bank of America, N.A., London Branch, Banc of America Securities Limited and Banc of America Futures Incorporated are regulated by the Financial Services Authority.

_____________________________________________________________________



Reply via email to