tags:

views:

198

answers:

2

I am using this plugin (it's pretty cool).

Needless to say, I am an RMI novice. I followed the tutorials and was able to put together a sample application.

I do not understand though why every time I stop and restart my local RMI registry the remote objects that were bound to it just vanish. Is this normal behavior? I was under the impression that the rmi registry could be used as a persistence tool - so the contents of the registry should not vanish when the registry is stopped and restarted.

I am probably missing something very obvious but, again, I am new to rmi.

Any pointers appreciated!

+1  A: 

By default the RMI registry does not persist information about the objects registered with it. Therefore, you need to register your remote objects each time the server starts.

As a matter of curiosity, what was it that led you to believe that the registry would somehow "remember" the objects that were last registered with it?

Don
OK - thats what I am missing. What led me to believe that is the fact that during a training session they were showing an sample ATM application (with no db) and the logic consequence of that is that the stuff get persisted in the registry (otherwise every time you reboot the server your bank-account would go blank!).I imagine if I use remote-activation it won't make a difference? One thing I am reading (http://www.universalteacherpublications.com/java/rmi/ch13/ch13_page01.htm) is that with remote activation the remote objects in the registry survive server crashes?
JohnIdol
I think I can clear *that* up, at least: The RMI Registry provides information on how to access its registered applications, but if those applications deal with data then they're expected to provide their own persistence, usually into a database.
Carl Smotricz
+1  A: 

no need for a standalone registry. you can create a registry right in the server VM:

    Registry reg = LocateRegistry.createRegistry(1099);
    reg.bind("service", myService);
irreputable
objects bound to it wouldn't survive restart either, I seem to understand?
JohnIdol
what's the good of the registry, if the server object is gone with the server VM? put them all in one VM, so that they live together and die together.
irreputable