• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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();
properties.put(javax.naming.Context.PROVIDER_URL,
"corbaloc:iiop:ejbserver00:8811");
// "corbaloc:iiop:ejbserver00:8811");
// "iiop://ejbserver00:8811/"); use this also works
properties.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.websphere.naming.WsnInitialContextFactory");
javax.naming.InitialContext initialContext =
new javax.naming.InitialContext(properties);

Object objHome = initialContext.lookup(
"cell/clusters/Cluster1/com.eistream.sonora.webservices.WsSessionEJBHome");

WsSessionEJBHome myWsHome = (WsSessionEJBHome)
javax.rmi.PortableRemoteObject.narrow
(objHome,WsSessionEJBHome.class);
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
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic