users@glassfish.java.net

Re: Howto access ejb in other ear in the same/different domain?

From: <glassfish_at_javadesktop.org>
Date: Mon, 14 Jun 2010 07:34:06 PDT

Because they are in different ears this will be a "remote" ejb call. You can still use the @EJB but you will need to specify some configuration. definitely read https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html in detail


for A.ear to make the call to B.ear from a design consideration recommend: (assuming JEE5+)

1. create a jar which contains plain interfaces for the business methods in B-ejb. the remote interface for B-ejb can extend this. include this jar in both A.ear and B.ear. this way A.ear can be developed and compiled without and B.ear code.

2. in the deployment descriptor for A-ejb, A.ear or in the external JNDI resources of A's application server you can specify a the location of the B-ejb. ie. corbaname:iiop:<host>:<port>#<global_jndi_name>

3. when A-ejb looks up B-ejb it can cast to the interface in 1.
[Message sent by forum member 'radix_zero']

http://forums.java.net/jive/thread.jspa?messageID=474206