1 Reply Latest reply on Jan 14, 2003 12:34 PM by JMC

    War and ejb-jar depend on same jar

    Russell Black Newbie

      Both my ejb-jar file and my war file depend on the same jar. The ejb-jar file is able to find the classes in the jar, but not the war. I'm putting the jar inside the ear, and referencing it from the WAR's manifest.mf with a Class-Path: line, like this:

      Contents of ear:
      icp-ejb.jar
      icp.war
      common-library.jar

      Contents of icp.war's META-INF/manifest-mf contains:
      Class-Path: common-library.jar

      But the classes in the war can't find the classes in common-library.jar.

      Do I have to include two copies of common-library.jar? One in the ear, and one in the war's WEB-INF/lib folder?

        • 1. Re: War and ejb-jar depend on same jar
          JMC Newbie

          > Both my ejb-jar file and my war file depend on the
          > same jar. The ejb-jar file is able to find the
          > classes in the jar, but not the war. I'm putting the
          > jar inside the ear, and referencing it from the WAR's
          > manifest.mf with a Class-Path: line, like this:
          >
          > Contents of ear:
          > icp-ejb.jar
          > icp.war
          > common-library.jar
          >
          > Contents of icp.war's META-INF/manifest-mf contains:
          > Class-Path: common-library.jar
          >
          > But the classes in the war can't find the classes in
          > common-library.jar.
          >
          > Do I have to include two copies of
          > common-library.jar? One in the ear, and one in the
          > war's WEB-INF/lib folder?


          As far as I know, the common or thirdparty libraries that you wish to be accessible by your webapp (i.e., WAR file) must be placed inside your webapp's WEB-INF/lib directory. In the example you give below, then, you would want it to look something like this
          EAR_file/
          WAR_file/
          WEB-INF/
          lib/
          common-library.jar
          ...
          EJB_jar/
          ...
          common-library.jar

          Again, this is my understanding. Please correct this is erroneous.

          jMC