File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Websphere and the fly likes Sharing resources between EARs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "Sharing resources between EARs" Watch "Sharing resources between EARs" New topic
Author

Sharing resources between EARs

Andrew Sweeney
Greenhorn

Joined: Jan 11, 2002
Posts: 26
Hey there everyone,


I'm trying to share some code (a couple of util classes or so) between EARs w/in WAS 4.0. Is there a good way to do this, outside of packaging two versions into the underlying JARs? This may be a very rudimentary problem, but I await your ideas... Thanks!
[ April 09, 2002: Message edited by: Andrew Sweeney ]
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
No, this can't be done, don't try it. EARs are meant to be separate, totally self-contained appliation packages. Just add the same ZIP or JAR file inside both EARs and update the manifest files of your WAR and EJB-JAR files appropriately.
Yes, there are classpaths in WebSphere that are shared by all EAR files, but DON'T USE THEM!
Kyle


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Se Ravin
Greenhorn

Joined: Feb 18, 2002
Posts: 26
Hi Kyle,
We have some 10 web applications under an appserver and all are using log4j as the logging tool,I have put log4j jar file in the AppServers class path.Is this not the correct way to do?
Should i put them in all the ear file?
Expecting ur reply,
Senthil


We are and We are Not
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
IMHO, yes, Log4J should be included in the EAR file of each. Imagine what would happen if ONE of your 10 apps moved to a different level of Log4J than the other ones -- what you've done is create a dependency between your applications that shouldn't exist.
Don't worry about having multiple copies of the same code -- the space is not enough to worry about.
Kyle
Andrew Sweeney
Greenhorn

Joined: Jan 11, 2002
Posts: 26
Hi Kyle,
I think my apprehension stems not from the storage issue, but more of a maintenance one. Imagine you have sixty EARs deployed, when the decision comes down that all apps now need a larger audit trail. This will involve going into every EAR and making the change within the code. Is there a way to maintain resource integrity, while still ensuring efficient maintainability?
-Andrew
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
Well, we would advocate having a build process for your EARs that comes straight out of your source code repository (PVCS, ClearCase, CVS, etc.) so that when after an EAR is built it doesn't have to be monkeyed with. When you update your app, you request a build and voila, you get an up-to-date, complete EAR that you then redeploy.
Kyle
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Sharing resources between EARs