jaikiran pai [
https://community.jboss.org/people/jaikiran] created the discussion
"Re: Use plain @EJB for remote EJB lookup?"
To view the discussion, visit:
https://community.jboss.org/message/820335#820335
--------------------------------------------------------------
Mikal, welcome to the forums.
Mikal Henriksen wrote:
I've been using the guide at
https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+...
https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+...
to make a standalone war that uses beans that are deployed in an ear running on a separate
AS. I got it working by using an explicit lookup name in the @EJB annotation, like this:
@EJB(lookup =
"ejb:earname/modulename/BeanClass!fully.qualified.RemoteInterface")
private RemoteInterface bean;
Writing this for all the remote EJBs is getting tedious, and refactoring with it is even
worse. Is there a way to tell the default context which app name and module name to use,
so that I can use plain @EJB annotations without parameters?
The server cannot guess what the appname, module name and bean name would be for
that target bean (which resides on a different server) to be. It's the user's
application which has that idea. One way to reduce the tediouness is to use the
ejb-jar.xml to set up the injection (ejb-jar xsd has the necessary details) such that you
can then use something like this in the ejb-jar.xml:
<lookup-name>${myfoo.bar.system.property}</lookup-name>
and set the system property (typically by passing
-D<system-property-name>=<system-property-value>) while launching the server.
Note that the system property replacement in deployment descriptors is a JBoss application
server specific features and may not be portable across different server vendors.
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/820335#820335]
Start a new discussion in JNDI and Naming at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]