• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

problem with rmi

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

when i am trying to bind a object to a remote registry, iam gettting a exception.

exception is.

ComputeEngine exception: RemoteException occurred in server thread; nested exception i
s:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception i
s:
java.lang.ClassNotFoundException: ComputeEngine_Stub
java.rmi.ServerException: RemoteException occurred in server thread; nested exception
is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception i
s:
java.lang.ClassNotFoundException: ComputeEngine_Stub
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemote
Call.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 ComputeEngine.main(ComputeEngine.java:34)
Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested exceptio
n is:
java.lang.ClassNotFoundException: ComputeEngine_Stub
Caused by: java.lang.ClassNotFoundException: ComputeEngine_Stub

i am running registry on different machine and the program in which iam binding binind the object on differnt machine.
can anybody help me.
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The base cause of this problem is -


How are you handling stubs in your program? Are you supplying them as files directly on the classpath, or are you using dynamic class loading to load them from a URL?
 
jayander kumar
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
thanks for reply.

i am loading the class dynamically.


/***** this code binds the object ******/

import java.rmi.registry.*;



public class Bind{


public static void main(String[] args) {

if (System.getSecurityManager() == null) {
System.setSecurityManager(new RMISecurityManager());
}


String name = "time";
try {



// TimeServer m = new TimeServer();


Properties p = System.getProperties();


String url = p.getProperty("java.rmi.server.codebase");


Class m = RMIClassLoader.loadClass(url,"TimeServer");


Registry remoteReg = LocateRegistry.getRegistry("vivek",1099);

remoteReg.rebind(name,(Remote) m.newInstance());

System.out.println("TimeServer bound");

} catch (Exception e) {

e.printStackTrace();
}
}
}


vivek is the system name on which i am running the registry.

i am loading the stub using codebase

java -Djava.security.policy=register.policy -Djava.rmi.server.codebase="http://deepak:8080/rmi/" Bind

deepak is my system name.

when i am trying to bind the object to my own registry it is working fine.

but when iam trying to bind to vivek machine's registry it is giving an exception.

java.rmi.ServerException: RemoteException occurred in server thread; nested exception
is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception i
s:
java.lang.ClassNotFoundException: TimeServer_Stub
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:352)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:207)
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)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemote
Call.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.rebind(Unknown Source)
at Bind.main(Bind.java:40)
Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested exceptio
n is:
java.lang.ClassNotFoundException: TimeServer_Stub
at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:342)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:207)
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)
Caused by: java.lang.ClassNotFoundException: TimeServer_Stub
at java.net.URLClassLoader$1.run(URLClassLoader.java:198)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:322)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:207)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:427)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:159)
at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:629)
at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:257)
at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:200)

at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1503)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1425)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1616)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1264)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:322)
... 9 more

kindly help..
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which is line 40 in the Bind class? The RMIClassLoader line or the registry.rebind()?

Just to make sure, the TimeServer_Stub class is available on "http://deepak:8080/rmi/", right?

Unfortunately, I don't have multiple machines right now to test out running a registry on one machine and a codebase on another. I'll have to pull my old 475MHz machine out of the closet and get it set up when I get home
 
Why fit in when you were born to stand out? - Seuss. Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic