WAS v8.5 > Set up the application serving environment > Administer application servers > Manage shared libraries

Use installed optional packages

We can associate one or more shared libraries with an application using an installed optional package that declares the shared libraries in the application's manifest file. Classes represented by the shared libraries are then loaded in the application's class loader, making the classes available to the application.

Read about installed optional packages in Installed optional packages and in section 8.2 of the J2EE specification, v1.4 at http://java.sun.com/j2ee/j2ee-1_4-fr-spec.pdf.

WebSphere Application Server does not support the Java 2 Platform Standard Edition (J2SE) Installed Optional Package semantics used in the J2SE specification (http://java.sun.com/j2se/1.3/docs/guide/extensions/spec.html), which primarily serve the applet environment. WAS ignores applet-specific tags within manifest files. Installed optional packages expand the existing shared library capabilities of an application server. Prior to v6.0, an administrator was required to associate a shared library to an application or server. Installed optional packages enable an administrator to declare a dependency in an application's manifest file to a shared library, with installed optional package elements listed in the manifest file, and automatically associate the application to the shared library. During application installation, the shared library .jar file is added to the class path of the application class loader.

If we use an installed optional package to associate a shared library with an application, do not associate the same shared library with an application class loader or a server class loader using the dmgr console.

  1. Assemble the library file, including the manifest information that identifies it as an extension.

    Two sample manifest files follow. The first sample manifest file has application app1.ear refer to a single shared library file util.jar:

    app1.ear:
        META-INF/application.xml
        ejb1.jar:
             META-INF/MANIFEST.MF:
                 Extension-List: util
                 util-Extension-Name: com/example/util
                 util-Specification-Version: 1.4
             META-INF/ejb-jar.xml
    
    util.jar:
        META-INF/MANIFEST.MF:
            Extension-Name: com/example/util
            Specification-Title: example.com's util package
            Specification-Version: 1.4
            Specification-Vendor: example.com
            Implementation-Version: build96

    The second sample manifest file has application app1.ear refer to multiple shared library .jar files:

    app1.ear:
        META-INF/application.xml
        ejb1.jar:
             META-INF/MANIFEST.MF:
                 Extension-List: util1 util2 util3
                 Util1-Extension-Name: com/example/util1
                 Util1-Specification-Version: 1.4
                 Util2-Extension-Name: com/example/util2
                 Util2-Specification-Version: 1.4
                 Util3-Extension-Name: com/example/util3
                 Util3-Specification-Version: 1.4
             META-INF/ejb-jar.xml
    
    util1.jar:
        META-INF/MANIFEST.MF:
            Extension-Name: com/example/util1
            Specification-Title: example.com's util package
            Specification-Version: 1.4
            Specification-Vendor: example.com
            Implementation-Version: build96
    
    util2.jar:
        META-INF/MANIFEST.MF:
            Extension-Name: com/example/util2
            Specification-Title: example.com's util package
            Specification-Version: 1.4
            Specification-Vendor: example.com
            Implementation-Version: build96
    
    util3.jar:
        META-INF/MANIFEST.MF:
            Extension-Name: com/example/util3
            Specification-Title: example.com's util package
            Specification-Version: 1.4
            Specification-Vendor: example.com
            Implementation-Version: build96

  2. Create a shared library that represents the library file assembled in step 1. This installs the library file as a shared library.
  3. Assemble the application, declaring in the application manifest file dependencies to the library files named the manifest created for step 1.
  4. Install the application on the server.


Results

During application installation, the shared library .jar files are added to the class path of the application class loader.


Related concepts:

Class loaders


Related


Associate shared libraries with applications or modules
Associate shared libraries with servers
Create shared libraries
Assemble applications
Install enterprise application files
Manage shared libraries


Related information:

J2EE specification, v1.4
J2SE Installed Optional Package


+

Search Tips   |   Advanced Search