Shared libraries
Shared libraries are files used by multiple applications. We can use shared libraries and global libraries to reduce the number of duplicate library files on the system.
Library elements
Liberty profile libraries have three elements; <folder>, <file>, and <fileset>. For example:
<library> <folder dir="..." /> <file name="..." /> <fileset dir="..." includes="*.jar" scanInterval="5s" /> </library>A specified file must be a container for the resource (for example a JAR file) rather than the resource itself.
If an element in the list is a file, the contents of that JAR or compressed .zip file are searched. If a folder is specified then resources are loaded from that directory.
Global libraries
Global libraries can be used by any application. JAR files are placed in a global library directory, and then are specified in the class loader configuration for each application.
We can place global libraries in two locations:
- ${shared.config.dir}/lib/global
- ${server.config.dir}/lib/global
If there are files present in these locations at the time an application is started, and that application does not have a <classloader> element configured, the application uses these libraries. If a class loader configuration is present, these libraries are not used unless the global library is explicitly referenced.
See Provide global libraries for all Java EE applications.
Parent topic: WebSphere Application Server Liberty Core: OverviewTasks:
Share a library across multiple Java EE applications Provide global libraries for all Java EE applications