RMI 的 报错

wx1234567 2008-08-19 12:11:27
结构是这样的

public interface A extends Remote {....}

public class B implements a{

public boolean rebindOnce()
{
....
try
{
Naming.rebind(xxx,this);
}catch(...)
{
logger.error(e.toString);
}

....
}

}

tomcat rmiregistry都启动了
日志里报rebind for xxxx error: error marshalling arguments; nested exception is:
java.io.NotSerializableException: B

怎么回事?
...全文
57 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
用RMI传递的对象,都要 implements Serializable
mayuanfei 2008-08-19
  • 打赏
  • 举报
回复
楼上说的对,必须要实现序列化Serializable.
你把B类改成如下 :
public class B implements a , Serializable { }

62,615

社区成员

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

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