Extending WebSphere Portal class path

Custom code must either be added by a PAA or as APP through the administrative console. Adding custom code in shared application or wp_profile/classes is critical because it can be overwritten, deleted by updates or migration.

About this task

There are several options to add the general code that is not part of an EAR or WAR files.

Procedure

  1. Add the custom code to a shared library.
    1. Use the administrative console to define a shared library, by creating and associating the shared library with an application, module, or server. For more information, see Managing shared libraries.

      Documentation resource: Managing shared libraries.

    2. Add the shared library to the custom applications or to the entire WebSphere® Portal Server.
      • Adding the shared library to the custom application.

        You can associate a shared library with an application or module. Classes that are represented by the shared library are then loaded in the application's class loader, making the classes available to the application. For more information, see Associating shared libraries with applications or modules

        Documentation Resource: Adding the shared library to the custom application

      • Adding the shared library to the entire WebSphere Portal.

        You can associate shared libraries with the class loader of a server. Classes that are represented by the shared library are then loaded in a server-wide class loader, making the classes available to all applications deployed on the server. For more information, see Associating shared libraries with servers.

        Documentation Resource: Add the shared library to the entire WebSphere Portal

  2. If you do not want to create a shared library, then you can drop the code into the profile/classes directory /opt/IBM/WebSphere/wp_profile/classes/MyCustom.jar. The code is then available to all applications in the server.
  3. If you are developing a PAA, include the compressed files in the PAA components/COMPONENTNAME/shared/app or components/COMPONENTNAME/shared/ext directories. The solution installer handles creating the shared libraries for these files.