This section describes the modifications required to migrate the J2EE application "New World Cruise" to a JOnAS server.
"New World Cruise" is a sample application that comes with Sun ONE Application Server. (See http://developers.sun.com/sw/building/tech_articles/jaxrpc/synopsis.html.)
The first step is to configure the database used for this application. Copy the file db.properties to the directory $JONAS_BASE/conf. Edit this file to complete the database connection.
Then, modify the JOnAS DBM database service configurations in the file $JONAS_BASE/conf/jonas.properties, to specify the file containing the database connection.
To be EJB2.0-compliant, add the exceptions RemoveException and CreateException for EJB's methods ejbRemove and ejbCreate.
Additionally, the GlueBean class uses a local object in GlueBean constructor. However, it must use a remote object because it is a class calling an EJB. Therefore, modify the comment in this class with the following:
// If using the remote interface, the call would look like this cruiseManagerHome = (CruiseManagerHome) javax.rmi.PortableRemoteObject.narrow(result, CruiseManagerHome.class); // Using the local interface, the call looks like this //cruiseManagerHome = (CruiseManagerHome) result; |
There are three EJBs, thus there must be three ejb-jar.xml files that correspond to the EJB's deployment descriptors and three jonas-ejb-jar.xml files that correspond to the JOnAS deployment descriptors.
First, rename the files ejb_name.ejbdd with ejb_name.xml (these files contain the EJB deployment descriptors).
Create the three jonas-ejb_name.xml files corresponding to the EJBs.
For the two entity Beans (Cruise and CruiseManager), describe the mapping between:
The EJB name and JNDI name (JNDI name=ejb/ejb name)
The JDBC and the table name
The EJB field and the table field, (the version of CMP is not specified in ejb-jar and JOnAS by default uses CMP1.1).
For the session Bean, describe the mapping between:
The EJB name and JNDI name (JNDI name=ejb/ejb name)