登录|注册|快速了解|帮助

小戴 的维客空间

http://wiki.hudong.com/daiqi/index  ( 复制链接 | 加入收藏夹 )

当前位置: Java Rmi 常见错误(一) >> 正文

Java Rmi 常见错误(一)

 近日,负责开发一个远程调用的应用。该远程调用使用spring的rmi实现。

 在最终的测试中,将同样的工程代码部署到两台应用服务器,但诡异的事情发生了,一台机器可以正常启动和调用Rmi服务,但是另外一台Web服务器报以下错误:

2008-03-02 17:52:19 [org.springframework.web.context.ContextLoader]-[ERROR] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'aaaServiceExporter' defined in ServletContext resource [/WEB-INF/rmi-server.xml]: Invocation of init method failed; nested exception is java.rmi.server.ExportException: internal error: ObjID already in use
Caused by:
java.rmi.server.ExportException: internal error: ObjID already in use
 at sun.rmi.transport.ObjectTable.putTarget(ObjectTable.java:168)
 at sun.rmi.transport.Transport.exportObject(Transport.java:69)
 at sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:190)
 at sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:382)
 at sun.rmi.transport.LiveRef.exportObject(LiveRef.java:116)
 at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:145)
 at sun.rmi.registry.RegistryImpl.setup(RegistryImpl.java:92)
 at sun.rmi.registry.RegistryImpl.(RegistryImpl.java:78)
 at java.rmi.registry.LocateRegistry.createRegistry(LocateRegistry.java:164)
 at org.springframework.remoting.rmi.RmiServiceExporter.getRegistry(RmiServiceExporter.java:350)
 at org.springframework.remoting.rmi.RmiServiceExporter.getRegistry(RmiServiceExporter.java:326)
 at org.springframework.remoting.rmi.RmiServiceExporter.getRegistry(RmiServiceExporter.java:291)
 at org.springframework.remoting.rmi.RmiServiceExporter.prepare(RmiServiceExporter.java:233)
 at org.springframework.remoting.rmi.RmiServiceExporter.afterPropertiesSet(RmiServiceExporter.java:197)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1062)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1029)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:420)
 at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)
 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141)
 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)
 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:156)
 at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:290)
 at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:348)
 at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:156)
 at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
 at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)
 at org.springframework.web.context.ContextLoaderServlet.init(ContextLoaderServlet.java:83)
 at javax.servlet.GenericServlet.init(GenericServlet.java:211)
 at com.caucho.server.http.Application.createServlet(Application.java:3114)
 at com.caucho.server.http.Application.loadServlet(Application.java:3065)
 at com.caucho.server.http.Application.initServlets(Application.java:1923)
 at com.caucho.server.http.Application.init(Application.java:1849)
 at com.caucho.server.http.VirtualHost.init(VirtualHost.java:728)
 at com.caucho.server.http.ServletServer.initHosts(ServletServer.java:887)
 at com.caucho.server.http.ServletServer.initInternal(ServletServer.java:729)
 at com.caucho.server.http.ServletServer.init(ServletServer.java:538)
 at com.caucho.server.http.ResinServer.init(ResinServer.java:415)
 at com.caucho.server.http.ResinServer.main(ResinServer.java:1176)
 at com.caucho.server.http.HttpServer.main(HttpServer.java:103)

后来经过仔细对比,发现两台Linux主机的host配置文件(/etc/hosts)不一致,出问题的机器存在一条不存在的host转向,最后删掉这条host记录,再次重启有问题的Web服务器,很顺利地就启动了Rmi服务,客户端调用也很成功!!

至此问题得到解决:)

标签: java   rmi   程序开发  
评论: Java Rmi 常见错误(一)
2008-03-04 18:20:45
2008-03-05 10:22:31
2008-03-06 11:37:33
2008-09-02 15:41:07
?
发表我的评论
粗体 斜体 下划线 插入超链接 插入表情
Email:
密 码:

验证码:





(请输入图中数字)   看不清,换一个试试
提示
  • 1.遵守国家有关法律、法规,尊重网上道德
  • 2.承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 3.互动维客留言板管理人员有权保留或删除其管辖留言中的任意内容

关于我们| 新闻中心| 服务条款| 联系我们| 招聘信息| 合作伙伴| 站点地图| About us| 奥运知识比拼

Copyright © 2005-2008 Hoodong.com Ltd. All Rights Reserved. 互动在线 版权所有 京ICP证060907号