You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Jason Russo <jr...@genscape.com> on 2010/01/13 23:12:37 UTC
Outbound resource injection in an ejb
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.
Jason Russo
Application Developer
Genscape– See the Energy
445 E. Market St, Suite 200
Louisville, KY 40202
Tel: 502-583-2091
www.genscape.com
Re: Outbound resource injection in an ejb
Posted by Jason Russo <jr...@genscape.com>.
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
> >
Re: resource adapter configuration for Sun JMSJCA sun-jms-adapter
Posted by lb <op...@lbreuss.ch>.
Hi Andy, thanks for your answer. I was fiddling around with further
configurations. The following is some of the closest I could get to. With
another config variant (which I am not able to reproduce right away), it
went past the Connection Factory, but tried to instantiate an ActiveMQ
Queue/Topic (removing the lib just provoked a NoClassDefFound).
Are there any obvious configuration mistakes I could fix to get a few steps
further to a working solution?
I love to develop JEE apps, but configuring a JEE solution is far from being
straigt forward. Hope this will change over time. Also, I don't understand
why JCA and JMS don't play toghether (in my case JMSJCA and OpenMQ (4.4)).
Aren't they compliant to their respective API? *shrug* But I don't fully
grasp the complexity under the hood yet anyway.
I'll give a try to Glassfish v3 in embedded mode as well. In theory, should
integrate well with JMSJCA and OpenMQ, all Sun products...
regards, Leo
============================================================
=== stdout
DEBUG - Using default 'openejb.nobanner=true'
Apache OpenEJB 3.1.3 build: 20101015-05:42
http://openejb.apache.org/
INFO - openejb.home = C:\APPL\Tools\NetBeansProjects\TestOpenEJB
INFO - openejb.base = C:\APPL\Tools\NetBeansProjects\TestOpenEJB
DEBUG - Using default
'openejb.assembler=org.apache.openejb.assembler.classic.Assembler'
DEBUG - Instantiating assembler class
org.apache.openejb.assembler.classic.Assembler
DEBUG - Using default 'openejb.jndiname.failoncollision=true'
DEBUG - Using default
'openejb.configurator=org.apache.openejb.config.ConfigurationFactory'
DEBUG - Using default 'openejb.validation.skip=false'
DEBUG - Using default 'openejb.deploymentId.format={ejbName}'
DEBUG - Using default 'openejb.debuggable-vm-hackery=false'
DEBUG - Using default 'openejb.webservices.enabled=true'
DEBUG - Using default 'openejb.vendor.config=ALL' Possible values are:
geronimo, glassfish, jboss, weblogic or NONE or ALL
DEBUG - Using default 'openejb.provider.default=org.apache.openejb.embedded'
INFO - Configuring Service(id=Default Security Service,
type=SecurityService, provider-id=Default Security Service)
INFO - Configuring Service(id=Default Transaction Manager,
type=TransactionManager, provider-id=Default Transaction Manager)
INFO - Configuring Service(id=MyJmsjcaResourceAdapter, type=Resource,
provider-id=JmsjcaResourceAdapter)
DEBUG - [ConnectionURL=mq://localhost:7676]
DEBUG - [UserName=info]
DEBUG - [Password=<hidden>]
INFO - Configuring Service(id=jms/tx/vaiqm, type=Resource,
provider-id=OpenMQConnectionFactory)
INFO - Configuring Service(id=jms/queErrAll_02, type=Resource,
provider-id=OpenMQQueue)
INFO - Configuring Service(id=jms/topRoutingRefresh, type=Resource,
provider-id=OpenMQTopic)
INFO - Configuring Service(id=sun-jms-adapter, type=Container,
provider-id=Default MDB Container)
DEBUG - [ResourceAdapter=MyJmsjcaResourceAdapter]
DEBUG - [MessageListenerInterface=javax.jms.MessageListener]
DEBUG -
[ActivationSpecClass=com.stc.jmsjca.unifiedjms.RAUnifiedActivationSpec]
DEBUG - Using default 'openejb.deployments.classpath=true'
DEBUG - Using default 'openejb.deployments.classpath.include='
DEBUG - Using default 'openejb.deployments.classpath.exclude=.*'
DEBUG - Using default
'openejb.deployments.classpath.require.descriptor=client' Possible values
are: ejb, client or NONE or ALL
DEBUG - Using default
'openejb.deployments.classpath.filter.descriptors=false'
DEBUG - Using default 'openejb.deployments.classpath.filter.systemapps=true'
DEBUG - Inspecting classpath for applications: 0 urls.
INFO - Found EjbModule in classpath:
C:\APPL\Tools\NetBeansProjects\TestOpenEJB\build\jar
INFO - Found ConnectorModule in classpath:
C:\APPL\Tools\NetBeansProjects\NetbeansSharedLibraries\6.7\openejb-3.1.3\lib\sun-jms-adapter-with-service.jar
DEBUG - URLs after filtering: 094
...
DEBUG - Using default 'openejb.deployments.classpath.ear=true'
INFO - Beginning load: C:\APPL\Tools\NetBeansProjects\TestOpenEJB\build\jar
DEBUG - Using default 'openejb.tempclassloader.skip=none' Possible values
are: none, annotations, enums or NONE or ALL
DEBUG - Using default 'openejb.tempclassloader.skip=none' Possible values
are: none, annotations, enums or NONE or ALL
INFO - Beginning load:
C:\APPL\Tools\NetBeansProjects\NetbeansSharedLibraries\6.7\openejb-3.1.3\lib\sun-jms-adapter-with-service.jar
DEBUG - Using default 'openejb.tempclassloader.skip=none' Possible values
are: none, annotations, enums or NONE or ALL
DEBUG - Using default 'openejb.tempclassloader.skip=none' Possible values
are: none, annotations, enums or NONE or ALL
INFO - Configuring enterprise application: classpath.ear
DEBUG - Searching for inherited application exceptions (see OPENEJB-980) -
it doesn't care whether inherited is true/false
INFO - Auto-configuring a message driven bean
ch.lb.test.openejb.MyOpenEJBTestBean destination
ch.lb.test.openejb.MyOpenEJBTestBean to be destinationType javax.jms.Queue
INFO - Auto-linking resource-ref
'ch.lb.test.openejb.MyOpenEJBTestBean/myQMConnectionFactory' in bean
ch.lb.test.openejb.MyOpenEJBTestBean to Resource(id=jms/tx/vaiqm)
INFO - Auto-linking resource-env-ref
'ch.lb.test.openejb.MyOpenEJBTestBean/myQueue' in bean
ch.lb.test.openejb.MyOpenEJBTestBean to Resource(id=jms/queErrAll_02)
DEBUG - No existing resource found while attempting to Auto-link unmapped
resource-env-ref 'ch.lb.test.openejb.MyOpenEJBTestBean' of type
'javax.jms.Queue' for 'ch.lb.test.openejb.MyOpenEJBTestBean'. Looked for
Resource(id=ch.lb.test.openejb.MyOpenEJBTestBean)
INFO - Configuring Service(id=ch.lb.test.openejb.MyOpenEJBTestBean,
type=Resource, provider-id=Default Queue)
DEBUG - [destination=ch.lb.test.openejb.MyOpenEJBTestBean]
INFO - Auto-creating a Resource with id
'ch.lb.test.openejb.MyOpenEJBTestBean' of type 'javax.jms.Queue for
'ch.lb.test.openejb.MyOpenEJBTestBean'.
INFO - Configuring Service(id=Default Stateless Container, type=Container,
provider-id=Default Stateless Container)
INFO - Auto-creating a container for bean MyEJBBean:
Container(type=STATELESS, id=Default Stateless Container)
INFO - Using 'openejb.descriptors.output=true'
INFO - Using 'openejb.descriptors.output=true'
INFO - Dumping Generated ejb-jar.xml to:
C:\DOCUME~1\vb819\LOCALS~1\Temp\ejb-jar-1069999983200656017jar.xml
INFO - Dumping Generated openejb-jar.xml to:
C:\DOCUME~1\vb819\LOCALS~1\Temp\openejb-jar-998228876795163731jar.xml
INFO - Configuring Service(id=sun-jms-adapter-with-service.jarRA,
type=Resource, provider-id=sun-jms-adapter-with-service.jarRA)
DEBUG - [TransformerMBeanName=]
DEBUG - [Options=]
DEBUG - [MBeanServerDomain=]
DEBUG - [Password=<hidden>]
DEBUG - [ConnectionURL=]
DEBUG - [UserName=]
DEBUG - [MBeanObjectName=]
INFO - Configuring
Service(id=sun-jms-adapter-with-service.jar-javax.jms.ConnectionFactory,
type=Resource,
provider-id=sun-jms-adapter-with-service.jar-javax.jms.ConnectionFactory)
DEBUG - [TransactionSupport=xa]
DEBUG - [ResourceAdapter=sun-jms-adapter-with-service.jarRA]
INFO - Configuring
Service(id=sun-jms-adapter-with-service.jar-javax.jms.QueueConnectionFactory,
type=Resource,
provider-id=sun-jms-adapter-with-service.jar-javax.jms.QueueConnectionFactory)
DEBUG - [TransactionSupport=xa]
DEBUG - [ProducerPooling=true]
DEBUG - [ResourceAdapter=sun-jms-adapter-with-service.jarRA]
INFO - Configuring
Service(id=sun-jms-adapter-with-service.jar-javax.jms.TopicConnectionFactory,
type=Resource,
provider-id=sun-jms-adapter-with-service.jar-javax.jms.TopicConnectionFactory)
DEBUG - [TransactionSupport=xa]
DEBUG - [ProducerPooling=true]
DEBUG - [ResourceAdapter=sun-jms-adapter-with-service.jarRA]
INFO - Configuring Service(id=sun-jms-adapter-with-service.jar,
type=Container, provider-id=Default MDB Container)
DEBUG -
[ActivationSpecClass=com.stc.jmsjca.unifiedjms.RAUnifiedActivationSpec]
DEBUG - [MessageListenerInterface=javax.jms.MessageListener]
DEBUG - [ResourceAdapter=sun-jms-adapter-with-service.jarRA]
INFO - Configuring
Service(id=sun-jms-adapter-with-service.jar-javax.jms.Queue, type=Resource,
provider-id=sun-jms-adapter-with-service.jar-javax.jms.Queue)
INFO - Configuring
Service(id=sun-jms-adapter-with-service.jar-javax.jms.Topic, type=Resource,
provider-id=sun-jms-adapter-with-service.jar-javax.jms.Topic)
INFO - Using 'openejb.validation.output.level=VERBOSE'
INFO - Enterprise application "classpath.ear" loaded.
DEBUG - Starting ResourceAdapter(id=MyJmsjcaResourceAdapter)
FATAL - OpenEJB has encountered a fatal error and cannot be started:
Assembler failed to build the container system.
org.apache.openejb.OpenEJBException: "Resource adapter defined with id {0}
is not an instance of ResourceAdapter, but is an instance of class
org.apache.openejb.core.ivm.naming.IvmContext
at
org.apache.openejb.assembler.classic.Assembler.replaceResourceAdapterProperty(Assembler.java:1095)
at
org.apache.openejb.assembler.classic.Assembler.createResource(Assembler.java:1106)
at
org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:357)
at
org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:280)
============================================================
=== openejb.xml
<?xml version="1.0" encoding="UTF-8"?>
<openejb>
<!-- see http://openejb.apache.org/3.0/containers-and-resources.html -->
<!-- see http://activemq.apache.org/activation-spec-properties.html -->
<!-- see http://openejb.apache.org/3.0/jms-resources-and-mdb-container.html
-->
<!-- Note: a resource-adapter-mid is a Container in OpenEJB -->
<!-- Working config. Don't touch! -->
<Container id="sun-jms-adapter" ctype="MESSAGE">
ResourceAdapter = MyJmsjcaResourceAdapter
MessageListenerInterface=javax.jms.MessageListener
ActivationSpecClass=com.stc.jmsjca.unifiedjms.RAUnifiedActivationSpec
</Container>
<Resource id="MyJmsjcaResourceAdapter"
type="ResourceAdapter"
provider="com.stc.jmsjca.unifiedjms#JmsjcaResourceAdapter"
jar="sun-jms-adapter-with-service.jar">
ConnectionURL = mq://localhost:7676
UserName info
Password none
</Resource>
<!-- http://openejb.apache.org/3.0/jms-resources-and-mdb-container.html
// http://activemq.apache.org/connection-factory-properties.html
// Why does the first page mention a property ResourceAdapter but the
second one
// does not list it? It also does not work with (sun-jms-adapter and)
OpenMQ. -->
<Resource id="jms/tx/vaiqm"
provider="com.stc.jmsjca.unifiedjms#OpenMQConnectionFactory"
type="javax.jms.ConnectionFactory">
# Discrepancy:
# http://openejb.apache.org/3.0/jms-resources-and-mdb-container.html
# http://activemq.apache.org/connection-factory-properties.html
# Why does the first page mention a property ResourceAdapter for
the
# ConnectionFactory but the second one does not list it?
# OpenEJB also warns with (sun-jms-adapter RA and) OpenMQ.
#ResourceAdapter = MyJmsjcaResourceAdapter
</Resource>
<!-- END of Working config. Don't touch! -->
<Resource id="jms/queErrAll_02"
provider="com.stc.jmsjca.unifiedjms#OpenMQQueue"
type="javax.jms.Queue">
#destination=queErrAll_02
# provider="com.stc.jmsjca.unifiedjms#OpenMQQueue"
</Resource>
<Resource id="jms/topRoutingRefresh"
provider="com.stc.jmsjca.unifiedjms#OpenMQTopic"
type="javax.jms.Topic">
#destination=topRoutingRefresh
</Resource>
<!-- -->
</openejb>
============================================================
=== service-jar.xml
=== META-INF\com.stc.jmsjca.unifiedjms/service-jar.xml, in repackaged
sun-jms-adapter.rar now named sun-jms-adapter-with-service.jar
<?xml version="1.0" encoding="UTF-8"?>
<ServiceJar>
<ServiceProvider
id="JmsjcaResourceAdapter"
service="Resource"
types="RAUnifiedResourceAdapter,
com.stc.jmsjca.unifiedjms.RAUnifiedResourceAdapter,
javax.resource.spi.ResourceAdapter, ResourceAdapter"
class-name="com.stc.jmsjca.unifiedjms.RAUnifiedResourceAdapter">
## types: What are allowed types?
# types="ResourceAdapter, javax.resource.spi.ResourceAdapter,
RAUnifiedResourceAdapter" ## ???
# class-name="com.stc.jmsjca.unifiedjms.RAUnifiedResourceAdapter"
# from ra.xml
# Properties copied from ra.xml
ConnectionURL
UserName
Password
MBeanObjectName
MBeanServerDomain
Options
TransformerMBeanName
</ServiceProvider>
<!-- configure for OpenMQ JMS Provider -->
<ServiceProvider
id="OpenMQConnectionFactory"
service="Resource"
types="javax.jms.ConnectionFactory,
javax.jms.QueueConnectionFactory, javax.jms.TopicConnectionFactory,
QueueConnectionFactory, TopicConnectionFactory"
class-name="com.sun.messaging.XAConnectionFactory">
ResourceAdapter
# ResourceAdapter JmsjcaResourceAdapter
</ServiceProvider>
<ServiceProvider
id="OpenMQQueue"
service="Resource"
types="javax.jms.Queue, Queue"
class-name="com.sun.messaging.Queue">
</ServiceProvider>
<ServiceProvider
id="OpenMQTopic"
service="Resource"
types="javax.jms.Topic, Topic"
class-name="com.sun.messaging.Topic">
</ServiceProvider>
</ServiceJar>
--
View this message in context: http://openejb.979440.n4.nabble.com/Outbound-resource-injection-in-an-ejb-tp1013402p3055360.html
Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: resource adapter configuration for Sun JMSJCA sun-jms-adapter
Posted by Andy <an...@orprovision.com>.
On 17.11.2010 16:41, lb wrote:
> I'm also interested in how to setup the resource adapter - Struggling with
> kicking out default ActiveMQ and successfully referencing the Sun JMSJCA
> Resource Adapter.
In the current implementation I don't think this is possible 'out of the box'. OpenEJB is bound to ActiveMQ at the
moment, but with the option of using 4.x or 5.x.
The code is more or less in place to create a portable solution, but has not yet been implemented. I'd like to follow
through on this as I am also interested in trying other MQ's. The only problem is really finding the time to get this
done - I have worked a fair bit on the OpenEJB/ActiveMQ RA, but at work I am currently in the middle/end of a sizeable
project and am finding it difficult to invest time outside. Also, OpenEJB (trunk) is working like a charm for me at the
moment (in a high load environment) so I don't really have much pressure to hack this. Keep nudging me though, as I am
bound to crack under pressure!
However, back-end aside, the JMS (EJB side) front end is the defined and expected standard. It is safe to develop your
solution using OpenEJB as long as you stick to the JMS API. Support for other MQ's will come in time.
All that said, and I have not tried this so no idea if it will work, try removing all ActiveMQ libraries from the
classpath (OpenEJB/lib) to prevent it being loaded.
Andy.
Re: resource adapter configuration for Sun JMSJCA sun-jms-adapter
Posted by lb <op...@lbreuss.ch>.
I'm also interested in how to setup the resource adapter - Struggling with
kicking out default ActiveMQ and successfully referencing the Sun JMSJCA
Resource Adapter.
My JUnit test uses OpenEJB in embedded mode. A subsequently injected EJB
from a another library .jar references the JMSJCA sun-jms-adapter in its
deployment descriptor, with activation spec settings that ActiveMQ chokes
about, so I would like to configure this same resource adapter with OpenEJB
to avoid tampering with the lib or overriding countless deployment
descriptors. I have the sun-jms-adapter.rar file and a remote QM on a
Glassfish server (though I'll later try to setup an embedded broker behind
the resource adapter for unit testing). How do I proceed from here?
Plain openejb.xml did not work. So I tried to follow this thread and set up
a service-jar.xml within the repacked JMSJCA resource adapter (from
GlassFishESBv22\glassfish\addons\openesb_addons\jmsjca\sun-jms-adapter.rar).
See the configuration files below.
Why does OpenEJB still want to load ActiveMQ? Thanks for having a look at
it.
Current Error message is:
------------------------------------------------
...
INFO - Enterprise application "classpath.ear" loaded.
DEBUG - Starting ResourceAdapter(id=MyJmsResourceAdapter)
ERROR - FATAL ERROR: Unknown error in Assembler. Please send the following
stack trace and this message to users@openejb.apache.org :
org.apache.xbean.recipe.ConstructionException: Error setting property:
public void
org.apache.activemq.ra.ActiveMQManagedConnectionFactory.setResourceAdapter(javax.resource.spi.ResourceAdapter)
throws javax.resource.ResourceException
at
org.apache.xbean.recipe.ObjectRecipe.setProperty(ObjectRecipe.java:521)
...
FATAL - OpenEJB has encountered a fatal error and cannot be started:
Assembler failed to build the container system.
org.apache.openejb.OpenEJBException:
org.apache.xbean.recipe.ConstructionException:
Error setting property: public void
org.apache.activemq.ra.ActiveMQManagedConnectionFactory.setResourceAdapter(javax.resource.spi.ResourceAdapter)
throws javax.resource.ResourceException
The classpath configured in Netbeans 6.7.1 includes in order:
- some Glassfish 2.1 libraries
- .../sun-jms-adapter-with-services.jar
- SunMQ_4.4 jars (imq.jar etc., com.sun.messaging.*, this should be my JMS
provider.)
- OpenEJB 3.1.3 libraries (including the ActiveMQ libs)
==================================================================================
openejb.base/lib/sun-jms-adapter-with-services.jar
+--- /META-INF/com.stc.jmsjca.unifiedjms/service-jar.xml
+--- \com\stc\jmsjca\
+--- unifiedjms\
+--- core\
+--- ...
==================================================================================
== service-jar.xml:
<?xml version="1.0" encoding="UTF-8"?>
<ServiceJar>
<ServiceProvider
id="sun-jms-adapter" service="Container" types="MESSAGE"
constructor="id, securityService, ResourceAdapter,
MessageListenerInterface, ActivationSpecClass, InstanceLimit"
class-name="org.apache.openejb.core.mdb.MdbContainer">
ResourceAdapter JmsjcaResourceAdapter
MessageListenerInterface javax.jms.MessageListener
ActivationSpecClass com.stc.jmsjca.unifiedjms.RAUnifiedActivationSpec
InstanceLimit 10
</ServiceProvider>
<ServiceProvider
id="JmsjcaResourceAdapter" service="Resource"
types="ResourceAdapter, javax.resource.spi.ResourceAdapter,
RAUnifiedResourceAdapter"
class-name="com.stc.jmsjca.unifiedjms.RAUnifiedResourceAdapter">
## types: What are allowed types?
# types="ActiveMQResourceAdapter" <=== we don't want this one.
# types="javax.resource.spi.ResourceAdapter"
# types="RAUnifiedResourceAdapter"
# types="ResourceAdapter, javax.resource.spi.ResourceAdapter,
RAUnifiedResourceAdapter" # ???
# class-name="com.stc.jmsjca.unifiedjms.ResourceAdapter"
# ??
# class-name="com.stc.jmsjca.unifiedjms.RAUnifiedResourceAdapter"
# from ra.xml
UserName guest
Password argh
ConnectionURL mq://dvai1mq01.vt.ch:7679
## there is a Glassfish QM at this address. Once we are able to start
the container...
</ServiceProvider>
<ServiceProvider
id="JmsjcaConnectionFactory" service="Resource"
types="javax.jms.ConnectionFactory,
javax.jms.QueueConnectionFactory, javax.jms.TopicConnectionFactory,
QueueConnectionFactory, TopicConnectionFactory"
class-name="com.sun.messaging.jmq.jmsclient.JMSXAQueueConnectionImpl">
#class-name: com.sun.messaging.jmq.jmsclient.JMSXAQueueConnectionImpl
## I think this is the best match
ResourceAdapter JmsjcaResourceAdapter
# Specifies if the connection is enrolled in global transaction, allowed
values: xa, local or none
TransactionSupport xa
PoolMaxSize 10
PoolMinSize 0
ConnectionMaxWaitMilliseconds 5000
ConnectionMaxIdleMinutes 15
</ServiceProvider>
<ServiceProvider
id="Default Queue" service="Resource"
types="javax.jms.Queue, Queue"
constructor="destination"
class-name="com.sun.messaging.Queue">
destination
</ServiceProvider>
</ServiceJar>
==================================================================================
== openejb.xml:
<Container id="sun-jms-adapter" ctype="MESSAGE">
ResourceAdapter = MyJmsResourceAdapter
MessageListenerInterface=javax.jms.MessageListener
ActivationSpecClass=com.stc.jmsjca.unifiedjms.RAUnifiedActivationSpec
</Container>
<Resource id="MyJmsResourceAdapter"
type="RAUnifiedResourceAdapter"
provider="com.stc.jmsjca.unifiedjms#JmsjcaResourceAdapter"
jar="sun-jms-adapter-with-service.jar">
## provider: lookup in directory
"com.stc.jmsjca.unifiedjms", file service-jar.xml, for ServiceProvider with
id "JmsjcaResourceAdapter"
UserName info
Password none
ConnectionURL=mq://dvai1mq01.vt.ch:7679
</Resource>
<Resource id="MyJmsConnectionFactory"
type="javax.jms.ConnectionFactory">
ResourceAdapter = MyJmsResourceAdapter
</Resource>
<Resource id="MyQueueConnectionFactory"
type="javax.jms.QueueConnectionFactory">
ResourceAdapter = MyJmsResourceAdapter
</Resource>
==================================================================================
== sun-ejb-jar.xml of deployment descriptor of dependent EJBs and of this
EJB.
-- They reference "sun-jms-adapter". OpenEJB can be satisfied if a Container
"sun-jms-adapter" is defined.
<sun-ejb-jar>
<enterprise-beans>
<ejb>
<ejb-name>ch.lb.errorhandling.ErrorHandlingBean</ejb-name>
<mdb-resource-adapter>
<resource-adapter-mid>sun-jms-adapter</resource-adapter-mid>
</mdb-resource-adapter>
<bean-pool></bean-pool>
</ejb>
</enterprise-beans>
</sun-ejb-jar>
--
View this message in context: http://openejb.979440.n4.nabble.com/Outbound-resource-injection-in-an-ejb-tp1013402p3046994.html
Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: Outbound resource injection in an ejb
Posted by David Blevins <da...@visi.com>.
On Jan 29, 2010, at 3:21 PM, Jason Russo wrote:
> That sounds pretty neat. I did not modify any of the resource adapter
> code. What I did was add this file
> as /META-INF/com.sun.genericra/service-jar.xml inside the adapter jar,
> and drop that library into the container lib folder along with the jms
> client libraries needed for the jms provider(s).
>
> So, who shall I send my service-jar.xml to, and how? Do you want me
> to
> submit it to this mailing list, or the dev list, check it in somehow,
> other details? This would be the first contribution I've provided to
> the openejb community, so I'm not sure what the procedures would be.
>
> One thing I'd like to mention is, when I was first using this with
> Tibco, I had defined some properties in the service-jar.xml that
> needed
> to be null. It appears, however, that if a property is defined in
> service-jar.xml and no value is assigned to it, openejb will auto
> assign
> an empty string value to them. This had caused some problems with
> Tibco, specifically with the client id property. When Tibco saw the
> client id as an empty string, I had issues with 'duplicate' client ids
> (all being empty strings). My solution was to remove the property
> from
> the service provider in the service-jar.xml file. I bring this up to
> make you aware of this possible pitfall, as other providers might also
> have issues with other properties. Not sure if I should just remove
> all
> properties from the service providers, and maybe allow them to be
> overridden in openejb.xml or not, but right now I just did this for
> the
> client id property.
>
> Anyways, let me know how to proceed with this contribution, and I will
> act accordingly.
Created a JIRA here where you can attach the service-jar.xml:
https://issues.apache.org/jira/browse/OPENEJB-1229
Good note on the null thing. Trick there is java.lang.Properties
doesn't allow null values. It's actually that same class that fills
in the empty string, IIRC.
One option would be to yank out all the empty string key/value pairs.
Not too sure how we'd want to design it, but it's theoretically
possible if we felt we needed it.
-David
Re: Outbound resource injection in an ejb
Posted by Jason Russo <jr...@genscape.com>.
That sounds pretty neat. I did not modify any of the resource adapter
code. What I did was add this file
as /META-INF/com.sun.genericra/service-jar.xml inside the adapter jar,
and drop that library into the container lib folder along with the jms
client libraries needed for the jms provider(s).
So, who shall I send my service-jar.xml to, and how? Do you want me to
submit it to this mailing list, or the dev list, check it in somehow,
other details? This would be the first contribution I've provided to
the openejb community, so I'm not sure what the procedures would be.
One thing I'd like to mention is, when I was first using this with
Tibco, I had defined some properties in the service-jar.xml that needed
to be null. It appears, however, that if a property is defined in
service-jar.xml and no value is assigned to it, openejb will auto assign
an empty string value to them. This had caused some problems with
Tibco, specifically with the client id property. When Tibco saw the
client id as an empty string, I had issues with 'duplicate' client ids
(all being empty strings). My solution was to remove the property from
the service provider in the service-jar.xml file. I bring this up to
make you aware of this possible pitfall, as other providers might also
have issues with other properties. Not sure if I should just remove all
properties from the service providers, and maybe allow them to be
overridden in openejb.xml or not, but right now I just did this for the
client id property.
Anyways, let me know how to proceed with this contribution, and I will
act accordingly.
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 Fri, 2010-01-29 at 05:43 -0500, David Blevins wrote:
> On Jan 26, 2010, at 3:37 PM, Jason Russo wrote:
>
> > I believe it is open source. See this page:
> >
> > https://genericjmsra.dev.java.net/docs/userguide/userguide.html
> >
> > If you want it, just let me know to who and where to send it. I can
> > contribute the jar alone, or, in addition, separately provide the
> > service-jar.xml and a sample openejb configuration that I got working.
> > Or I can provide just the service-jar.xml and you can grab the source
> > code from java.net if that's the way you would prefer to do it.
>
> Definitely the service-jar.xml. If there's custom code you had to
> write to get it to work, then definitely we'd want it too.
>
> So one of the neat things about the service-jar.xml concept is that
> everything in it is pretty much dormant until someone attempts to use
> one of it's services in an openejb.xml config file. Looking at the
> docs for the GenericJMSRA it seems clear that they're targeting a few
> common messaging implementations. We could actually provide a service-
> jar.xml that *wasn't* so generic and had all the properties setup for
> each of these platforms. It would be the same adapter class defined
> over and over again, sort of like different "profiles".
>
> Something like:
>
> <ServiceJar>
> <ServiceProvider id="IBMMQ" service="Resource"
> types="GenericJMSRA"
> class-name="com.sun.genericra.GenericJMSRA">
> ...
> </ServiceProvider>
>
> <ServiceProvider id="OracleAQ" service="Resource"
> types="GenericJMSRA"
> class-name="com.sun.genericra.GenericJMSRA">
> ...
> </ServiceProvider>
>
> <ServiceProvider id="TibcoEMS" service="Resource"
> types="GenericJMSRA"
> class-name="com.sun.genericra.GenericJMSRA">
> ...
> </ServiceProvider>
>
> <ServiceProvider id="SonicMQ" service="Resource"
> types="GenericJMSRA"
> class-name="com.sun.genericra.GenericJMSRA">
> ...
> </ServiceProvider>
>
> </ServiceJar>
>
>
> Then in your openejb.xml you just need to specify the properties you
> want to override from the defaults for that provider:
>
> <Resource id="My Generic Adapter" type="GenericJMSRA"
> jar="genericra-1.0.jar" provider="com.sun.genericra#SonicMQ">
> AdapterProperty1 PropertyValue1
> AdapterProperty2 PropertyValue2
> ...
> </Resource>
>
>
> Thoughts?
>
>
> -David
>
Re: Outbound resource injection in an ejb
Posted by David Blevins <da...@visi.com>.
On Jan 26, 2010, at 3:37 PM, Jason Russo wrote:
> I believe it is open source. See this page:
>
> https://genericjmsra.dev.java.net/docs/userguide/userguide.html
>
> If you want it, just let me know to who and where to send it. I can
> contribute the jar alone, or, in addition, separately provide the
> service-jar.xml and a sample openejb configuration that I got working.
> Or I can provide just the service-jar.xml and you can grab the source
> code from java.net if that's the way you would prefer to do it.
Definitely the service-jar.xml. If there's custom code you had to
write to get it to work, then definitely we'd want it too.
So one of the neat things about the service-jar.xml concept is that
everything in it is pretty much dormant until someone attempts to use
one of it's services in an openejb.xml config file. Looking at the
docs for the GenericJMSRA it seems clear that they're targeting a few
common messaging implementations. We could actually provide a service-
jar.xml that *wasn't* so generic and had all the properties setup for
each of these platforms. It would be the same adapter class defined
over and over again, sort of like different "profiles".
Something like:
<ServiceJar>
<ServiceProvider id="IBMMQ" service="Resource"
types="GenericJMSRA"
class-name="com.sun.genericra.GenericJMSRA">
...
</ServiceProvider>
<ServiceProvider id="OracleAQ" service="Resource"
types="GenericJMSRA"
class-name="com.sun.genericra.GenericJMSRA">
...
</ServiceProvider>
<ServiceProvider id="TibcoEMS" service="Resource"
types="GenericJMSRA"
class-name="com.sun.genericra.GenericJMSRA">
...
</ServiceProvider>
<ServiceProvider id="SonicMQ" service="Resource"
types="GenericJMSRA"
class-name="com.sun.genericra.GenericJMSRA">
...
</ServiceProvider>
</ServiceJar>
Then in your openejb.xml you just need to specify the properties you
want to override from the defaults for that provider:
<Resource id="My Generic Adapter" type="GenericJMSRA"
jar="genericra-1.0.jar" provider="com.sun.genericra#SonicMQ">
AdapterProperty1 PropertyValue1
AdapterProperty2 PropertyValue2
...
</Resource>
Thoughts?
-David
--
http://blog.dblevins.com/
http://twitter.com/dblevins
Support OpenEJB with Tweets!
Re: Outbound resource injection in an ejb
Posted by Jason Russo <jr...@genscape.com>.
I believe it is open source. See this page:
https://genericjmsra.dev.java.net/docs/userguide/userguide.html
If you want it, just let me know to who and where to send it. I can
contribute the jar alone, or, in addition, separately provide the
service-jar.xml and a sample openejb configuration that I got working.
Or I can provide just the service-jar.xml and you can grab the source
code from java.net if that's the way you would prefer to do it.
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 Mon, 2010-01-25 at 22:34 -0500, David Blevins wrote:
> On Jan 22, 2010, at 11:11 PM, Jason Russo wrote:
>
> > Ok, so I figured this out myself and it works very nicely. Some notes
> > for anyone else who wants to do this:
> >
> > I created a service-jar.xml file, and in it defined several service
> > provider tags for the main adapter class
> > (com.sun.genericra.GenericJMSRA), as well as for queue, topic, and
> > connection factory proxies in the service-jar.xml. Within those
> > service
> > provider tags I listed the setter properties of those classes that are
> > pertinent to defining a remote connection. For example:
> >
> > <ServiceJar>
> > <ServiceProvider id="genericra" service="Resource"
> > types="GenericJMSRA" class-name="com.sun.genericra.GenericJMSRA">
> > AdapterProperty1
> > AdapterProperty2
> > ...
> > </ServiceProvider>
> > </ServiceJar>
> >
> > Then I repackaged genericra.jar, adding the service-jar.xml as
> > META-INF/com.sun.genericra/service-jar.xml.
> >
> > Placed the genericra.jar file in openejb.home/lib (or, tomcat.home/lib
> > if embedding openejb in tomcat).
> >
> > Added sections in the openejb.xml file for my resources (adapter,
> > connection factory, queues and topics) to override the properties in
> > service-jar.xml with actual values. Then defined some new
> > containers in
> > openejb.xml using the adapters, and walla! Message driven beans work
> > very nicely.
> >
> > One caveat: when defining a resource in openejb.xml, make sure to
> > add a
> > provider attribute and prefix it with com.sun.genericra#<providerid>.
> > So the openejb resource entry will look like this:
> >
> > <Resource id="My Generic Adapter" type="GenericJMSRA"
> > jar="genericra-1.0.jar" provider="com.sun.genericra#genericra">
> > AdapterProperty1 PropertyValue1
> > AdapterProperty2 PropertyValue2
> > ...
> > </Resource>
> >
> > If the openejb dev group wants my genericra.jar to embed as a built in
> > service for external jms provider support, I can contribute my
> > adapter.
>
> This is great, Jason!
>
> Do you know what the license of the GenericJMSRA is?
>
> This could be a great contribution.
>
> -David
>
>
Re: Outbound resource injection in an ejb
Posted by David Blevins <da...@visi.com>.
On Jan 22, 2010, at 11:11 PM, Jason Russo wrote:
> Ok, so I figured this out myself and it works very nicely. Some notes
> for anyone else who wants to do this:
>
> I created a service-jar.xml file, and in it defined several service
> provider tags for the main adapter class
> (com.sun.genericra.GenericJMSRA), as well as for queue, topic, and
> connection factory proxies in the service-jar.xml. Within those
> service
> provider tags I listed the setter properties of those classes that are
> pertinent to defining a remote connection. For example:
>
> <ServiceJar>
> <ServiceProvider id="genericra" service="Resource"
> types="GenericJMSRA" class-name="com.sun.genericra.GenericJMSRA">
> AdapterProperty1
> AdapterProperty2
> ...
> </ServiceProvider>
> </ServiceJar>
>
> Then I repackaged genericra.jar, adding the service-jar.xml as
> META-INF/com.sun.genericra/service-jar.xml.
>
> Placed the genericra.jar file in openejb.home/lib (or, tomcat.home/lib
> if embedding openejb in tomcat).
>
> Added sections in the openejb.xml file for my resources (adapter,
> connection factory, queues and topics) to override the properties in
> service-jar.xml with actual values. Then defined some new
> containers in
> openejb.xml using the adapters, and walla! Message driven beans work
> very nicely.
>
> One caveat: when defining a resource in openejb.xml, make sure to
> add a
> provider attribute and prefix it with com.sun.genericra#<providerid>.
> So the openejb resource entry will look like this:
>
> <Resource id="My Generic Adapter" type="GenericJMSRA"
> jar="genericra-1.0.jar" provider="com.sun.genericra#genericra">
> AdapterProperty1 PropertyValue1
> AdapterProperty2 PropertyValue2
> ...
> </Resource>
>
> If the openejb dev group wants my genericra.jar to embed as a built in
> service for external jms provider support, I can contribute my
> adapter.
This is great, Jason!
Do you know what the license of the GenericJMSRA is?
This could be a great contribution.
-David
Re: Outbound resource injection in an ejb
Posted by Jason Russo <jr...@genscape.com>.
Ok, so I figured this out myself and it works very nicely. Some notes
for anyone else who wants to do this:
I created a service-jar.xml file, and in it defined several service
provider tags for the main adapter class
(com.sun.genericra.GenericJMSRA), as well as for queue, topic, and
connection factory proxies in the service-jar.xml. Within those service
provider tags I listed the setter properties of those classes that are
pertinent to defining a remote connection. For example:
<ServiceJar>
<ServiceProvider id="genericra" service="Resource"
types="GenericJMSRA" class-name="com.sun.genericra.GenericJMSRA">
AdapterProperty1
AdapterProperty2
...
</ServiceProvider>
</ServiceJar>
Then I repackaged genericra.jar, adding the service-jar.xml as
META-INF/com.sun.genericra/service-jar.xml.
Placed the genericra.jar file in openejb.home/lib (or, tomcat.home/lib
if embedding openejb in tomcat).
Added sections in the openejb.xml file for my resources (adapter,
connection factory, queues and topics) to override the properties in
service-jar.xml with actual values. Then defined some new containers in
openejb.xml using the adapters, and walla! Message driven beans work
very nicely.
One caveat: when defining a resource in openejb.xml, make sure to add a
provider attribute and prefix it with com.sun.genericra#<providerid>.
So the openejb resource entry will look like this:
<Resource id="My Generic Adapter" type="GenericJMSRA"
jar="genericra-1.0.jar" provider="com.sun.genericra#genericra">
AdapterProperty1 PropertyValue1
AdapterProperty2 PropertyValue2
...
</Resource>
If the openejb dev group wants my genericra.jar to embed as a built in
service for external jms provider support, I can contribute my adapter.
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
> >
Re: Outbound resource injection in an ejb
Posted by Jason Russo <jr...@genscape.com>.
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
>
Re: Outbound resource injection in an ejb
Posted by David Blevins <da...@visi.com>.
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