RMI Problem with Mediator 7.2.1.5

Hello everybody!!

Here’s my problem:
I’ve got several personal Java components that extend a custom Java gateway. I also have an object (named Referentiel) used by these components and by other external application. So I want to use the same object instance for all these component and application.

To do that, I use the RMI API. The problem occurs in my mediator gateway initialisation when I bind my object into the rmi registry.

Here’s the cached Exception:
:confused: :confused: :confused: :confused: :confused:
java.rmi.NoSuchObjectException: no such object in table
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:350)
at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
at com.softwareag.util.referentiel.ReferentielImpl.referentielRmiBind(ReferentielImpl.java:541)
at fr.softwareag.eai.myGateway.(myGateway.java:85)
at fr.softwareag.eai.SagAck.(SagAck.java:35)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at com.softwareag.xbridge.CFactory.ComponentFactoryImpl.createComponent(Unknown Source)
at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:536)

This problem only occurs in mediator. Indeed when I build the Referentiel Object and bind it into rmi from a mediator external application, all works well so I think the problem is linked with XBD.

I?ve tried anything I was able to do so I desperately need help…
:eek:
Thanks in advance for your answer.

Yves Clement
SAG France.

Here’s the Referentiel member functions that start or connect to the rmiRegistry and bind the Referentiel Object:

public void referentielRmiBind(String host, int port) throws RemoteException{
Registry reg=getReg(host,port);
try{
reg.bind(“//”+host+“:”+port+“/Referentiel”,this);
} catch (RemoteException RE){
throw RE;
} catch (AlreadyBoundException ABE){
throw new RemoteException(“RemoteException in ReferentielImpl.referentielRmiBind(line 541)”,ABE);
}
}

private Registry getReg(String host, int port) throws RemoteException{
Registry reg=null;
try{
reg=LocateRegistry.createRegistry(port);
}catch (RemoteException RE){

if (RE.detail instanceof java.net.BindException || RE instanceof java.rmi.server.ExportException){
try{
reg=LocateRegistry.getRegistry(host,port);
} catch (RemoteException REX){
throw REX;
}
}
else{
throw RE;
}

}
return reg;
}

And here’s a part of myGateway’s Initialisation code:

try {
tconnection=InoPoolManager.getConnection(“Consult”);
referentiel = ReferentielImpl.createReferentiel(tconnection, Collection);
referentiel.referentielRmiBind(host,port);
}
catch(TConnectionNotAvailableException TCNAE) {
Tools.log(Level.ERROR, “Tamino Connection Not Available”, TCNAE);
} catch (RemoteException RE){
Tools.log(Level.ERROR,“RemoteException when binding referentiel”,RE);
}

Hello Nynyves,

Although I don’t have an immediate solution, one of our developers offered the following comments:

There is something interesting in the stack trace. It seems to indicate that a method
that is not or is no longer in some RMI internal table is called when bind is invoked. Either the invoked method is not there or the object (rmi) it tried to called is not there.

It’s possible that the object being bound in RMI is using itself to do the binding.

Still, it does not explain why the code works in other circumstances.

My first attempt would be to disconnect the creation and binding of the object from the object itself. The rmi creation code is pretty static as well as the binding. It can be put in a static class (util) instead of the Referentiel class.

Hope this helps.

Best regards,
Mike

Hi Mike!

Thanks for your answer. Unfortunately it doesn?t help very much. Indeed, before I put the two functions getReg and referentielRmiBind in the Referentiel class; they were in the myGateway class, and it throws the same exception.

In fact it’s a very strange problem. I really don’t understand because I look at mediator’s method that bind the Factory in the registry and I do quite the same… but, for me, it doesn?t work.

For the moment I found an ugly workaround, so I still need help.

Thanks in advance.

Yves Clement
SAG France

Hello Yves,

If you could create a minimal version of the component that fails and post it to here, along with the sequence, I will have someone take a look at it.

Best regards,
Mike