tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Russo <jru...@genscape.com>
Subject Re: Outbound resource injection in an ejb
Date Fri, 15 Jan 2010 23:20:57 GMT
One more question regarding this.  I've configured my outbound jms
resource through the ra.xml configuration, and I can successfully inject
the connectionfactory into my ejb using a @Resource annotation.
However, when I try inject the destination, it doesn't inject the remote
destination, but instead appears to attempt to inject a local
destination of the same name and I get the following error in my ejb:

SEVERE: Invalid or foreigndestination

So it appears that instead of using the jndi properties of the
connection factory to find the destination, it does a local lookup.  Is
there something special I need to do to make the destination injection
work?



Jason Russo

Application Developer

Genscape– See the Energy

445 E. Market St, Suite 200

Louisville, KY 40202

Tel: 502-583-2091

www.genscape.com



On Thu, 2010-01-14 at 10:27 -0500, Jason Russo wrote:

> Let me see if I have this straight.  What goes in the openejb.base/lib
> folder is the rar file, or the jar that normally is wrapped by the
> adapter rar?  And I would need to add a service-jar.xml file into the
> META-INF folder of which package?  In other words, is the resulting
> structure like:
> 
> openejb.home/lib/adapter.jar
>                                     '-->/META-INF
>                                               '-->service-jar.xml
>                                     '-->/classes
>                                               '-->*.class
> 
> or
> 
> openejb.home/lib/adapter.rar
>                                     '-->/META-INF
>                                               '-->service-jar.xml
>                                               '-->ra.xml
>                                     '-->adapter.jar
> ?
> 
> However it works, I like this idea because it allows configuration at
> the container level.  It's something worth looking into if time
> constraints don't limit my ability to research this more. 
> 
> Regarding your first suggestion, however, if I do define configuration
> properties in the ra.xml file for the outbound resource, it sounds like
> I would only be able to define one outbound resource (destination) per
> adapter.  So, my question here is: can I define multiple jms
> destinations in an ear package using just one adapter?  If not, would I
> be able to install multiple adapters in an ear to define more than one
> jms destination?  I hate to say the more I learn the more questions I
> have. :)
> 
> 
> 
> Jason Russo
> 
> Application Developer
> 
> Genscape– See the Energy
> 
> 445 E. Market St, Suite 200
> 
> Louisville, KY 40202
> 
> Tel: 502-583-2091
> 
> www.genscape.com
> 
> 
> 
> On Wed, 2010-01-13 at 19:35 -0500, David Blevins wrote:
> 
> > On Jan 13, 2010, at 11:12 PM, Jason Russo wrote:
> > 
> > > Hi all,
> > >
> > > Previously, I created a message driven bean that can connect to a jms
> > > queue through an external provider (Tibco) using a jca resource  
> > > adapter.
> > > What I am trying to figure out is how I can write an ejb that can  
> > > post a
> > > message to this external queue.  Does openejb support the injection of
> > > such a resource and how can it be configured?  Thanks.
> > 
> > Anything declared as an outbound resource in the ra.xml should just be  
> > injectable via plain old @Resource.  The configuration in the ra.xml  
> > is what will be used, unless... and I wish there was an easier way to  
> > set this up, but...
> > 
> > You *can* just unzip all your resource adapter jars into the  
> > openejb.base/lib/ directory and install it as an OpenEJB service by  
> > giving it a service-jar.xml file.  Essentially, this is what we are  
> > doing under the covers anyway when you put your rar file in the ear.   
> > I wish we had some syntactic sugar for this but we don't.  I looked  
> > into it a bit ago and just didn't have time to finish.
> > 
> > The end result of rewrapping your rar with a service-jar.xml is that  
> > you can declare and configure the MDB container, the resource adapter,  
> > and outbound resources in the openejb.xml via <Container> and  
> > <Resource> tags.
> > 
> > Basically, you pack META-INF/service-jar.xml file into jar and put it  
> > into the openejb.base/lib/ directory.  It's not well documented as it  
> > isn't quite intended for typical use, but it did come up recently and  
> > there are some details available here:
> > 
> >   http://n4.nabble.com/How-do-I-configure-an-alternate-transaction-manager-tp980158p980159.html
> > 
> > Here is the service-jar.xml that contains the declarations for the  
> > ActiveMQ resource adapter and outbound resources:
> > 
> >    http://svn.apache.org/repos/asf/openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb.embedded/service-jar.xml
> > 
> > 
> > -David
> > 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message