Remote EJB Look Up Fail

[nobr]Hi,

I was trying to invoke a remote EJB and generated the following exception:

java.lang.IncompatibleClassChangeError: com.ibm.CORBA.iiop.ORB method

createObjectURL(Ljava/lang/String;)Lcom/ibm/CORBA/iiop/ObjectURL;at

com.ibm.ws.naming.util.WsnInitCtxFactory.parseIiopUrl(WsnInitCtxFactory.java

:1668)at

com.ibm.ws.naming.util.WsnInitCtxFactory.parseBootstrapURL(WsnInitCtxFactory

.java:1427)at

com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCt

xFactory.java:368)at

com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:102)at

com.ibm.ws.naming.util.WsnInitCtx.getContextIfNull(WsnInitCtx.java:408)at

com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:131)at

javax.naming.InitialContext.lookup(InitialContext.java:359).

The code I've written is as follows

PrintWriter out=resp.getWriter();

try{

Properties p=new Properties();

p.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialCo

ntextFactory");

p.put(Context.PROVIDER_URL,"rmi://mirdev58.mircity.com:2089");

InitialContext ic=new InitialContext(p);

/*this will give the services available in the context */

Enumeration en=ic.list("/ejb/com/miracle");

while(en.hasMoreElements())

{

out.println(en.nextElement()+"<br>");

}

/*this will lookup all the objects and services that are available in that

context*/

Object home=ic.lookup("/ejb/com/miracle/HelloHome");

//the jndi name for the home interface

HelloHome

lh=(HelloHome)PortableRemoteObject.narrow(obj,HelloHome.class);

HelloLocal bean=lh.create();

pw.println(" "+bean.sayHello());}

catch(Exception e)

{out.println("problem............."+e);}

This works fine when invoking a bean located on the same server.

I've double checked the host name, port, JNDI name and things are perfect.

I'm using IBM WebSphere App. Server and WebSphere Studio Developer. Any suggestions is appreciated.

Thanks[/nobr]

[2753 byte] By [G.Osuria] at [2007-9-30 23:35:20]
# 1
Seems like the class changes from what it was when done locally to something else when remotely tried. The only thing l can thing of is that remotely, it becomes serialized and because the serialization is done by different VMs, they become incompatible?
dokundayea at 2007-7-7 14:49:17 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

I think that it is failing on creating the InitialContext (it delayed this until the lookup). So, my guess is that your JNDI properties are not valid - either the InitialContextFactory class name, or more likely the JNDI URL. I think that the JNDI URL should start with iiop:// for websphere

Good Luck!

designminddavea at 2007-7-7 14:49:17 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3

I did try using IIOP, infact the code is working well on the the same computer, but the problem arises when using different computers. The code is

import java.util.Enumeration;

import java.util.Properties;

import javax.naming.Context;

import javax.naming.InitialContext;

import javax.rmi.PortableRemoteObject;

import com.miracle.example.SampleSession;

import com.miracle.example.SampleSessionHome;

public class RemoteEjb {

public static void main(String[] args) {

try{

Properties p=new Properties();

p.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialCo

ntextFactory");

p.put(Context.PROVIDER_URL,"iiop://mirdev58.mircity.com:2089");

InitialContext ic=new InitialContext(p);

Object home=ic.lookup("/ejb/com/miracle/HelloHome");

HelloHome lh=(HelloHome)PortableRemoteObject.narrow(home,HelloHome.class);

HelloLocal bean=lh.create();

System.out.println("/n"+bean.sayHello());}

catch(Exception e)

{System.out.println("problem............."+e);}

}

}

and error is:

搄avax.naming.ServiceUnavailableException: A communication failure occurred while attempting to obtain an initial context using the provider url: "iiop://mirdev58.mircity.com:2089/". Make sure that the host and port information is correct and that the server identified by the provider url is a running name server. If no port number is specified, the default port number 2809 is used. Other possible causes include the network environment or workstation network configuration. [Root exception is org.omg.CORBA.TRANSIENT: Connection refused: connect: host=mirdev58, port=2089 minor code: 4942F301 completed: No]?

Are there any sort of security policies i need to set on the WebSphere App Server or some thing?

G.Osuria at 2007-7-7 14:49:17 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 4
Any one has an update. Try to keep the topic alive, i've checked the network too, and its fine.
G.Osuria at 2007-7-7 14:49:17 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 5

I would try changing the name of the EJB. Name it something like HelloHomeEJB.

and then use name as following parameters:

Object home=ic.lookup("HelloHomeEJB");

For the list method of InitialContext, the parameter is a Name object that represents the name of the context you want to list. If you have not explicitly "named" a context, I'm not sure what the Weblogic default is, but it seems that you cannot use or find this "named" context on remote machines.

Enumeration en=ic.list("/ejb/com/miracle");

AMPHIGIS_Xa at 2007-7-7 14:49:17 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 6
It could be a problem caused by network security mechanisms. For example there may be a firewall that does not allow this network traffic between the 2 computers. Or the server or client's operating system is restricting this traffic based on a security configuration.Hope that
designminddavea at 2007-7-7 14:49:17 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 7
Looking at these two linesHelloHome lh=(HelloHome)PortableRemoteObject.narrow(home,HelloHome.class); HelloLocal bean=lh.create();Are they local interfaces. If they are then u cannot look up a local home object remotely as per my knowledge. If i m wrong pls correct me.
enigma_y2k1a at 2007-7-7 14:49:17 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 8
did you ever find out what the problem was?
jrasilloa at 2007-7-7 14:49:17 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...