用 ./shutdown.sh 关闭 rmi 服务器的 tomcat ,然后 ./startup.sh 启动,客户端连接总是会导致错误

wrn_str 2011-01-05 01:48:21
用 ./shutdown.sh 关闭 rmi 服务器的 tomcat ,然后 ./startup.sh 启动,客户端连接总是会导致如下错误:

org.springframework.remoting.RemoteLookupFailureException: Lookup of RMI stub failed; nested exception is java.rmi.UnmarshalException: error unmarshalling return; nested exception is: java.io.EOFException
com.ffcs.ieie.communicate.ieiemp.IeiempException: org.springframework.remoting.RemoteLookupFailureException: Lookup of RMI stub failed; nested exception is java.rmi.UnmarshalException: error unmarshalling return; nested exception is: java.io.EOFException

Tomcat作为服务器端,另外一台主机上作为客户端,当服务器多次重启后,客户端远程调用连接不上,在windows上没有出现这样的问题,请高手赐教!
服务器的代码为:try{
LocateRegistry.createRegistry(1099);
}catch(Exception e){
e.printStackTrace();
}

try{
// System.out.println(remoteName);
Naming.rebind(remoteName, (RemoteDataRefresh)this);
System.out.println("registry!!");
}catch(Exception e){
e.printStackTrace();
}

客户端代码为:try{
LocateRegistry.createRegistry(1099); //3
}catch(Exception e){
e.printStackTrace();
}

//new a service
createNewService();

/*comment following codes may lead to bug?*/
//for (int i = 0; i < ALPHABET.length(); i++) {
// dirs[i].close();
//}

//refresh remote retrievaler
try{
if (rdr==null)
rdr = (RemoteDataRefresh)Naming.lookup(rdrName);
rdr.reopenSearcher(serviceNo);
}catch(Exception e){
e.printStackTrace();
}
...全文
1338 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
wrn_str 2011-01-06
  • 打赏
  • 举报
回复
我的代码没有错,最终搞定,因为./shutdown.sh tomcat后 ,通过ps -ef | grep java 查看其实tomcat的进程还存在,并没有被关闭,如果再次打开tomcat后,又多了一个tomcat进程,多次重启tomcat,就有很多tomcat进程,而且之前的rmiregistry还存在内存中,就有多个rmiregistry,所以客户端获取远程对象时,就不知道获取哪个,乱套了,,所以在关闭tomcat后,先杀掉tomcat进程。
xchh1220 2011-01-05
  • 打赏
  • 举报
回复
http://yangwencan2002.javaeye.com/blog/284249
看看这个,好像是一样的问题的解决办法

23,408

社区成员

发帖
与我相关
我的任务
社区描述
Java 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧