Child pages
  • Using shared libraries in your applications
Skip to end of metadata
Go to start of metadata

The server provides a common directory where you can install class files and JAR files that can be shared by multiple Java EE assets. Although the shared library may not be suitable for production environments, it may be a convenient place to keep classes or libraries while you are developing your Java EE asset.

  • Within the shared library, JAR file names must be unique. To prevent collisions with other products that may use the same JAR name, avoid the shared library and place the JAR file in the server repository instead.
  • The shared library can only hold one version of a class file. If your server holds several applications that depend on different versions of a particular class file, avoid the shared library and bundle the class files into a JAR file in the server repository instead.
  • Likewise, the shared library can only hold one version of a JAR file. If several applications depend on different versions of a JAR file, avoid the shared library and place the JAR file in the server repository instead.

Configuring shared libraries

You can use a reference class to the gbean org.apache.geronimo.system.sharedlib.SharedLib so that you can use shared libraries in your applications. By default, you may put all your libraries and classes files under <Geronimo_HOME>/var/shared directory, then add a dependency to deployment plan of your application as followed.

You can also specify another directory rather than the default <Geronimo_HOME>/var/shared directory for libraries sharing. Use the following code snippet in your deployment plan when referring to a relative path:

using relative paths

or the following code snippet when referring to an absolute path:

using absolute paths
  • No labels