Create and use a shared library in WebSphere

Home > Search
  by

A shared library is a file or a collection of files that can be used (shared) by multiple applications. For example, let's say you have an EJB, and the EJB backend is produced via EJBBackend.jar. You could create a shared library so that multiple applications can use the EJBBackend.jar.

 

Create the shared library.

  1. In the left panel of the WebSphere admin console, expand Environment and select Shared libraries.
  2. Select an appropriate scope.
  3. Select New.
  4. Give your shared library a name, and in classpath, enter the path to the file being shared, or the path to the directory that contains the files being shared.
  5. Select OK.
  6. Select Save.

In this example, a shared library named EJB is created, which contains a reference to EJBBackend.jar.

 


Configure a JVM to use the Shared Library

  1. In the left panel of the WebSphere admin console, expand Servers > Server types, and select a JVM.
  2. Select Classloader.
  3. Select New.
  4. Select Classes loaded with parent loader first or Classes loaded with local class loader first and select OK.

Note: "Classes loaded with parent loader first" is the default selection. If the JVM is configured with local class loader, then the shared library will be loaded before the local class loader. 

  1. Select the newly created classloader.
  2. Select Shared library references.
  3. Select Add.
  4. Select your Shared Library.
  5. Select OK.
  6. Select Save.
  7. Restart the JVM for this change to take effect.

In this example, the JVM named was1 is configured to use the EJB shared library.

 


Configure an Application to use the Shared Library

  1. In the left panel of the WebSphere admin console, expand Applications > Enterprise applications.
  2. Checkmark an application and select Reference shared libraries.
  3. From the list of available shared libraries, highlight your shared library, and move the shared library into selected.
  4. Select OK.
  5. Restart the application for this change to take effect.


Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments