• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RMI rebind throwing MarshalException

 
Todd Sims
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using code similar to what has been posted to programmatically start the RMI registry. That is, I try to create a new registry using LocateRegistry.createRegistry(Registry.REGISTRY_PORT), but if an ExportException is thrown (indicating that there is already an rmiregistry bound to the well-known port on the local host), I fall back to getting a reference to the already running registry using LocateRegistry.getRegistry(Registry.REGISTRY_PORT). After obtaining a reference to the registry, I call rebind() with a new instance of my remote implementation of the database class.

The rebind() call works fine when called on a reference returned by the createRegistry() call, but throws a MarshalException (with a causal NotSerializableException) when called on an already running registry returned by getRegistry().

The only difference I can find is that createRegistry() returns an object of type RegistryImpl, but getRegistry() returns a RegistryImpl_Stub.

Can anyone help me?
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've just built a very small test for this.
The server looks like this:


and works fine either when I call it with no registry running or when running the rmiregistry manually from the commandprompt before starting the server.

I am using Tiger here, I'll try it under 1.4 at work tomorrow if I remember.
 
peter wooster
Ranch Hand
Posts: 1033
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jeroen Wenting:

I am using Tiger here, I'll try it under 1.4 at work tomorrow if I remember.


It should work on 1.4.2, I use very similar code on that platform.
 
Todd Sims
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The only thing I could think of was to upgrade from 1.4.0 to 1.4.2. I'll upgrade my SDK and let you know.

Thanks.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
tried under 1.4.1 on Linux (Sun VM and compiler), worked just fine.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic