我是一个遗留系统,那里是一个偏僻豆已经变得过于庞大和单片上的工作,我想保持独立的新功能,我认为需要补充。拆分远程EJB功能的对象
我最初的想法是,而不是增加我的新方法,以现有的接口,创建我所有的东西一个新的接口并添加返回一个实现我的接口的远程对象的一个方法。
我现在面临的问题是,当我调用返回我的对象的方法,运行时尝试序列化它,而不是发送存根。
代码布局或多或少是这样的:
@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"
我知道我必须缺少的东西,应该是显而易见的...: -/
我看到了,我期待更多的“黑魔法”被执行在添加@Remote注释时引擎盖下。 – fortran 2011-03-01 14:55:07
我希望也是这样! :) – Renan 2011-03-01 22:29:54