JBoss Community

Use plain @EJB for remote EJB lookup?

created by Mikal Henriksen in JNDI and Naming - View the full discussion

I've been using the guide at https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+server+instance 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?

 

I know I could create a helper class and use InitialContext.lookup, or alias each bean I plan to use in xml (I forget which one), but I want to be sure there isn't an easier, cleaner way to do this.

Reply to this message by going to Community

Start a new discussion in JNDI and Naming at Community