Skip Headers

Oracle9i Application Server Migrating from Oracle Application Server
Release 2 (9.0.2)

Part Number A95108-01
Go To Documentation Library
Home
Go To Table Of Contents
Contents
Go To Index
Index

Go to previous page Go to next page

4
Migrating EJB, ECO/Java and JCORBA Applications

This chapter provides information on migrating EJB, ECO for Java and JCO applications from the Oracle Application Server to OC4J in Oracle9iAS. The topics include:

Migrating EJBs to OC4J

To migrate EJBs from Oracle Application Server 4.x to OC4J, you must modify code in the following areas:

The following sections describe these changes.

Deployment Descriptors

OC4J conforms to XML file configuration that complies to J2EE 1.2 specifications.

See Also:

Oracle9iAS Containers for J2EE Enterprise JavaBeans Developer's Guide and Reference in the Oracle9iAS documentation library

Client Code

Changes to the client code are made in the initial context call using JNDI. The hashtable passed to the initial context call must contain all of the following properties:

You must also change the URL that accesses your EJB home to the OC4J:

ORMI://<host>:<port>/<path>/<bean>

For example:

ORMI://myhost:2481/test/myBean
ORMI://host/port/est/bean

Logging (Server Code)

If application logging was done in Oracle Application Server, remove all references to oracle.oas.ejb.Logger from your EJB code.

Migrating ECO/Java to OC4J

When migrating ECO for Java (ECO/Java) in Oracle Application Server to OC4J in Oracle9iAS, you must change server code described in this section, as well as to change deployment descriptors and client code described in the previous section for EJB migration.

To make your ECO/Java components compatible with OC4J, you must modify the implementation file, the remote interface file, the home interface file, and deployment descriptors.

Remote Interface

Change the remote interface to extend javax.ejb.EJBObject instead of oracle.oas.eco.ECOObject. Each method must throw java.rmi.RemoteException.

Home Interface

Change the home interface to extend javax.ejb.EJBHome instead of oracle.oas.eco.ECOHome.

The created method must throw javax.ejb.CreateException and java.rmi.RemoteException instead of oracle.oas.eco.CreateException.

Implementation Class

Make the following changes to the implementation class:

  1. Remove all occurrences of, and references to, oracle.oas.eco.Logger.

  2. Change all occurrences of oracle.oas.eco.* to javax.ejb.*.

  3. Change ECOCreate method to ejbCreate method.

  4. Change ECORemove method to ejbRemove method.

  5. Change ECOActivate method to ejbActivate method.

  6. Change ECOPassivate method to ejbPassivate method.

  7. OC4J uses XML files for deployment, you have to create appropriate deployment files.

Migrating JCORBA to OC4J

Oracle Application Server versions 4.0.6 and 4.0.7 provided a component model, Java CORBA Objects (JCO), which is a precursor to the ECO/Java model. Oracle9iAS does not support CORBA objects. You must recode your CORBA objects as EJBs. This section discusses migration from JCO in Oracle Application Server to OC4J in Oracle9iAS.

To migrate to OC4J, you must modify the server and client code as discussed in this section. To modify the server code, you must modify the remote interface, create a home interface, modify the JCORBA object implementation, and make parameters serializable. You must also modify the deployment descriptors as discussed in "Deployment Descriptors".

Remote Interface

Make the following changes to the remote interface:

  1. Convert all occurrences of org.omg.CORBA.Object or oracle.oas.jco.JCORemote to javax.ejb.EJBObject.

  2. Throw java.rmi.RemoteException for all methods in the interface.

Home Interface

You must to create a home interface, as defined in the EJB specification. The following is an example.

import javax.ejb.*;
import java.rmi.RemoteException;
public interface ServerStackHome extends EJBHome
{
  public ServerStackRemote create() throws CreateException, RemoteException;
}

Object Implementation

Complete the following steps to migrate the implementation class:

  1. Change import oracle.oas.jco.* to import javax.ejb.*.

  2. Check that the class implements javax.ejb.SessionBean, or javax.ejb.EntityBean.


    Note:

    The JCORBA Lifecycle is not supported within OC4J. If the JCORBA object implements oracle.oas.jco.Lifecycle, you must remove it.


  3. Remove any logger references.

  4. Move any initialization operations to the ejbCreate() method.

  5. Save the session context passed into the setSessionContext() method in an instance variable.

  6. Ensure that all public methods in the class throw java.rmi.RemoteException.

  7. Change any ObjectManager type to SessionContext type. Table 4-1 maps the methods in the ObjectManager class to methods in the SessionContext class.

    Table 4-1 ObjectManager and SessionContext Methods
    SessionContext Method ObjectManager Method

    getEnvironment()

    getEnvironment()

    Parameter passed to setSessionContext()

    getObjectManager()

    getEJBObject()

    getSelf()

    getEJBObject().remove()

    revokeSelf()

    getUserTransaction()

    getCurrentTransaction()

Make Parameters Serializable

If any user-defined parameters are being passed in the remote interface, ensure that the classes implement java.io.Serializable.


Go to previous page Go to next page
Oracle
Copyright © 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Table Of Contents
Contents
Go To Index
Index