WebLogic Server enables you to target individual modules of an enterprise application to different server targets, or to deploy only a subset of available modules in an enterprise application. This provides flexible packaging options, allowing you to bundle a group of related modules together in an enterprise application, but deploy only selected modules to individual servers in a domain.
An enterprise application is packaged as an archive file with an .ear extension, but is generally deployed as an exploded EAR directory. An exploded EAR directory contains all of the JAR, WAR, and RAR modules (also in exploded format) for an application as well as the XML descriptor files for the enterprise application and its bundled applications and modules. See Developing Applications for Oracle WebLogic Server.
Enterprise JavaBeans (EJBs) are reusable Java components that implement business logic and enable you to develop component-based distributed business applications. EJB modules are packaged as archive files having a .jar extension, but are generally deployed as exploded archive directories. The archive file or exploded archive directory for an EJB contains the compiled EJB classes, optional generated classes, and XML deployment descriptors for the EJB. See Developing Enterprise JavaBeans, Version 2.1, for Oracle WebLogic Server for more information on the different types of EJBs.
A Web service is a set of functions packaged into a single entity that is available to other systems on a network, and can be shared by and used as a component of distributed Web-based applications. Web services commonly interface with existing back-end applications, such as customer relationship management systems, order-processing systems, and so on.
A Web service module may include either Java classes or EJBs that implement the Web service. Web services are packaged either as Web application archives (WARs) or EJB modules (JARs) depending on the implementation; typically the WAR or EJB JAR file is then packaged in an enterprise application. See Developing JAX-WS Web Services for Oracle WebLogic Server.
A Java EE library is a standalone Java EE module, or multiple Java EE modules packaged in an enterprise application (EAR), that is registered with the Java EE application container as a shared library at deployment time. After a Java EE library has been registered, you can deploy enterprise applications that reference the library in their weblogic-application.xml deployment descriptors. Each referencing application receives a copy of the shared Java EE library module(s) on deployment, and can use those modules as if they were packaged as part of the application itself. Java EE library support provides an easy way to share one or more Java EE modules among multiple enterprise applications without physically adding the shared modules to each dependent application.
Optional packages provide similar functionality to Java EE libraries, allowing you to easily share a single JAR file among multiple applications. However, optional packages function as individual Java EE modules (standalone or within an enterprise application), rather than as an enterprise application. For example, third-party Web Application Framework classes needed by multiple Web applications can be packaged and deployed in a single JAR file, and referenced by multiple Web application modules in the domain.
Optional packages are delivered as basic JAR files that have no deployment descriptors. You simply designate the JAR as an optional package at deployment time, and WebLogic Server registers the file with the target servers you select. After the optional package has been registered, you can then deploy Java EE modules and applications that reference the optional package in their MANIFEST.MF files. Creating Shared Java EE Libraries and Optional Packages in Developing Applications for Oracle WebLogic Server describes how to assemble and configure optional packages, and how to configure Java EE modules that utilize optional packages.
In contrast to system modules, application modules are owned by the developer who created and packaged the module, rather than the administrator who deploys the module. This means that the administrator has more limited control over JDBC, JMS, and WLDF application modules. When deploying an application module, an administrator can change resource properties that were specified in the module, but cannot add or delete resources.
Oracle recommends that you package a shared Java EE library into its appropriate archive file (EAR, JAR, or WAR). However, for development purposes, you may choose to deploy shared Java EE libraries as exploded archive directories to facilitate repeated updates and redeployments.
After the shared Java EE library has been registered, you can deploy enterprise applications that reference the library. Each referencing application receives a reference to the required library on deployment, and can use the modules that make up the library as if they were packaged as part of the referencing application itself. The library classes are added to the classpath of the referencing application, and the referencing application's deployment descriptors are merged (in memory) with those of the modules that make up the shared Java EE library.
WebLogic Server supports optional packages as described at with versioning described in Optional Package Versioning (see ). Optional packages provide similar functionality to Java EE libraries, allowing you to easily share a single JAR file among multiple applications. As with Java EE libraries, optional packages must first be registered with WebLogic Server by deploying the associated JAR file as an optional package. After registering the package, you can deploy Java EE modules that reference the package in their manifest files.
Optional packages are also supported as Java EE shared libraries in weblogic.BuildXMLGen, whereby all manifests of an application and its modules are scanned to look for optional package references. If optional package references are found they are added to the wlcompile and appc tasks in the generated build.xml file.
Optional packages differ from Java EE libraries because optional packages can be referenced from any Java EE module (EAR, JAR, WAR, or RAR archive) or exploded archive directory. Java EE libraries can be referenced only from a valid enterprise application.
For example, third-party Web application Framework classes needed by multiple Web applications can be packaged and deployed in a single JAR file, and referenced by multiple Web application modules in the domain. Optional packages, rather than Java EE libraries, are used in this case, because the individual Web application modules must reference the shared JAR file. (With Java EE libraries, only a complete enterprise application can reference the library).
The Java EE platform provides several mechanisms for applications to use optional packages and shared libraries. Libraries can be bundled with an application or may be installed separately for use by any application. An EAR file may contain a directory that contains libraries packaged in JAR files. The library-directory element of the EAR file's deployment descriptor contains the name of this directory. If a library-directory element isn't specified, or if the EAR file does not contain a deployment descriptor, the directory named lib is used. An empty library-directory element may be used to specify that there is no library directory. All files in this directory (but not in subdirectories) with a .jar extension must be made available to all components packaged in the EAR file, including application clients. These libraries may reference other libraries, either bundled with the application or installed separately.
Versioning information in the referencing application determines the library and package version requirements for that application. Different applications can require different versions of a given library or package. For example, a production application may require a specific version of a library, because only that library has been fully approved for production use. An internal application may be configured to always use a minimum version of the same library. Applications that require no specific version can be configured to use the latest version of the library. Referencing Shared Java EE Libraries in an Enterprise Application.
Optional packages are plain JAR files, whereas shared Java EE libraries can be plain JAR files, Java EE enterprise applications, or standalone Java EE modules (EJB and Web applications). This means that libraries can have valid Java EE and WebLogic Server deployment descriptors. Any deployment descriptors in an optional package JAR file are ignored.
Any Java EE application or module can reference an optional package (using META-INF/MANIFEST.MF), whereas only enterprise applications and Web applications can reference a shared Java EE library (using weblogic-application.xml or weblogic.xml).
In general, use shared Java EE libraries when you need to share one or more EJB, Web application or enterprise application modules among different enterprise applications. Use optional packages when you need to share one or more classes (packaged in a JAR file) among different Java EE modules.
For information about deploying and managing shared Java EE libraries, optional packages, and referencing applications from the administrator's perspective, see "Deploying Shared Java EE Libraries and Dependent Applications" in 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 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. 041b061a72