tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <>
Subject Re: Using @EJB/@Inject to lookup on remote interface running on separate standalone OpenEJB server
Date Tue, 26 Jun 2012 22:47:49 GMT

On Jun 26, 2012, at 2:28 PM, exabrial wrote:

> Here's a followup question: So, normally, I'd just put @EJB, but the example
> says  @EJB(mappedName = "jndi:ext://shoe/OrangeBeanRemote") I imagine
> "jndi:ext://" is necessary to tell TomEE to go somewhere else other than
> it's own jndi tree.


> Is there away around that so just plain @EJB would work? I want to be able
> to develop with the EJBs in TomEE, but in prod, I want a large cluster of
> OpenEJB servers. It seems like I should be able to set my prod default
> <JndiProvider> to point externally...

Got it.  My brain is spinning on what would be the least PITA.  There are options, but not
sure they would pass my personal level of laziness :)

Ignoring that for the moment here are some options:

You can set the MappedName for the @EJB ref via an ejb-jar.xml or web.xml rather than in code.
 For each potentially-external EJB you'd create **named** @EJB reference like so:

    private Orange orange;

Then in the web.xml you can override that exact reference like so:


From there you could come up with some clever technique to swap out the web.xml with one for
production and one for development.

The name is significant as per spec the name defaults to including the class name of the object
which has the @EJB reference, such as:


    public class Widget {
        private Orange orange;

This would default to a name of ""  which means a lot of work
when overriding as every class which references Orange would have its own unique reference
and then require its own override.

> I tried to find more information about this on this page:
> but JndiProvider
> isn't mentioned :( The source for JndiProvider shows three properties: id,
> type, provider but I can't find any info about those either.

Needs to be better documented.  The "external EJB refs" feature was actually only just added.
 It was there and decayed, but has recently been re-added with all the new people and feature
requests due to TomEE.

> I'll keep digging, but any help or ideas appreciated. I'm definitely going
> to add this to the wiki when i'm done.

Happy to shovel information over if it means better docs :)  That's the primary goal of the
website editing features we added to the CMS this weekend -- to be able to work together on
docs in situations like this.


View raw message