dcsimg
EAR, WAR and JAR confusion!
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Kristoffer_Larsson
Posted On:   Wednesday, August 28, 2002 02:32 AM

I have this application which consists of EJB's, servlets and lots of utility classes. Now, I would like to deploy the EJB's into a JAR file, the servlets and utility classes into a WAR file and the JAR and WAR files into an EAR file. Now, the EJB's use methods in the utility classes, but so do the servlets. Is there any way to deploy this project so that both the EJB's and the servlets have access to the utility classes WITHOUT these utility classes having to be included in both the JAR and the WAR file? I have tried several different things, but they have all failed. If I include the utility classes in both the JAR and the WAR file, everyting works, but that's ugly and redundant and I don't like it at all ...    More>>

I have this application which consists of EJB's, servlets and lots of utility classes. Now, I would like to deploy the EJB's into a JAR file, the servlets and utility classes into a WAR file and the JAR and WAR files into an EAR file.


Now, the EJB's use methods in the utility classes, but so do the servlets. Is there any way to deploy this project so that both the EJB's and the servlets have access to the utility classes WITHOUT these utility classes having to be included in both the JAR and the WAR file?


I have tried several different things, but they have all failed. If I include the utility classes in both the JAR and the WAR file, everyting works, but that's ugly and redundant and I don't like it at all ...


Any help greatly appreciated!

Kristoffer Larsson, d95-kla@nada.kth.se

   <<Less

Re: EAR, WAR and JAR confusion!

Posted By:   Anonymous  
Posted On:   Wednesday, August 28, 2002 03:33 AM

J2EE Spec 1.3 § 8.1.1.2 "Dependencies":

"The J2EE platform supports the use of bundled optional packages as specified in Extension Mechanism Architecture (available at http://java.sun.com/j2se/1.3/docs/guide/extensions/spec.html). Using this mechanism a J2EE .jar file can reference utility classes or other shared classes or resources packaged in a separate .jar file that is included in the same J2EE application package.


A .jar file can reference another .jar file by naming the referenced .jar file in a Class-Path header in the referencing .jar file´s manifest file. The referenced .jar file is named using a URL relative to the URL of the referencing .jar file."


Example (from J2EE spec):


app1.ear:
META-INF/application.xml
ejb1.jar Class-Path: util.jar
ejb2.jar Class-Path: util.jar
util.jar

About | Sitemap | Contact