Sun Java System Application Server Enterprise Edition 8.1 2005Q2 Developer's Guide

- Previous: Packaging the Client JAR for One Application in Another Application
- Next: Assembling Modules and Applications

## To package the client JAR for one application in another application

1. Deploy the dependent application.

2. Add the dependent application’s client JAR file to the calling application.

   - For a calling EJB component, add the client JAR file at the same level as the EJB component. Then add a `Class-Path` entry to the `MANIFEST.MF` file of the calling EJB component. The `Class-Path` entry has this syntax:

         Class-Path: filepath1.jar filepath2.jar ...

     Each filepath is relative to the directory or JAR file containing the `MANIFEST.MF` file. For details, see the J2EE specification, section 8.1.1.2, “Dependencies.”

   - For a calling web component, add the client JAR file under the `WEB-INF/``lib` directory.

3. If you need to package the client JAR with both the EJB and web components, set `delegate="true"` in the `class-loader` element of the `sun-web.xml` file.

   This changes the Web Classloader so it follows the standard class loader delegation model and delegates to its parent before attempting to load a class itself.

   For most applications, packaging the client JAR file with the calling EJB component is sufficient. You do not need to package the client JAR file with both the EJB and web components unless the web component is directly calling the EJB component in the dependent application.

4. Deploy the calling application.

   The calling EJB or web component must specify in its `sun-ejb-jar.xml` or `sun-web.xml` file the JNDI name of the EJB component in the dependent application. Using an `ejb-link` mapping does not work when the EJB component being called resides in another application.

- Previous: Packaging the Client JAR for One Application in Another Application
- Next: Assembling Modules and Applications

- © 2010, Oracle Corporation and/or its affiliates