Tong Wang
Tong Wang

Reputation: 1612

How to package 3rd party JARs into an EJB jar?

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?

Upvotes: 12

Views: 13202

Answers (1)

Robin
Robin

Reputation: 24282

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

Upvotes: 18

Related Questions