• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Running RMIRegistry using servlet

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm trying to run RMIRegistry using servlet, after I start it, I'm trying to run another application from command line and trying to bind an object in the RMIRegistry.
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
I'm getting following exception on the application side:
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: abc.xyz.aaaImpl_Stub(no security manager: RMI class loader disabled)
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: abc.xyz.aaaImpl_Stub(no security manager: RMI class loader disabled)
java.lang.ClassNotFoundException: abc.xyz.aaaImpl_Stub(no security manager: RMI class loader disabled)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:245)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:354)
at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
at abc.xyz.bbb.register(Unknown Source)
at abc.xyz.bbb.main(Unknown Source)
at java.lang.reflect.Method.invoke(Native Method)
at abc.xyz.ccc.main(Unknown Source)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
On servlet side (where I'm running RMIRegistry)
I have java.rmi.server.logCalls & sun.rmi.server.exceptionTrace turned on and I'm getting:
sun.rmi.registry.RegistryImpl[0:0:0, 0]: void bind(java.lang.String, java.rmi.Remote)]
exception: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: abc.xyz.aaaImpl_Stub(no security manager: RMI class loader disabled)
java.lang.ClassNotFoundException
: abc.xyz.aaaImpl_Stub(no security manager: RMI class loader disabled)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:318)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:132)
at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:143)
at java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java:918)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:366)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1186)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:319)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:187)
at sun.rmi.transport.Transport$1.run(Transport.java:152)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:148)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:465)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:706)
at java.lang.Thread.run(Thread.java:484)
Exception dispatching call to [0:0:0, 0] in thread "RMI TCP Connection(3)-10.128.201.7" at Tue Jun 04 16:37:39 EDT 2002:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: abc.xyz.aaaImpl_Stub(no security manager: RMI class loader disabled)
java.lang.ClassNotFoundException: abc.xyz.aaaImpl_Stub (no security manager: RMI class loader disabled)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:318)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:132)
at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:143)
at java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java:918)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:366)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1186)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:319)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:187)
at sun.rmi.transport.Transport$1.run(Transport.java:152)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:148)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:465)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:706)
at java.lang.Thread.run(Thread.java:484)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
I have set up java.rmi.server.codebase property appropriately on the servlet side.
This set up works for me correctly If I set up the classpath of my tomcat before starting tomcat. I don't think I need to setup classpath, java.rmi.server.codebase should work, but, somehow I'm missing something.
ANY help with this is greatly appriciated.
Thank you
 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This problem is occuring because on your servlet side (where you are running the rmiregistry), there is no SecurityManager installed. Hence the RMIClassLoader refuses to download code dynamically (in this case the stubs, since you are doing a bind()). This problem would not occur if the stubs themselves are located in the rmiregistry's classpath (no dynamic downloading would occur).
Start Tomcat with a security manager, (java -Djava.security.manager ....). You probably would also need to specify a policy file, with the appropriate permissions, since the security manager by default, restricts the user code (i.e. your servlet) from doing pretty much everything.
 
Your mind is under my control .... your will is now mine .... read this tiny ad
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic