Not Bound Exception
Hi,
I am new to RMI, I have an existing RMI application and that application is working fine on my system. But when I tried to deploy the same application on other s/m i.e., with out any code changes it is giving the following Exception.
I examined the code it doesn't have any hard coded or s/m dependent values. what could be the reason for this error..
Thanks in advance,
Tito George
java.rmi.NotBoundException: -4be6596d-10d5d56e171--7ff3
at sun.rmi.registry.RegistryImpl.lookup(Unknown Source)
at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.oldDispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Sour
ce)
at java.lang.Thread.run(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknow
n Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Unknown Source)
at bartrack.data.BarProxyImpl.getBartrack(BarProxyImpl.java:446)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Sour
ce)
at java.lang.Thread.run(Unknown Source)
[/code]
[2314 byte] By [
titogeoa] at [2007-10-3 3:50:46]

The server isn't bound to that Registry. Probably it isn't running at all.BTW '-4be6596d-10d5d56e171--7ff3' is really strange for a binding name. Is it really correct?
ejpa at 2007-7-14 21:48:15 >

yes its is the service name. On my system it is working. Is there any other posibility like any security or some thing else.
The Registry is running and you succeeded in connecting to it with your client, so all of that is OK.Have a look at what happened when you started the server.Did you restart the Registry by any chance after you had started the server? You always have to start the Registry
ejpa at 2007-7-14 21:48:15 >

Hi,
u get NotBoundException when client can not establish connection to server, there is no other case where u will get NotBoundException... u do one thing. on command line run command like this..
java -Djava.securit.policy=c:\<Java_Home_Path>\policy.java
make a policy.java file save it into the bin folder of j2sdk....in policy file write....
grant {
// Allow everything for now
permission java.security.AllPermission;
};
it will surely work..
> u get NotBoundException when client can not establish
> connection to server, there is no other case where u
> will get NotBoundException
No, no, no, no, and no. NotBoundException means exactly what it says in the Javadoc - no such name is bound in the Registry. As its name suggests. If you can't connect to the server what you get is a java.rmi.ConnectException. Again as its name suggests. Why do you think these exceptions have these names in the first place?
> it will surely work..
Your suggestion will surely have nothing to do with the OP's problem.
This is all complete nonsense. Please don't post misinformation or guesses. It just wastes everybody's time including your own.
ejpa at 2007-7-14 21:48:15 >

HI,
I made some code changes, now I am getting the following exception.
I will describe the process. As I told this thing works fine on my s/m. But while trying to deploy on other s/m it抯 giving this error.
After RMI server is up I will setup my application抯 server. Server will start without any problem. And in the client side first screen is the login screen. If server is not running we wont get the login screen. But up to login screen there is no problem. This error is generating when we are trying to login.
java.rmi.ServerException: RemoteException occurred in server thread; nested exce
ption is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested excep
tion is:
java.lang.ClassNotFoundException: bartrack.server.JBar_Stub
at sun.rmi.server.UnicastServerRef.oldDispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Sour
ce)
at java.lang.Thread.run(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknow
n Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Unknown Source)
at bartrack.server.BartrackWorker.main(BartrackWorker.java:99)
Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested ex
ception is:
java.lang.ClassNotFoundException: bartrack.server.JBar_Stub
at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.oldDispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Sour
ce)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: bartrack.server.JBar_Stub
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at sun.rmi.server.LoaderHandler.loadClass(Unknown Source)
at sun.rmi.server.LoaderHandler.loadClass(Unknown Source)
at java.rmi.server.RMIClassLoader$2.loadClass(Unknown Source)
at java.rmi.server.RMIClassLoader.loadClass(Unknown Source)
at sun.rmi.server.MarshalInputStream.resolveClass(Unknown Source)
at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
... 9 more
note: JBar_Stub is there in the jar file
Thanks in advance...
Tito
> Server will start without any problem.
According to the stack trace the server is failing in Naming.rebind(). I wouldn't call this 'without any problem'.
The server can't find the stub class. You need to run 'rmic' as documented, and deploy the stub class where the server, the registry, and the client can all find it.
ejpa at 2007-7-14 21:48:15 >

Whatever you are saying is right. But my problem is strange. all the jar files etc..
is working fine on my system. In my system it is finding this stub_ and every thing. Then copied the entire folder to other system. on that system its giving this error. The path and everything are correct. What will be the problem Could you please guide me. is it with any kind s/m dependencies...(client is an applet, and we are using IIS )
> Caused by: java.lang.ClassNotFoundException: bartrack.server.JBar_StubThe Registry still can't find the stub.
ejpa at 2007-7-14 21:48:15 >

how can i specify, that the stub is there.
java "-Djava.library.path=E:\RnD\Bartrack_060\Apps" "-Djava.security.policy=file:\e:\RnD\Bartrack_060\Apps\java.policy" -cp "e:\RnD\Bartrack_060\Apps\Bartrack.jar" "-Djava.rmi.server.codebase=file:\e:\RnD\Bartrack_060\Apps/Bartrack.jar" "bartrack.server.BartrackServer" -d yes
this is how i am invoking server. Bartrack.jar contains there server side files. that stub is inside this jar..
and the applet is also in that folder...