Web Application Shared Java EE Library Information Using WebApp Libraries With Web Applications

Creating Shared Java EE Libraries and Optional Packages 9-15

9.8 Web Application Shared Java EE Library Information

In general, this topic discusses shared Java EE libraries that can be referenced only by Enterprise applications. You can also create libraries that can be referenced only by another Web application. The functionality is very similar to application libraries, although the method of referencing them is slightly different. In particular: ■ Web application libraries can only be referenced by other Web applications. ■ Rather than update the weblogic-application.xml file, Web applications reference Web application libraries by updating the weblogic.xml deployment descriptor file. The elements are almost same as those described in Section 9.3, Referencing Shared Java EE Libraries in an Enterprise Application ; the only difference is that the context-root child element of library-ref is ignored in this case. ■ You cannot reference any other type of shared Java EE library EJB, Enterprise application, or plain JAR file from the weblogic.xml deployment descriptor file of a Web application. Other than these differences in how they are referenced, the way to create, package, and deploy a Web application library is the same as that of a standard shared Java EE library.

9.9 Using WebApp Libraries With Web Applications

Just as standard shared Java EE applications can be deployed to WebLogic Server as application-libraries, a standard Web application can be deployed to WebLogic Server as a webapp-library so that other Web applications can refer to these libraries. Web application libraries facilitate the reuse of code and resources. Such libraries also help you separate out third-party Web applications or frameworks that your Web application might be using. Furthermore, common resources can be packaged separately as libraries and referenced in different Web applications, so that you dont have to bundle them with each Web application. When you include a webapp-library in your Web application, at deployment time the container merges all the static resources, classes, and JAR files into your Web application. The first step in using a WebApp library is to register a Web application as a webapp-library. This can be accomplished by deploying a Web application using either the Administration Console or the weblogic.Deployer tool as a library. To make other Web applications refer to this library, their weblogic.xml file must have a library-ref element pointing to the webapp-library, as follows: library-ref library-nameBaseWebApplibrary-name specification-version2.0specification-version implementation-version8.1betaimplementation-version exact-matchfalseexact-match library-ref Note: For simplicity, this section uses the term Web application library when referring to a shared Java EE library that is referenced only by another Web application. 9-16 Developing Applications for Oracle WebLogic Server When multiple libraries are present, the CLASSPATHresource path precedence order follows the order in which the library-refs elements appear in the weblogic.xml file.

9.10 Accessing Registered Shared Java EE Library Information with LibraryRuntimeMBean