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

Manage shared libraries

Shared libraries are files used by multiple applications. Each shared library consists of a symbolic name, a Java class path, and a native path for loading Java Native Interface (JNI) libraries. We can use shared libraries to reduce the number of duplicate library files on the system.

Your applications use the same library files. The applications already are deployed on a server or you currently are deploying the applications.

Suppose that we have four applications that use the same library file, my_sample.jar. Instead of having four copies of my_sample.jar on the system after the four applications are deployed, we can define a shared library for my_sample.jar and have the four deployed applications use that one my_sample.jar library file.

Isolated shared libraries provide another way to reduce the number of library files. Isolated shared libraries each have their own class loader, enabling a single instance of the classes to be shared across the applications. Each application can specify which isolated shared libraries that it wants to reference. Different applications can reference different versions of the isolated shared library, resulting in a set of applications sharing an isolated shared library. With isolated shared libraries, some applications can share a single copy of Library A, v1 while other applications share a single copy of Library A, v2, for a total of two instances in memory.

Using the dmgr console, we can...

  1. Define shared libraries for the library files that multiple applications use
  2. Associate the libraries with specific applications or modules or with an application server

To load classes in a local class loader, associate shared library files with an application or module

To load classes in a separate class loader created for that shared library, associate isolated shared library files with an application or module

To load the classes represented by the shared library in a server-wide class loader, associate shared library file with a server. Server-wide class loaders are the parents of application class loaders. The parent of the server-side class loader is the WAS extensions class loader. Associating a shared library file with a server associates the file with all applications on the server.

If we want a separate class loader for a shared library, do not associate an isolated shared library file with a server. If we associate the shared library with a server, WAS ignores the isolation setting, and adds files in the shared library to the application server class loader.

Instead of using the dmgr console for associations, we can instead use an installed optional package, which declares the dependent library .jar file in the MANIFEST.MF file of the application. Refer to the J2EE 1.4 specification, section 8.2 for an example.


Subtopics


Related concepts:
Class loaders


Related

Configure native libraries in shared libraries


Reference:
Shared library settings


+

Search Tips   |   Advanced Search