wood burning stoves*
The moose likes Websphere and the fly likes creating a WAS client. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Products » Websphere
Bookmark "creating a WAS client." Watch "creating a WAS client." New topic

creating a WAS client.

Giju George
Ranch Hand

Joined: Jun 08, 2004
Posts: 333
I have deployed a session bean in IBM WAS 5 using the console. The JNDI Name for that bean is "Mailer". Now I am trying to create a client in eclipse trying to access the session bean. I just added a whole bunch of IBM jar files to my project. I am confused how to do a look up to that bean. I have tried different ways. Attaching my client code ..

import javax.naming.Context;
import javax.naming.InitialContext;

import com.mweb.bsd.global.util.mailer.ejb.Mailer;
import com.mweb.bsd.global.util.mailer.ejb.MailerHome;

import java.util.*;

public class WebSphereMailerClient {
static String url = "iiop://localhost:2809";
// static String url="iiop://localhost:2809/nodes/bsd-ggeorge/servers/server1";

public static void main(String args[]){
WebSphereMailerClient wClient =new WebSphereMailerClient();
try {
Context ctx = getInitialContext();
MailerHome home=(MailerHome)ctx.lookup("Mailer");
Mailer mailer=home.create();
} catch (Exception e) {

public static Context getInitialContext() throws Exception {
Properties p = new Properties();

p.put(Context.PROVIDER_URL, url);


return new InitialContext(p);

Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3710

Try the WebSphere Universal Test Client and see if the name of the bean appears under the JNDI Explorer. You should see a home interface, then when create() is invoke, will produce a remote object to work with.

This will at least help you verify the JNDI is set up right before trying to access it from a client.

My Blog: Down Home Country Coding with Scott Selikoff
Giju George
Ranch Hand

Joined: Jun 08, 2004
Posts: 333
Is this test client part of the WSAD ?? I am using eclipse and xdoclet for building the ejbs and test client. Is there any other way .. ???
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3710

No, it should have been turned on when you installed your server, and if not can be turned on via the Admin Console.

First, try this URL (port may very) and see if works:


Else, from the Admin Console select "Install New Application" and point it to the UTC EAR file usually found at:


If the file is not found here you need to re-run the WebSphere install and have it install "with samples"
[ December 01, 2005: Message edited by: Scott Selikoff ]
GeeCON Prague 2014
subject: creating a WAS client.