tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lb <open...@lbreuss.ch>
Subject Re: resource adapter configuration for Sun JMSJCA sun-jms-adapter
Date Wed, 17 Nov 2010 15:41:47 GMT

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.

Mime
View raw message