| smarto59@hotmail.com 2006-10-30, 7:32 pm |
| Im trying to deploy RMI app thru internet but I have some
misunderstandings about some points. The server code to store remote
object as following (suppose 111.111.111.111 is public ip):
RemoteInterface remoteReference = (RemoteInterface)
UnicastRemoteObject.exportObject(new Server(),1099);
Naming.rebind("//111.111.111.111:1099/"+RemoteInterface.REGISTRY_NAME,
remoteReference);
Also Im doing the following operations to restart the application:
start rmiregistry (of course via default port 1099)
start java -Djava.rmi.server.hostname=111.111.111.111 Server
first of all what is the difference between exporting object using
supplied port as I did in the above code and rebind using specific
port?
Also the rmiregistry is started using the same port which cause the
following exception:
Exception in thread "main" java.lang.RuntimeException:
java.rmi.server.ExportException: Port already in use: 1
099; nested exception is:
java.net.BindException: Address already in use: JVM_Bind at Server.main
(Server.java:228)
when I delete the second parameter in export object the above exception
is gone and begin another problem.
In general how can I implement these operations to get successful rmi
connection thru internet?
|