Step-By-Step How to deploy Session Bean from Weblogic 5.1.0 samples into IBM WebSphere 3.5

This topic shows you step-by-step how to deploy session bean from Weblogic 5.1.0 to IBM WebSphere 3.5 samples and run a client for it. The sample resides in %WL_HOME%\examples\ejb\basic\statelessSession.

Creating a project and changing CMP bean


Find

Replace

try {
InitialContext ic = new InitialContext();
Integer tl = (Integer) ic.lookup("java:/comp/env/tradeLimit");
tradeLimit = tl.intValue();
}
catch (NamingException ne) {
throw new CreateException("Failed to find environment value "+ne);
}

 tradeLimit = 300;

You are now ready to deploy this bean to WebSphere 3.5

Correcting the Client

Find

Replace

private static final String JNDI_NAME = "statelessSession.TraderHome";

 private static final String JNDI_NAME = "TraderHome";

Find

Replace

String url = "t3://localhost:7001";

String url = "iiop://localhost:900";

Find

Replace

 h.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory")

h.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.ejs.ns.jndi.CNInitialContextFactory")

The client is now ready.

Deploying the Bean

Precondition

Start WebSphere server:

Note: "IBM HTTP Administration" and "IBM HTTP Server" should be already started.

Deploying the bean

Parameter name

Setting

Comment

Admin Node Name

Name of the Node to deploy

Name of the computer

Dependent ClassPath

Fully qualified path to WebSphere

Check if it refers to existing jars

Application Server Name

Your Application Server

"Default Server" by default

EJB Container name

Your Container name

"Default Container" by default

Target WebSphere server directory

WebSphere home directory

e.g. c:\WebSphere\AppServer

Launch server in debug mode

OFF

 

If you have checked Hot Deploy check box, the last message in the Message Pane should be:

//WAS35: Finished with 0 Errors, 0 Warnings.

It means the deployment process successfully completed. Now let us create a client for this bean.

Compiling and running the client


%WAS_HOME%\jdk\jre\lib\ext\rmiorb.jar
%WAS_HOME%\jdk\jre\lib\ext\iioprt.jar
Deployed jar file (e.g. %WAS_HOME%\deployableEJBs\DeployabletogetherEJB.jar)
Home directory of WebSphere Server %WAS_HOME%

This is done in the following way

Note: In the nearest builds these libs will be added automatically.

Beginning statelessSession.Client...

Creating a trader
Buying 100 shares of BEAS.
Buying 200 shares of MSFT.
Buying 300 shares of AMZN.
Buying 400 shares of HWP.
Selling 100 shares of BEAS.
Selling 200 shares of MSFT.
Selling 300 shares of AMZN.
Selling 400 shares of HWP.
Removing the trader

End statelessSession.Client...