Hi Fl�vio:
I test your program in my machine, and find that the problem take place in the reference of registry.
When you call start() method second time and intend to create another registry on other port, the program reach a). Why this happen, will discuss it later. At a), your 'registry' variable simply create a
local reference. Pls look this statement in javadoc:
Note that a getRegistry call does not actually make a connection to the remote host. It simply creates a local reference to the remote registry and will succeed even if no registry is running on the remote host. Therefore, a subsequent method invocation to a remote registry returned as a result of this method may fail.
This means that when you use createRegistry(1234) create one registry instence on your VM, VM will put it into one table stores running registry. But then you call getRegistry(1235) to get one registry reference, but this registry isn't in the table, in other words it isn't running on the VM, and later when you call rebind() method of its could catch the NoSuchObjectException. Because you attempt to invoke a method on an object that no longer exists in the remote virtual machine. This is point out above on javadoc.
Now we discuss why this happen, in other words why the second time the program execute getRegistry but not createRegistry. I think in your stop() method, the code don't make any sense at all. The unbind line only remove 'DBAccess' from bound list of registry(1234). Because you create a registry(1234) before, and not shut down it, so it exist in your VM yet when you attempt to create another registry. And in one VM, must there is a container hold the running registry, every registry instence have three attribute, IP Address, port number and objID. These value must be unique in one VM, so you cann't create registry(1235) before registry(1234) shut down.
So in your stop() method must shut down registry(1234), but I don't find the method to shut down a running registry
, may be some body can tell us. Let's wait......