开发者

RMI timeout from remote machime

开发者 https://www.devze.com 2023-03-07 23:13 出处:网络
I could connect to the RMI server with my client code in the same machine. But when I access it over the internet from another machine I get timeout exception after few minutes.

I could connect to the RMI server with my client code in the same machine. But when I access it over the internet from another machine I get timeout exception after few minutes.

I checked the port and is listening.

java.rmi.ConnectException: Connection refused to host: 11.11.11.11; nested exception is: 
java.net.ConnectException: Connection timed out
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:601)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:110)
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:178)
at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132)
at $Proxy0.echoString(Unknown Source)
at client.UseMon.main(UseMon.java:42)
Caus开发者_StackOverflow社区ed by: java.net.ConnectException: Connection timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at java.net.Socket.connect(Socket.java:478)
at java.net.Socket.<init>(Socket.java:375)
at java.net.Socket.<init>(Socket.java:189)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595)
... 7 more

What should I check now.

Thanks.


"...over the internet from another machine..." - is your server behind a router? You'll have to forward ports in this case. This would explain why it works locally but not remotely.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号