constantlearner
constantlearner

Reputation: 5247

EJB 3 can implement 2 remote interfaces?

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. 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.

Upvotes: 4

Views: 1857

Answers (2)

Arjan Tijms
Arjan Tijms

Reputation: 38163

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.

Upvotes: 3

Brett Kail
Brett Kail

Reputation: 33936

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.

Upvotes: 3

Related Questions