I have 2 remote interfaces, say Example.java
and RealExample.java
. My bean Bean.java
is implementing those 2 remote interfaces.
According to the EJB 3.0 spec we can implement 2 remote interfaces in a single bean开发者_StackOverflow中文版. My first interface is in a.jar
and the other interface is in b.jar
.
How can I make sure that the respective stubs are generated in aclient.jar
and bClient.jar
. I dont want my stubs to be in single jar.
Yes, EJB 3 can implement two remote interfaces. How stubs are generated and in which JARs the stubs are placed is beyond the scope of the EJB specification: it is vendor specific.
I can say that the WebSphere Application Server createEJBStubs tool will generate stubs in the same JAR as the interfaces themselves.
Since the addition of dynamic proxies in the JDK and dynamic RMI-IIOP (2006), modern application servers do not require the ancient concept of manually generating stubs (let alone the even older concept of skeletons).
E.g. for at least JBoss AS 4.x+, Glassfish and partially WebSphere 7 all you need to include in your client jars are the interfaces. Nothing else is needed. (Unfortunately, for some unknown reason WebSphere only implements this relatively simple feature partially, so if you're using WebSphere and have a Java SE client, I feel your pain)
Btw, also note that the proxy that you retrieve from the remote server can be directly casted to the interface. No PortableRemoteObject
(another ancient concept) or anything like it is needed.
精彩评论