How Do I Deploy Enterprise JavaBeans to iPlanet?
An Oracle JDeveloper How To Document
July 26, 2002
Content
Introduction
This document describes in detail the requirements and steps to deploy Enterprise
JavaBeans to the Sun ONE/iPlanet Application Server.
This document was written for Oracle9i JDeveloper 9.0.2 and Sun iPlanet
Application Server 6.5 Enterprise Edition on Windows 2000, although other versions
of Oracle9i JDeveloper and/or iPlanet Application Server should behave the same.
On Windows start iPlanet using the Services Control Panel applet inside of
the Administrative Tools folder.
On UNIX, please consult the iPlanet Administration Documentation.
Creating a
Simple EJB
Create a New Stateless Session Bean. This is a choice under the Enterprise
JavaBeans category from the New Gallery. In the Enterprise JavaBean Wizard,
click Next to accept all defaults, then click Finish. In the EJB Class Editor,
select the Fields tab, and add a new field named info.
This creates accessor methods on the EJB that can be invoked in the EJB test
application.
Creating
a JDK Definition for the JDK Used by iPlanet
To use RMI-IIOP with iPlanet, you need to use the iPlanet Object Request Broker
(ORB). This ORB is pre-installed in the Java Runtime Environment (JRE) included
with iPlanet in the directory \iPlanet\ias6\ias\usr\java. If
you are using Oracle9i JDeveloper on a different machine than the iPlanet
Application Server you must either copy this JRE to the machine with JDeveloper,
or follow the manual installation steps for the iPlanet ORB from Chapter 10
of the iPlanet Application Server Developers Guide.
Follow these steps to create a JDK definition for JDeveloper to use the JRE
from iPlanet.
- From the main menu, choose Project > Project Settings...
- In the tree, select Libraries
- On the right of the J2SE Version combo box, click Define
- For the J2SE Name, enter iPlanet JDK 1.3.1
- Click Browse and browse to the java.exe bundled with iPlanet, this
is located in the directory \iPlanet\ias6\ias\usr\java\bin\java.exe
- Click OK
Creating
a Library in JDeveloper for the iPlanet Client JAR files
Oracle9i JDeveloper needs a library definition which contains the client
side JAR files required to test an Enterprise JavaBean deployed inside iPlanet.
Here are the JAR files required for the JDeveloper library:
- \iPlanet\ias6\ias\classes\java\iasclient.jar
- \iPlanet\ias6\ias\classes\java\javax.jar
Create a new Library in JDeveloper, name it iPlanet EJB Client
and add both of these JAR files to the library.
Here is an example of the library definition as created with JDeveloper:

Creating
the Test Client for iPlanet
Create a test client for your EJB with the Create Sample Java Client
context menu item from the EJB node in the Navigator. Choose Connect to Remote
App Server in the Sample EJB Java Client Details dialog, and ignore
the values of the J2EE Application Name and Oracle9iAS Connection Name. Click
OK.

You must modify the default EJB test client to use the JNDI properties for
iPlanet.
Here are the JNDI properties that iPlanet requires:
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
env.put(Context.PROVIDER_URL, "iiop://localhost:9010");
|
Since iPlanet uses RMI-IIOP, instead of casting the result of Context.lookup
use the method, PortableRemoteObject.narrow. It is good practice
to use PortableRemoteObject.narrow as it is required in EJB 2.0.
Add code to invoke the setInfo and getInfo methods previously added by the
EJB Class Designer. Here is an example of the test application modified to invoke
these methods:
Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.cosnaming.CNCtxFactory"); env.put(Context.PROVIDER_URL, "iiop://localhost:9010"); Context ctx = new InitialContext(env); Object objref = ctx.lookup("ejb/MySessionEJB"); MySessionEJBHome mySessionEJBHome = (MySessionEJBHome)
PortableRemoteObject.narrow( objref, MySessionEJBHome.class );
// Use one of the create() methods below to create a new instance MySessionEJB mySessionEJB = mySessionEJBHome.create();
// Call any of the Remote methods below to access the EJB
mySessionEJB.setInfo("Hello World"); System.out.println( mySessionEJB.getInfo() );
|
Deploying
the EJB JAR File to iPlanet
Deploying the EJB JAR file from JDeveloper to iPlanet is two distinct procedures.
The first creates the EAR file from within JDeveloper. The second takes the
EAR file, adds iPlanet specific information, creates client RMI-IIOP stubs,
and deploys it to the Application Server.
Use these steps to create the EJB EAR file.
- From the main menu, choose File > New
- In the New Gallery, choose the Deployment Profiles category.
- Select EJB JAR File - J2EE EJB Module
- Click OK
- Leave the name the default ejb1.deploy and click Save.
- On the J2EE EJB Module Deployment Profile Settings, click OK
(no changes are required)
- In the Navigator, right-click the ejb1.deploy node
- Choose Deploy to EAR file from the context menu
Use these steps to
deploy the EJB EAR file.
- Invoke the iPlanet iAS Deployment Tool
- Open the EAR file created in the last section
- On the warning about "Non IAS Modules will be migrated to IAS",
click OK
- Save the EAR file
- Re-open the EAR file
- On the warning about "Non IAS Modules will be migrated to IAS",
click OK
- In the navigator, select the tab ComponentView
- In the navigator, select MySessionEJB
- From the main menu, choose Edit > Edit Descriptor
- On the General tab, check Enable RMI-IIOP
- From the main menu, choose Edit > Save Descriptor
- Close the editor.
- In the main menu, select ejb1 (which is the first item
under J2EE Applications)
- From the main menu, choose File > Deploy
- On the confirmation dialog, click Yes
- You can look at the directory containing the EAR file at this point, and
it should contain a file named ejb1-RmiCorba.jar. This file
contains the RMI-IIOP client stubs for your EJB Session Bean.
- On the Deploy dialog, select the server from the list. (If no server is
registered, register it now by clicking Register)
- Click Deploy
If there are any errors during deployment, they will be displayed in the Message
window.
Creating a Library in JDeveloper
for the EJB Client Stubs
Oracle9i JDeveloper needs a library definition containing the client side RMI-IIOP
stubs which were generated as part of deployment to iPlanet. This archive is
located in the same directory as the ejb1.ear file and is named ejb1-RmiCorba.jar.
- Create a new Library in JDeveloper named MySessionEJB Stubs
- Add the file ejb1-RmiCorba.jar to the library
Testing the
EJB in iPlanet
- Edit your project properties
- Remove the Oracle9i iAS library
- Add the iPlanet EJB Client library
- Add the MySessionEJB Stubs library
- Change the J2SE to iPlanet JDK 1.3.1
- Run the test client
- Verify that "Hello World" is displayed in the JDeveloper Message
Log
References
|