This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes calling EJB from another server, very weard problem, please come in really need help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "calling EJB from another server, very weard problem, please come in really need help" Watch "calling EJB from another server, very weard problem, please come in really need help" New topic

calling EJB from another server, very weard problem, please come in really need help

philber fang

Joined: Dec 30, 2004
Posts: 12
I really need some websphere guru's help, I've stuck on this for long:

I can call a ejb(the method successfully run and gives me correct return value) running in a remote server, a websphere 5.1 cell network deployment environment, from a servlet running in my local server(on a different machine), which is the testing env. server in the WSAD 5.1. This server is a very simple one created quickly with all the default values. It is all good. I run the method (getRole) it gives me value I expected.

But when I copy/pasted the same code(paste below) calling the ejb into another application, which is running inside a different workspace but in the same WSAD 5.1 IDE, same testing env. server but with different server configuration(in another word, this piece of code is running in 2 applications, both inside my WSAD in my local machine), the same piece of code failed on creating an initial context for the lookup.

in the first simple server it is all good:
**** before lookup ejb...
*********bean got:class com.eistream.sonora.webservices._WsSessionEJB_Stub
[27/06/05 10:36:31:680 EDT] 18f7b7e8 SystemOut O

**********getRole method returns:Admin

But I got the error msg. on the second server console:

**** before lookup ejb...
[27/06/05 10:46:13:023 EDT] 82ef74e WsnInitCtxFac W NMSV0602E: Naming Service unavailable. A communications error occurred.
[27/06/05 10:46:13:023 EDT] 82ef74e SystemOut O

**********getRole method returns: A communication failure occurred while attempting to obtain an initial context with the

provider URL: "corbaloc:iiop:ejbserver00:8811". Make sure that any bootstrap address information in the URL is correct and

that the target name server is running. A bootstrap address with no port specification defaults to port 2809. Possible

causes other than an incorrect bootstrap address or unavailable name server include the network environment and workstation

network configuration.


They are all runing exactly the same piece of code:

System.out.println("\n\n********** before lookup ejb... ");
String myserver = "ejbserver00";
String myport = "8811";

java.util.Properties properties = new java.util.Properties();
// "corbaloc:iiop:ejbserver00:8811");
// "iiop://ejbserver00:8811/"); use this also works
javax.naming.InitialContext initialContext =
new javax.naming.InitialContext(properties);

Object objHome = initialContext.lookup(

WsSessionEJBHome myWsHome = (WsSessionEJBHome)
WsSessionEJB myWsSessionEJB = (WsSessionEJB)myWsHome.create();
System.out.println("\n\n**********bean got:"+myWsSessionEJB.getClass());
String[] aa = myWsSessionEJB.getRoles();
System.out.println("\n\ngetRole method returns:"+ aa[0]);


It shouldn't be any network problem since both tries are on my local machine. So the only differenct is the server configuration.

So my question is: what kind of configuration in the second server could prevent me from creating a initial context? In my mind, there shouldn't be anything in the second server prevents me from getting a naming context if the same code works in another server. Please note the remote server name and port(for jndi lookup are the same and correct) are the same when trying on these 2 servers.

And I also specify the Provider URL, which tells the server don't use the default local namespace(port 2809) to lookup the bean.

Any help is appreciated.....
Thanks a million times......
philber fang

Joined: Dec 30, 2004
Posts: 12
Please note the exactly same piece of code running in the simple server, this could eliminate lots of possibilities.... like networking issue, server name/port number error...

So the only difference is the server configuration. In the second server(not the ejb server) we have https and form authentication setup.
It is sorta covered in the JavaRanch Style Guide.
subject: calling EJB from another server, very weard problem, please come in really need help
Similar Threads
EJB 2.0, WSAD 5, example problem
How to access EJB deployed in Different Machine in websphere
Operation timed out Error
EJB Communication failure exception...
Standalone Java EJB client