Hi,
I have the following sample code to bind a
test remote object to the RMI registry
Now, when i run the above program with the following parameters:
-Dsun.rmi.loader.logLevel=VERBOSE -Dsun.rmi.dgc.logLevel=VERBOSE
I get the following log:
Mar 26, 2007 2:27:26 PM sun.rmi.transport.WeakRef pin
FINER: main: strongRef = sun.rmi.transport.DGCImpl@17a8913
Mar 26, 2007 2:27:26 PM sun.rmi.transport.ObjectTable putTarget
FINER: main: add object [0:0:0, 2]
Mar 26, 2007 2:27:26 PM sun.rmi.transport.WeakRef pin
FINER: main: strongRef = RegistryImpl[UnicastServerRef [liveRef: [endpoint:[10.10.2.67:1098](local),objID:[0:0:0, 0]]]]
Mar 26, 2007 2:27:26 PM sun.rmi.transport.ObjectTable putTarget
FINER: main: add object [0:0:0, 0]
Mar 26, 2007 2:27:26 PM sun.rmi.transport.ObjectTable putTarget
FINER: main: add object [0]
Mar 26, 2007 2:27:26 PM sun.rmi.transport.ObjectTable removeTarget
FINER: RMI Reaper: remove object [0]
If you see the last log, it indicates that the RMI Reaper
thread has removed an object. However, it does not give the detail of the object removed but i assume that it is the object that i have added because, when i try to execute a method on the object that i have bound(by name "nitesh") i get the following exception:
Exception in thread "main" 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:126)
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:179)
at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132)
at $Proxy0.hello(Unknown Source)
Is it so, that the RMI reaper has removed the bound object from the object table, as soon as it is bound?
Just to mention, the above exception come while calling the method hello on the remote interface. I can lookup the object from the registry.
Also, i am not generating any stubs, so dynamic proxy will be used in this case.
I am sure i am missing something.
Just a nasty fact. If i make this thread sleep for some time just before the bind to the registry, everything works fine .... can somebody help me understand this
code for the remote interface, implementation and client for reference:
[ March 26, 2007: Message edited by: Nitesh Kant ]