rmi registry binding issue

Ibrahim.I picture Ibrahim.I · Dec 12, 2012 · Viewed 10.2k times · Source

I'm running RMI Regitry on a virtual machine (running Windows XP) with IP: 192.168.133.2 and trying to bind an RMI server (running on different vm XP IP: 192.168.133.3) by using this code:

Naming.rebind("//192.168.133.2/rmi.2", new RMI());

where

public class RMI extends UnicastRemoteObject

but I get this exception:

    java.rmi.AccessException: Registry.Registry.rebind disallowed; origin /192.168.133.3 is non-local host

I figured that the RMI Registry don't accept any rmi server which isn't running on the same RMI Registry running machine.

but how to make this registry accept my rmi server?

p.s: I'm using JBuilder X as an IDE.

I'm trying to implement a mobile agent which will run on some rmi servers to do some work on them and return the results to the starting station so RMI servers implements the environment that hosts this agent to do its work and send it to the next station which it'll locate through the registry

Answer

user207421 picture user207421 · Dec 13, 2012

trying to bind an RMI server (running on different vm XP IP: 192.168.133.3)

Stop right there. You can't do that. You can only bind an RMI server to a Registry running in the same host as the agent that is doing the bind.

Note that that does not necessarily mean the same host as the remote object itself is running in. For example, a client could lookup a remote Registry and bind the stubs retrieved into the local Registry. But you cannot bind anything to a remote Registry.