« Message Driven Bean Migration from OC4J to WebLogic | Main | Migrating OC4J 10.1.3 Stateful Web Services to WebLogic »

Application Client Upgrades from OC4J to WLS

Summary

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

 

"oracle.j2ee.naming.ApplicationClientInitialContextFactory"

 

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:

 

Looking Up Objects from J2EE Application Clients

 

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. 

 

Upgrade Steps

The steps required to upgrade an OC4J application client to run in the Weblogic Application Client Container are as follows:

 

  1. 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:

            Manifest-Version: 1.0

     Ant-Version: Apache Ant 1.6.5

     Created-By: 1.5.0_06-b05 (Sun Microsystems Inc.)

     Main-Class: oracle.ejb30.HelloWorldClient

 

      

 

  1. 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:

 

            java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory

java.naming.provider.url=t3://localhost:7001

 

    

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. 

           

 

  1. 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.

 

  1. 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:

 

Client Types and Features

 

 

  1. 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"

Programming Stand-alone Clients

 

"Oracle Fusion Middleware Upgrade"

Oracle Fusion Middleware Upgrade

 

TrackBack

TrackBack URL for this entry:
http://blogs.oracle.com/mt/mt-tb.cgi/13927

Post a comment

About This Entry

This page contains a single entry from the blog posted on September 10, 2009 12:43 PM.

The previous post in this blog was Message Driven Bean Migration from OC4J to WebLogic.

The next post in this blog is Migrating OC4J 10.1.3 Stateful Web Services to WebLogic.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type and Oracle