KK

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

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

  BlogJava :: 首页 :: 联系 :: 聚合  :: 管理
  74 Posts :: 1 Stories :: 70 Comments :: 0 Trackbacks

发布个rmi服务居然出现如下:

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其实发布成功了...
为什么开始有错呢?
查看源代码发现:其实是Spring的Debug log
他会先看有没rmi注册

org.springframework.remoting.rmi.RmiServiceExporter.testRegistry(RmiServiceExporter.java:411)
没有log下再
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' 阅读(10293) 评论(2)  编辑  收藏

Feedback

# re: Spring发布rmi服务出现: java.rmi.ConnectException: Connection refused to host xxx 2009-05-17 19:11 聊天室
晕! 没看懂! 加油努力学习!!  回复  更多评论
  

# re: Spring发布rmi服务出现: 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");
可以解决  回复  更多评论
  


只有注册用户登录后才能发表评论。


网站导航:
 
jj