Upgrading Instance and Group-Level OC4J Data Sources

Upgrading Your Java EE Environment 5-9

5.3.4 Using Shared Libraries and Class Loading on Oracle WebLogic Server

When upgrading to Oracle WebLogic Server, you can construct an Oracle WebLogic Server target environment that uses a class-loading configuration similar to the one used in the OC4J source environment. However, due to the differences between the OC4J and Oracle WebLogic Server class loading models, it is important to develop a good understanding of Oracle WebLogic Server application class loading prior to setting up the target Oracle WebLogic Server configuration. Table 5–1 summarizes the options available in Oracle WebLogic Server for application developers who used the class loading configurations available in the OC4J environment. The table provides a high level mapping of the main OC4J approaches to making a class available to an application to the most comparable way of achieving the same outcome within a WebLogic Server environment. For more information, see Creating Shared Java EE Libraries and Optional Packages in Oracle Fusion Middleware Developing Applications for Oracle WebLogic Server. Table 5–1 Comparison of OC4J and Oracle WebLogic Server Class-Loading Models OC4J Approach Comparable Oracle WebLogic Server Approach Class is made available to the application’s class loader through Oracle-specific library element of the deployment descriptor. Add the class or JAR file to the applications APP-INFclasses or APP-INFlib directories, respectively. For Web applications, add the class or JAR files to the applications WEB-INFclasses or WEB-INF directories respectively. Class is exposed to specific applications as an OC4J shared library. Deploy the JAR file to the Oracle WebLogic Server instance or cluster as a WebLogic Server shared library. Note that there are some important differences in the concept of shared libraries between OC4J and WebLogic: ■ First, WebLogic Server shared libraries must be referenced from the applications using them; there is no way of forcing all deployed applications to use a shared library. See the information below for information on how to achieve this in an Oracle WebLogic Server domain. ■ Second, this referencing essentially exports the content of the shared library to the applications class loaders classpath, as opposed to making it available within a dedicated class loader--as a child of the system class loader--as is the case in OC4J. ■ Finally, WebLogic Server shared libraries can be an EAR, WAR, or JAR file and the scope of their inclusion within the application is controlled by the scope of the deployment descriptor weblogic-application.xml or weblogic.xml that references the archive. Class is exposed to all applications on all OC4J instances by either referencing the class in the default applications application.xml within the Oracle home or by dropping of the JAR file into the ORACLE_HOMEapplib directory. Place the JAR file in the domain directorys lib sub-directory. This will ensure that the JAR files class is available within a separate system level classloader to all applications running on WebLogic Server instances in the domain. Class is added to the classpath of the OC4J instance and made available to the entire server instance through the system class loader. Configure the Oracle WebLogic Server instance so either the POST_ CLASSPATH or PRE_CLASSPATH environment variables are set prior to server start-up.