WAS v8.5 > Administering applications and their environment > Administering the Liberty profile > Administering the Liberty profile manually > Configure class loaders and libraries for Java EE applications

Accessing third-party APIs from a Java EE application

By default, Java™ EE applications do not have access to the third-party APIs available in the Liberty profile. To enable this access, the application must be configured in server.xml, or an included file. In the following example, an application called Painter needs access to the third-party APIs available in the Liberty profile.

The application also uses a common library called Haarlem. This library is located in the ${server.config.dir}/lib/Haarlem directory.

Avoid trouble: Third party APIs might not remain compatible after an upgrade. For more information, see Liberty profile externals support.

  1. Configure class loading for the application, so the application can access the third-party APIs.

    In server.xml, or an included file, configure the API type visibility by adding the following code:

      <application id="painter" name="Painter" type="ear" location="painter.ear"> <classloader apiTypeVisibility="spec, ibm-api, third-party" commonLibraryRef="Haarlem" /> </application>
  2. Optional: If the application uses any common libraries, set those libraries to use the same API type visibility setting.

    In server.xml, or an included file, add the following code:

      <library id="Haarlem" apiTypeVisibility="spec, ibm-api, third-party"> <fileset dir="${server.config.dir}/lib/Haarlem" includes="*.jar" scanInterval="5s" /> </library>


Parent topic: Configure class loaders and libraries for Java EE applications


Related

Using a Java library with a Java EE application

Sharing a library across multiple Java EE applications

Providing global libraries for all Java EE applications

Removing access to third-party APIs for a Java EE application

Overriding a provided API with an alternative version


|