aspose file tools*
The moose likes JBoss/WildFly and the fly likes Accessing common jar files in EAR Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Accessing common jar files in EAR" Watch "Accessing common jar files in EAR" New topic
Author

Accessing common jar files in EAR

Saathvik Reddy
Ranch Hand

Joined: Jun 03, 2005
Posts: 228
Hi,

I have an EAR file. I would like to have a jar file which could be accessed by both EJB(JAR) and Web(WAR) modules with in the EAR. If i put this jar file in the top-level directory inside the .ear file is it accessible by both the EJB and Web modules? If not where should i put the common jar in EAR file to be accessed by both EJB and Web modules?

Thanks in Advance,
Srikanth.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5845
    
    7

If you place the JAR file in the base directory of the EAR, and include it in the application.xml file, then it will be available to both EJBs and WAR.

In 5.0, you could also place it in the lib directory within the EAR. Then you do not need to add it to the application.xml file. I am not sure if this scheme would work on 4.2.x.


JBoss In Action
Saathvik Reddy
Ranch Hand

Joined: Jun 03, 2005
Posts: 228
Originally posted by Peter Johnson:
If you place the JAR file in the base directory of the EAR, and include it in the application.xml file, then it will be available to both EJBs and WAR.

In 5.0, you could also place it in the lib directory within the EAR. Then you do not need to add it to the application.xml file. I am not sure if this scheme would work on 4.2.x.


Peter, It worked! but, just curious to know: If we add the jar file to the class path thru manifest files(Class-Path: common.jar) in ejb-jar and war files. is common.jar accessible to both the modules?
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5845
    
    7

Originally posted by Srikanth Reddy:
If we add the jar file to the class path thru manifest files(Class-Path: common.jar) in ejb-jar and war files. is common.jar accessible to both the modules?


I have never tried this (at least, not intentionally!) so do not know if it would work.
 
wood burning stoves
 
subject: Accessing common jar files in EAR