Application Client Upgrades from OC4J to WLS
By bob.nettleton on Sep 10, 2009
Upgrading an OC4J Java EE application in order to deploy to Weblogic server may require one of several upgrade paths, depending upon the component being upgraded. Remote clients that rely on the Application Client Container will require deployment changes in order to access resources on Weblogic Server. One use case for remote clients will require some extra steps in order to upgrade successfully. That case is the subject of this blog posting.
OC4J's JNDI implementation allows a standalone client to take advantage of some features of the application client in Java EE without running in a Java EE Application Client Container. A client can use the
InitialContextFactory implementation in order to access this functionality. As long as the client includes a "META-INF/application-client.xml" deployment descriptor in the client jar, this initial context factory will create a JNDI context that can support Java EE resources that are typically used in an application client (EJB references, Resource References, Environment entries, etc). This context factory will use the application-client.xml and the proprietary orion-application-client.xml in order to map JNDI bindings to logical Java EE reference names. This level of application client support does not include Java EE 1.5-style annotations/dependency injection.
Please refer to the following for more information on OC4J's Application Client support:
While not required by the Java EE specification, this type of remote client can be very useful when a customer wishes to use the Java EE standard resource mapping types in order to use logical names for resources such as EJBs, Datasources, and JMS destinations. Using an application client deployment descriptor has the advantage of allowing resources to change without having to change the client code itself, and can be considered useful even if not running in the Application Client Container.
Customers using this feature of the ApplicationClientInitialContextFactory in OC4J will need to port their application client to run in the Weblogic Server Application Client Container.
The steps required to upgrade an OC4J application client to run in the Weblogic Application Client Container are as follows:
- Add a "Main-Class" entry to the client jar's manifest. This entry should specify the entry point class for the application client. This class, according to the Java EE standard, must include a "public static void main(String args)" method, and also include a no-arguments constructor.
An example of the proper manifest entry would look as follows:
Ant-Version: Apache Ant 1.6.5
Created-By: 1.5.0_06-b05 (Sun Microsystems Inc.)
- Modify the jndi.properties file in this client (or the source code that sets the JNDI properties directly) to refer to the Oracle WebLogic Server JNDI Provider.
An example of the jndi.properties file would look as follows:
The jndi.properties file may also require a username/password. These JNDI properties should be modified to use the principal and credentials created on the Weblogic Server.
- For every element in orion-application-client.xml, create a corresponding element in weblogic-application-client.xml to map any Java EE references to the resources bound in Oracle WebLogic Server.
- Modify the classpath of the client to include the Oracle WebLogic Server client jars. The jars required for the classpath are determined by the protocol that the customer wishes to use for this client.
Please refer to the following Weblogic Server documentation to determine the appropriate client jar to use:
- Modify any application client startup scripts to use the Oracle WebLogic Server application client launcher.
The following is an example of a typical command line for launching a Weblogic Application Client:
java weblogic.demo.DemoClient myclient.jar t3://localhost:7001
The following links will be helpful when attempting to upgrade an application client from OC4J to Weblogic Server:
"WLS - Programming Standalone Clients"
"Oracle Fusion Middleware Upgrade"