KK

          Kim-'s-Blog.Object-Everything.I'm POJO.

          .紀-錄.爲了忘卻的記憶..真的勇士,要敢于直面遇到的問題,敢于正視繁雜的原碼......在實踐中積累!

            BlogJava :: 首頁 :: 聯(lián)系 :: 聚合  :: 管理
            74 Posts :: 1 Stories :: 70 Comments :: 0 Trackbacks

          發(fā)布個rmi服務居然出現(xiàn)如下:

          17.05.2009 10:19:50 [main] INFO  org.springframework.remoting.rmi.RmiServiceExporter  - Looking for RMI registry at port '1099'
          17.05.2009 10:19:54 [main] DEBUG org.springframework.remoting.rmi.RmiServiceExporter  - RMI registry access threw exception
          java.rmi.ConnectException: Connection refused to host: 
          172.18.7.235; 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.newCall(UnicastRef.java:
          322)
           at sun.rmi.registry.RegistryImpl_Stub.list(Unknown Source)
           at org.springframework.remoting.rmi.RmiServiceExporter.testRegistry(RmiServiceExporter.java:
          411)
           at org.springframework.remoting.rmi.RmiServiceExporter.getRegistry(RmiServiceExporter.java:
          391)
           at org.springframework.remoting.rmi.RmiServiceExporter.getRegistry(RmiServiceExporter.java:
          370)
           at org.springframework.remoting.rmi.RmiServiceExporter.getRegistry(RmiServiceExporter.java:
          331)
           at org.springframework.remoting.rmi.RmiServiceExporter.prepare(RmiServiceExporter.java:
          263)
           at org.springframework.remoting.rmi.RmiServiceExporter.afterPropertiesSet(RmiServiceExporter.java:
          227)
           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:
          1369)
           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:
          1335)
           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:
          473)
           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$
          1.run(AbstractAutowireCapableBeanFactory.java:409)
           at java.security.AccessController.doPrivileged(Native Method)
           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:
          380)
           at org.springframework.beans.factory.support.AbstractBeanFactory$
          1.getObject(AbstractBeanFactory.java:264)
           at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:
          222)
           at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:
          261)
           at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:
          185)
           at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:
          164)
           at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:
          429)
           at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:
          728)
           at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:
          380)
           at org.springframework.context.support.ClassPathXmlApplicationContext.
          <init>(ClassPathXmlApplicationContext.java:139)
           at org.springframework.context.support.ClassPathXmlApplicationContext.
          <init>(ClassPathXmlApplicationContext.java:93)
           at cn.edu.hust.mes.webservice.CallWebServices.
          <clinit>(CallWebServices.java:31)
           at cn.edu.hust.mes.opcapp.OpcApplication.main(OpcApplication.java:
          15)
          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)
            
          28 more
          17.05.2009 10:19:54 [main] INFO  org.springframework.remoting.rmi.RmiServiceExporter  - Could not detect RMI registry - creating new one
          17.05.2009 10:19:54 [main] DEBUG org.springframework.remoting.rmi.RmiServiceExporter  - RMI service [cn.edu.hust.mes.webservice.OpcPlcRmiServiceImpl@dac21] is an RMI invoker
          17.05.2009 10:19:54 [main] DEBUG org.springframework.aop.framework.JdkDynamicAopProxy  - Creating JDK dynamic proxy: target source is SingletonTargetSource for target object [cn.edu.hust.mes.webservice.OpcPlcRmiServiceImpl@dac21]
          17.05.2009 10:19:54 [main] INFO  org.springframework.remoting.rmi.RmiServiceExporter  - Binding service 'opcManager' to RMI registry: RegistryImpl[UnicastServerRef [liveRef: [endpoint:[172.18.7.235:1099](local),objID:[0:0:00]]]]

          --------------------------------------------------
          可見:Binding service 'opcManager' to RMI registry: RegistryImpl[UnicastServerRef [liveRef: [endpoint:[172.18.7.235:1099](local),objID:[0:0:0, 0]]]]
          RMI其實發(fā)布成功了...
          為什么開始有錯呢?
          查看源代碼發(fā)現(xiàn):其實是Spring的Debug log
          他會先看有沒rmi注冊

          org.springframework.remoting.rmi.RmiServiceExporter.testRegistry(RmiServiceExporter.java:411)
          沒有l(wèi)og下再
          Could not detect RMI registry - creating new one
          所以屏蔽該Log4j配置文件中加如:
          log4j.logger.org.springframework.remoting.rmi.RmiServiceExporter=INFO
          posted on 2009-05-17 11:03 Kim' 閱讀(10303) 評論(2)  編輯  收藏

          Feedback

          # re: Spring發(fā)布rmi服務出現(xiàn): java.rmi.ConnectException: Connection refused to host xxx 2009-05-17 19:11 聊天室
          暈! 沒看懂! 加油努力學習??!  回復  更多評論
            

          # re: Spring發(fā)布rmi服務出現(xiàn): java.rmi.ConnectException: Connection refused to host xxx 2009-05-20 12:25 wuzhongxing
          者rmiserver端,添加
          System.setProperty("java.rmi.server.hostname", "172.18.7.235");
          可以解決  回復  更多評論
            


          只有注冊用戶登錄后才能發(fā)表評論。


          網站導航:
           
          jj
          主站蜘蛛池模板: 阳信县| 安庆市| 中江县| 湖南省| 绥中县| 应城市| 来宾市| 平江县| 广州市| 普陀区| 寻甸| 得荣县| 广河县| 广昌县| 黄骅市| 庆城县| 五河县| 河西区| 嵊泗县| 永昌县| 诏安县| 綦江县| 惠水县| 舞钢市| 岚皋县| 陈巴尔虎旗| 壶关县| 谷城县| 桃源县| 大关县| 民乐县| 林周县| 任丘市| 石柱| 保定市| 屏东市| 军事| 瑞丽市| 吉首市| 九江市| 竹北市|