Question

I have an old J2EE application (J2EE 1.3), which packages into an EAR, and in the EAR, there are WARs and EJB JARs. Now one of the EJB JARs needs to refer to some 3rd party library JARs, so what's the best place to package those JARs and how?

Was it helpful?

Solution

They go in the ear file, at the root or you can create a lib directory to store them. Any project (EJB or WAR) that needs to reference them must include them in the Class-Path: of the manifest file.

Ear contents

  - log4j.jar
  - lib
     - commons-lang.jar
  - MyEJBProj.jar
  - MyWAR.war

MyEJBProj contents

 - classes
 - META-INF
    - MANIFEST.MF

MANIFEST.MF

    Manifest-Version: 1.0
    Class-Path: log4j.jar lib/commons-lang.jar
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top