Creating Shared Java EE Libraries and Optional Packages 9-5
9.2 Creating Shared Java EE Libraries
To create a new shared Java EE library that you can share with multiple applications:
1.
Assemble the shared Java EE library into a valid, deployable Java EE module or Enterprise application. The library must have the required Java EE deployment
descriptors for the Java EE module or for an Enterprise application.
See Section 9.2.1, Assembling Shared Java EE Library Files
.
2.
Assemble optional package classes into a working directory. See
Section 9.2.2, Assembling Optional Package Class Files .
3.
Create and edit the MANIFEST.MF file for the shared Java EE library to specify the name and version string information.
See Section 9.2.3, Editing Manifest Attributes for Shared Java EE Libraries
.
4.
Package the shared Java EE library for distribution and deployment. See
Section 9.2.4, Packaging Shared Java EE Libraries for Distribution and Deployment
.
9.2.1 Assembling Shared Java EE Library Files
The following types of Java EE modules can be deployed as a shared Java EE library:
■
An EJB module, either an exploded directory or packaged in a JAR file.
■
A Web application module, either an exploded directory or packaged in a WAR file.
■
An Enterprise application, either an exploded directory or packaged in an EAR file.
■
A plain Java class or classes packaged in a JAR file.
■
A shared Java EE library referenced from another library. See Section 9.8, Web
Application Shared Java EE Library Information .
Shared Java EE libraries have the following restrictions:
■
You must ensure that context roots in Web application modules of the shared Java EE library do not conflict with context roots in the referencing Enterprise
application. If necessary, you can configure referencing applications to override a librarys context root. See
Section 9.3, Referencing Shared Java EE Libraries in an Enterprise Application
.
■
Shared Java EE libraries cannot be nested. For example, if you are deploying an EAR as a shared Java EE library, the entire EAR must be designated as the library.
You cannot designate individual Java EE modules within the EAR as separate, named libraries.
■
As with any other Java EE module or Enterprise application, a shared Java EE library must be configured for deployment to the target servers or clusters in your
domain. This means that a library requires valid Java EE deployment descriptors as well as WebLogic Server-specific deployment descriptors and an optional
deployment plan. See Deploying Applications to Oracle WebLogic Server.
Oracle recommends packaging shared Java EE libraries as Enterprise applications, rather than as standalone Java EE modules. This is because the URI of a standalone
module is derived from the deployment name, which can change depending on how the module is deployed. By default, WebLogic Server uses the deployment archive
9-6 Developing Applications for Oracle WebLogic Server
filename or exploded archive directory name as the deployment name. If you redeploy a standalone shared Java EE library from a different file or location, the deployment
name and URI also change, and referencing applications that use the wrong URI cannot access the deployed library.
If you choose to deploy a shared Java EE library as a standalone Java EE module, always specify a known deployment name during deployment and use that name as
the URI in referencing applications.
9.2.2 Assembling Optional Package Class Files