2012年9月17日 星期一

當RMI呼叫試圖存取127.0.0.1的時候

錯誤訊息可能長這樣
Caused by: java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is: java.net.ConnectException: Connection refused at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEnd point.java:574) at sun.rmi.transport.tcp.TCPChannel.createConnection( TCPChannel.java:185) at sun.rmi.transport.tcp.TCPChannel.newConnection(TCP Channel.java:171) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:9 4) at org.springframework.remoting.rmi.RmiInvocationWrap per_Stub.invoke(Unknown Source) at org.springframework.remoting.rmi.RmiClientIntercep tor.doInvoke(RmiClientInterceptor.java:400) at org.springframework.remoting.rmi.RmiClientIntercep tor.doInvoke(RmiClientInterceptor.java:344) at org.springframework.remoting.rmi.RmiClientIntercep tor.invoke(RmiClientInterceptor.java:259) at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :185) at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:209) at $Proxy0.settle(Unknown Source)
這個時候,通常是RMI server的/etc/hosts設定了localhost為127.0.0.1,
只要修改/etc/hosts,把localhost的entry改為真實IP,就可以正常運作了。
Reference: gflei.iteye.com

沒有留言:

張貼留言