Create shared libraries
Shared libraries are files used by multiple applications. Create a shared library to reduce the number of duplicate library files on the system.
Determine the full path name or directory of each library file for which we want a shared library.
To make a library file available to multiple applications deployed on a server, create one or more shared libraries for library files that the applications need. When creating the shared libraries, we can use variables within the library file class paths.
Create one shared library that points to multiple files or directories. This enables us to maintain a single shared library for files that the applications need.
Or we can create a shared library for each library file that the applications need. This approach is recommended only when we have few library files and few applications that use the files. After creating a shared library, you associate it with each application that uses the library files. If we have multiple shared libraries and multiple applications that use the library files, we must complete many steps to create and associate those shared libraries. It is simpler to use one shared library for related files.
Use the Shared libraries page to create and configure shared libraries.
Tasks
- Go to the Shared libraries page.
Click Environment > Shared libraries in the console navigation tree.
- Select a shared library scope.
Change the scope of the collection table to see what shared libraries are in a particular cell, node or server.
- Select a cell, node, or server.
On a multiple-server product, you also can select a cluster. To see the cluster scope, you first must create a cluster on the Server clusters page (Servers > Clusters > WebSphere application server clusters).
- Click Apply.
After creating a shared library, we can see whether a shared library can be used on a specific node. Select a scope to see what shared libraries are available to applications installed on or mapped to that scope.
- Click New.
- Configure the shared library.
- On the shared library settings page, specify the name, class path, and any other variables for the library file needed.
If the shared library specifies a native library path, refer to Configure native libraries in shared libraries.
To have only one instance of a version of a class shared among applications or modules, make the shared library an isolated shared library. Select Use an isolated class loader for this shared library. Using an isolated shared library can reduce the memory footprint when a large number of applications share the library.
- Click Apply.
What to do next
Use the administrative console, associate your shared libraries with specific applications or modules or with the class loader of an application server. Associating a shared library file with a server class loader associates the file with all applications on the server.
If we enabled the Use an isolated class loader for this shared library setting when creating your shared library, associate the shared library with applications or web modules. By default, shared libraries configured to use an isolated class loader cannot be associated with server-level class loaders. To override this behavior for a specific shared library, add -Dcom.ibm.ws.classloader.useNonIsolatedSharedLibrariesForServer=true as a generic JVM argument to the server JVM settings, or unselect the Use an isolated class loader for this shared library setting for that library. If the override property is set, libraries associated with the server class loader do not use an isolated class loader.
Alternatively, we can use an installed optional package to associate your shared libraries with an application.
Subtopics
- Configure native libraries in shared libraries
Native libraries are platform-specific library files, including .dll, .so, or *SRVPGM objects, that can be configured within shared libraries. Native libraries are visible to an application class loader whenever the shared library is associated with an application. Similarly, native libraries are visible to an application server class loader whenever the shared library is associated with an application server.
Related:
Installed optional packages Associating shared libraries with applications or modules Associating shared libraries with servers Manage shared libraries Use installed optional packages Shared library collection