Oracle9i Application Server Migrating from Oracle Application Server Release 1 (v1.0.2.2) Part Number A83709-07 |
|
This chapter provides information on migrating EJB, ECO for Java and JCO applications from the Oracle Application Server to Oracle8i JVM EJB objects. Oracle8i JVM is the Oracle9i Application Server component that provides a runtime environment for EnterpriseJava Bean applications. The topics include:
To migrate EJBs from Oracle Application Server 4.0.8 (or later) to Oracle8i JVM, you will need to modify code in the following areas:
The following sections describe these changes.
Oracle8i JVM allows you to put deployment information in a text file that you can run through the ejbdescriptor
command line tool to create the serialized deployment descriptors. The format of this text file resembles Java. The example below shows the basic structure, in which ejb.test.server
is the package that contains the implementation of the bean class ExampleBean
.
SessionBean ejb.test.server.ExampleBeanImpl { <attribute>=<value> ... }
The required attributes are:
Common additional attributes include:
You can also use this format to set Java environment variables for the bean.
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 properties listed in the table below.
You must also change the URL that accesses your EJB home to the Oracle 8i format of:
sess_iiop://<host>:<port>:<SID>/<path>/<bean>
For example:
sess_iiop://myhost:2481:ORCL/test/myBean
If application logging was done in Oracle Application Server, remove all references to oracle.oas.ejb.Logger
from your EJB code. In Oracle8i JVM, you can use the println
function for simple logging, or you can log to the database.
When migrating ECO for Java (ECO/Java) to Oracle8i JVM, you can choose between migrating to EJB, or to CORBA. As the ECO model is very similar to EJB, the easiest migration is to EJB. You will need to change server code as described in the sections below in addition to changes for deployment descriptors and client code described in the sections above for EJB migration.
To modify your ECO for Java components to be compatible with Oracle8i JVM EJBs, you must modify the implementation file, the remote interface file, and the home interface file.
Change the remote interface to extend javax.ejb.EJBObject
instead of oracle.oas.eco.ECOObject
. Each method must throw java.rmi.RemoteException
.
Change the home interface to extend javax.ejb.EJBHome
instead of oracle.oas.eco.ECOHome
.
The create method must throw javax.ejb.CreateException
and java.rmi.RemoteException
instead of oracle.oas.eco.CreateException
.
Make the following changes to the implementation class:
oracle.oas.eco.Logger
.
oracle.oas.eco.* to javax.ejb.*
.
ECOCreate
method to ejbCreate
method.
ECORemove
method to ejbRemove
method.
ECOActivate
method to ejbActivate
method.
ECOPassivate
method to ejbPassivate
method.
Oracle Application Server versions 4.0.6 and 4.0.7 provided a component model called Java CORBA Objects (JCO), a precursor to the ECO for Java (ECO/Java) model. This section discusses migrating from JCO in Oracle Application Server to EJB in Oracle8i JVM.
To migrate to EJB, you must modify the server and client code as discussed in the following sections. 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".
Make the following changes to the remote interface:
org.omg.CORBA.Object
or oracle.oas.jco.JCORemote
to javax.ejb.EJBObject
.
java.rmi.RemoteException
for all methods in the interface.
You will need to create a home interface as defined in the EJB specification. An example is shown below.
import javax.ejb.*; import java.rmi.RemoteException; public interface ServerStackHome extends EJBHome { public ServerStackRemote create() throws CreateException, RemoteException; }
Complete the following to migrate the implementation class:
oracle.oas.jco.*
to import javax.ejb.*
.
javax.ejb.SessionBean
.
ejbCreate()
method.
setSessionContext()
method in an instance variable.
java.rmi.RemoteException
exception.
ObjectManager
type to SessionContext
type. The table below maps the methods in the ObjectManager class to methods in the SessionContext class.
Table 4-2 ObjectManager and SessionContext Methods
If any user defined parameters are being passed in the remote interface, ensure that the classes implement java.io.Serializable
.
|
Copyright © 2001 Oracle Corporation. All Rights Reserved. |
|