0

Trying to RMI set up over public IP on ubuntu but in vain. I have setup http tunneling. RMI server/applet client are successfully running on LAN with ubuntu as RMI server. Over internet, I am able to run server successfully doing registry on 1099 exporting object to fixed port 1100. I have port forwarded both 1099 and 1100 to local IP of ubuntu 192.168.1.XXX. Also I have set the following on rmi server as well as client

[rmiHostName = public ip]

//configuration
System.setProperty("java.security.policy","http://"+rmiHostName+"/basedir/rmi/java.policy");
System.setProperty("java.rmi.server.hostname",  rmiHostName);//external ip address
System.setProperty("java.rmi.server.codebase",http://"+rmiHostName+"/basedir/rmi/xxx-xxx-1.0.jar"); 

However I am getting following exception:

network: Connecting public-ip/cgi-bin/java-rmi.cgi?forward=1099 with proxy=DIRECT
java.rmi.NotBoundException: //public-ip:1099/MyServer
    at sun.rmi.registry.RegistryImpl.lookup(RegistryImpl.java:136)
    at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
    at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:409)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:267)
    at sun.rmi.transport.Transport$1.run(Transport.java:177)
    at sun.rmi.transport.Transport$1.run(Transport.java:174)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:553)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:772)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:667)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
    at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
    at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
    at sun.rmi.server.UnicastRef.invoke(Unknown Source)
    at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
    at rmi.source.StellarMessageClient.init(StellarMessageClient.java:99)
    at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter.init(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
basic: Applet initialized
basic: Starting applet
basic: completed perf rollup
basic: Applet made visible
basic: Applet started
basic: Told clients applet is started

Can you guys please help me solve this?

user207421
  • 305,947
  • 44
  • 307
  • 483
Dan
  • 21
  • 4

1 Answers1

0
java.rmi.NotBoundException: //public-ip:1099/MyServer

You have not bound a remote object into the Registry at //public-ip:1099 under the name MyRegistry.

user207421
  • 305,947
  • 44
  • 307
  • 483
  • Thank you for your quick response.Actually I have bound like the following: rmiReg.rebind("//"+rmiHost+":"+rmiPort+"/" + "MyServer", remoteObj); where rmiHost is local static ip of ubuntu server 192.168.1.XX Client is accessing through public static IP 59.192.XX.ZZ – Dan Aug 16 '12 at 10:29
  • Thank you so much.I could bind it properly now with public ip.Now The client applet is trying to connect to random ports on my ubuntu server.I will paste the error thrown by client applet below: – Dan Aug 16 '12 at 10:45
  • network: Connecting http://public-ip:1100/ with proxy=DIRECT network: Connecting http://public-ip/cgi-bin/java-rmi.cgi?forward=1099 with proxy=DIRECT network: Connecting http://public-ip:3733/ with proxy=DIRECT network: Connecting http://public-ip:3721/ with proxy=DIRECT java.rmi.ConnectException: Connection refused to host: public-ip; nested exception is: java.net.ConnectException: Connection refused: connect at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)Source) at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) – Dan Aug 16 '12 at 10:49
  • I have only 2 ports open on server, i.e., 1099 and 1100. How can I fix ports in aplet request such that it does always connect server like public-ip:1099 only? Please help. – Dan Aug 16 '12 at 11:07
  • Thank you.I bound remote object on public ip and could connect registry from client.However,client is trying to connect through random ports on server and hence unable to talk to server,because these ports are not open.Could you please help me? – Dan Aug 17 '12 at 04:45