P
polaris
I have rmi application which is running correctly
inside LAN where im starting the server using lan
address: 10.0.0.2 like the following:
RemoteInterface remoteReference = (RemoteInterface)
UnicastRemoteObject.exportObject(new Server());
System.getProperties().put("java.rmi.server.hostname", "10.0.0.2");
Naming.rebind("//10.0.0.2:"+1099+"/"+RemoteInterface.REGISTRY_NAME,
remoteReference);
with this command: java -Djava.rmi.server.hostname=10.0.0.2 remoteSever
but when it try to rebind using public IP (I get it from some web
sites) instead I get this error:
Exception in thread "main" java.lang.RuntimeException:
java.rmi.ConnectException: Connection refused to host:
***.***.***.***; nested exception is: java.net.ConnectException:
Connection timed out: connect
Is the problem from NAT setting where i need to
redirect the incomming traffic and how can i do that?
also i tried to bind server with 1099 port in the following code:
UnicastRemoteObject.exportObject(new Server(),1099);
but i get "Port already in use: 1099" error where i started
rmiregistry with this port.
i need to know the right way to bind remote server with specific
port (shoudl i use another port for rmiregistry e.g. 1500)
and what port i should use in client lookup: Server bind port or
rmiregistry started port?
Naming.lookup("//10.0.0.2:?/"+RemoteInterface.REGISTRY_NAME);
inside LAN where im starting the server using lan
address: 10.0.0.2 like the following:
RemoteInterface remoteReference = (RemoteInterface)
UnicastRemoteObject.exportObject(new Server());
System.getProperties().put("java.rmi.server.hostname", "10.0.0.2");
Naming.rebind("//10.0.0.2:"+1099+"/"+RemoteInterface.REGISTRY_NAME,
remoteReference);
with this command: java -Djava.rmi.server.hostname=10.0.0.2 remoteSever
but when it try to rebind using public IP (I get it from some web
sites) instead I get this error:
Exception in thread "main" java.lang.RuntimeException:
java.rmi.ConnectException: Connection refused to host:
***.***.***.***; nested exception is: java.net.ConnectException:
Connection timed out: connect
Is the problem from NAT setting where i need to
redirect the incomming traffic and how can i do that?
also i tried to bind server with 1099 port in the following code:
UnicastRemoteObject.exportObject(new Server(),1099);
but i get "Port already in use: 1099" error where i started
rmiregistry with this port.
i need to know the right way to bind remote server with specific
port (shoudl i use another port for rmiregistry e.g. 1500)
and what port i should use in client lookup: Server bind port or
rmiregistry started port?
Naming.lookup("//10.0.0.2:?/"+RemoteInterface.REGISTRY_NAME);