4 Replies Latest reply on Jan 8, 2003 3:25 PM by kenhammond

    EAR, WAR and JAR confusion!

    openmind

      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!

        • 1. Re: EAR, WAR and JAR confusion!
          minamoto

          In the J2EE 1.3 spec, section 8.1.1.2 explains how to deal with this.
          In short we can specify dependencies in manifest files of J2EE modules included an EAR file.

          With Ant 1.5, the jar task has a manifest subtask and it my help add the CLASS-Path attribute to a manifest file:







          But I don't know whether we could use the manifect subtask in a war task.

          If only the EAR format has a lib directory like WAR. ;-)

          Miki

          • 2. Re: EAR, WAR and JAR confusion!
            minamoto

            >But I don't know whether we could use the manifect subtask in a war task.
            It's worked.
            So we don't have to make manifest files manually for packaging jar files.

            Miki

            • 3. Re: EAR, WAR and JAR confusion!
              openmind

              Thanks for the reply, it works for me too now.

              • 4. Re: EAR, WAR and JAR confusion!
                kenhammond

                I am trying to do something similar. I have several jar files - call them B, C, and D, each of which is dependent upon a common jar file, A. I want to be able to deploy B, C, and D without copying A into each one. All of these jar files are deployed to the jboss server\default\deploy directory.

                I've implemented the manifest approch mentioned in this thread, and jboss does indeed deploy A when B is deployed. However, it then attempts to deploy A independently, and gets error messages because A has already been deployed.

                What is the proper way to build and deploy these jar files without getting these duplicate deployment errors?