Overriding a provided API with an alternative version

If an application provides (or uses a library that provides) classes that are also available in the Liberty profile, by default the classes from the Liberty profile are used. To change this so that the application uses the alternative versions of these classes, the application must be configured in the server.xml file, or an included file.

About this task

If a web application includes classes that are also present in the server runtime environment, you might want to control which copy of each of those classes is used by the application. For example, if different versions of the classes are present in both the application and the server runtime environment, you must ensure that the version packaged in the application is used.

By default, classes from the Liberty profile runtime environment are used by all Java™ EE applications. You can override this behavior by using the class loader configuration delegation attribute. This configuration is specific to a particular application, or to a shared library that can be selected for use by an application.

Example

In the following example, an application called Scholar needs to use classes that it provides (or that are provided in a library that it uses), rather than using the copies of the classes that are available in the Liberty profile.

You can also use the privateLibraryRef attribute for private libraries in an application. See Sharing a library across multiple Java EE applications.


Icon that indicates the type of topic Task topic

Terms and conditions for information centers | Feedback


Timestamp icon Last updated: Wednesday, 22 May 2013
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=phil&product=was-nd-mp&topic=twlp_classloader_alt_api
File name: twlp_classloader_alt_api.html