RMI applet is making requests on random ports and blocked consequently
Posted
by
Dan
on Stack Overflow
See other posts from Stack Overflow
or by Dan
Published on 2012-08-30T06:01:39Z
Indexed on
2012/08/30
9:38 UTC
Read the original article
Hit count: 287
///
I have set up RMI system successfully on local ubuntu srver.
Registry port 1099 and remote object export on 1100(fixed by calling super(1100))
Now I am trying to make it work on Ubuntu over internet with a public IP.
I could bind service properly with public ip.But the client applet is trying to connect to ubuntu server at random ports.
Below is the error thrown by client applet:
// Exception
network: Connecting public-ip:1100 with proxy=DIRECT
network: Connecting public-ip/cgi-bin/java-rmi.cgi?forward=1099 with proxy=DIRECT
network: Connecting public-ip:3733 with proxy=DIRECT
network: Connecting 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)
...
//
// I have only 2 ports open on server, i.e., 1099(registry) and 1100(export). How can I fix ports in applet requests such that it does always connect server on same open port? //
// Another issue.As I have bound service on public IP i.e. //public-ip:1099/ServiceName, a job running on server to send message to clinets is not able to make request to RMI service. public-ip URL does not work on same machine,i.e., server.Do you think I should use fixed socket factory?If so please give me code snippet and guide me how i can set it up.
//Exception
java.rmi.ConnectException: Connection refused to host: public-ip; nested exception is:
java.net.ConnectException: Connection refused
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:128)
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:194)
at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:148)
at $Proxy5.getUserID(Unknown Source)
at rmi.source.xxxxxx$JobScheduler.run(xxxxServerImpl.java:293)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:337)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:198)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:180)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)
at java.net.Socket.connect(Socket.java:579)
at java.net.Socket.connect(Socket.java:528)
at java.net.Socket.(Socket.java:425)
at java.net.Socket.(Socket.java:208)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:40)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:146)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:613)
... 9 more
Coould you please help me?
Thanks a lot in advance.
Dan
© Stack Overflow or respective owner