【发布时间】:2011-03-01 10:02:13
【问题描述】:
我正在开发一个遗留系统,其中有一个远程 bean 变得太大且过于单一,我想将需要添加的新功能分开。
我最初的想法是,与其将我的新方法添加到现有接口,不如使用我的所有东西创建一个新接口,并添加一个返回实现我的接口的远程对象的方法。
我现在面临的问题是,当我调用返回对象的方法时,运行时会尝试序列化它而不是发送存根。
代码布局大致是这样的:
@Stateless
public class OldBean implements OldRemoteInterface {
//lots of the old unrelated methods here
public MyNewStuff getMyNewStuff() {
return new MyNewStuff();
}
}
@Remote
public interface OldRemoteInterface {
//lots of the old unrelated methods declared here
MyNewStuff getMyNewStuff();
}
public class MyNewStuff implements NewRemoteInterface {
//methods implemented here
}
@Remote
public interface NewRemoteInterface {
//new methods declared here
}
我得到的例外是:
"IOP00810267: (MARSHAL) An instance of class MyNewStuff could not be marshalled:
the class is not an instance of java.io.Serializable"
我尝试过“旧方式”,扩展java.rmi.Remote 接口而不是使用ejb @Remote 注释,我得到的例外是:
"IOP00511403: (INV_OBJREF) Class MyNewStuff not exported, or else is actually
a JRMP stub"
我知道我一定遗漏了一些应该很明显的东西...:-/
【问题讨论】:
标签: java jakarta-ee ejb-3.0 remoting