Remote EJB return type

吃可爱长大的小学妹 提交于 2019-12-13 02:35:53

问题


I want to return an instance of a class I created, named User. Where should I put this class, so that my EJB can return it when I call a method? I mean, should I put it only in the interface project, or in the ejb module and in the war module?

Thanks


回答1:


You should have a copy of your custom object in both EJB folder, and in your war project, if you want to use concrete implementation. Nevertheless, you might have an interface in your .war, which EJB module method returns, and EJB nethod call would return a concrete instance of that interface. In this case you refer to concrete implementation by its interface. In case your EJB and war are on different machines, you should make your custom class Serializable.




回答2:


If you plan to run on JBoss AS 7 or Wildfly you should ensure that such classes do not appear in utility jars (interface jar) AND in a module, ie war or ejb jar. JBoss will throw an error when finding the class file in a library and a module.

So I'd recommend putting it only into the interface jar.



来源:https://stackoverflow.com/questions/23725196/remote-ejb-return-type

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!