日期:2014-05-20  浏览次数:21046 次

java中的远程调用问题
最近程序老是报错,程序重新一到二天后就会报这样的错误,用的是远程调用,客户端远程调用服务端,望各位大侠帮忙找出问题

客户端报错代码:

java.rmi.ConnectException: Connection refused to host: 192.168.1.4; nested exception is:
  java.net.ConnectException: Connection refused: connect
  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 $Proxy29.getUserFreeStatus(Unknown Source)
  at botian.manager.OnlineUserManager.getSeatFreeStatus(OnlineUserManager.java:122)
  at botian.manager.OnlineUserManager.setSeatFreeStatus(OnlineUserManager.java:483)
  at botian.callcenter.service.CCMiddlewareOnlineUserService.freeSeat(CCMiddlewareOnlineUserService.java:256)
  at botian.callcenter.service.CCMiddlewareOnlineUserService.freeSeat(CCMiddlewareOnlineUserService.java:1)
  at botian.middleware.cc.client.TcpClientServiceImpl.endSession(TcpClientServiceImpl.java:922)
  at botian.middleware.cc.client.TcpClientServiceImpl.dealFlowDetail(TcpClientServiceImpl.java:2272)
  at botian.middleware.cc.client.TcpClientServiceImpl$2.run(TcpClientServiceImpl.java:2749)
  at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
  at java.lang.Thread.run(Thread.java:619)
Caused by: java.net.ConnectException: Connection refused: connect
  at java.net.PlainSocketImpl.socketConnect(Native Method)
  at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
  at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
  at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
  at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
  at java.net.Socket.connect(Socket.java:519)
  at java.net.Socket.connect(Socket.java:469)
  at java.net.Socket.<init>(Socket.java:366)
  at java.net.Socket.<init>(Socket.java:180)
  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)
  ... 16 more

服务端报错代码:

12:46:22,781 [ERROR] - ++++ failed to get SockIO obj for: 192.168.1.102:11211
12:46:22,781 [ERROR] - Address already in use: no further information
java.net.BindException: Address already in use: no further information
  at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
  at sun.nio.ch.SocketChannelImpl.finishConnect(Unknown Source)
  at sun.nio.ch.SocketAdaptor.connect(Unknown Source)
  at com.danga.MemCached.SockIOPool$SockIO.getSocket(SockIOPool.java:1612)

  at com.danga.MemCached.SockIOPool$SockIO.<init>(SockIOPool.java:1585)
  at com.danga.MemCached.SockIOPool.createSocket(SockIOPool.java:782)
  at com.danga.MemCached.SockIOPool.selfMaint(SockIOPool.java:1331)
  at com.danga.MemCached.SockIOPool$MaintThread.run(SockIOPool.java:1497)
12:47:26,828 [ERROR] - ++++ failed to get SockIO obj for: 192.168.1.102:11211