[ 
https://issues.apache.org/activemq/browse/AMQ-2670?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=58450#action_58450
 ] 

Edwin van der Elst commented on AMQ-2670:
-----------------------------------------

An mdb:
@MessageDriven(mappedName = "jms/SimpleMDB", messageListenerInterface = 
javax.jms.MessageListener.class, activationConfig = {
        @ActivationConfigProperty(propertyName = "destination", propertyValue = 
"queue.test"),
        @ActivationConfigProperty(propertyName = "destinationType", 
propertyValue = "javax.jms.Queue"),
        @ActivationConfigProperty(propertyName = "subscriptionDurability", 
propertyValue = "NonDurable"),
        @ActivationConfigProperty(propertyName = "maximumRedeliveries", 
propertyValue = "0") })
@ResourceAdapter(value = "activemq-rar-5.3.0.rar")
public class SimpleMDB implements MessageListener {
...
}

But it is not related to the MDB. The problem is that the connectionfactory is 
not the XA variant. This is deployed in a -ds.xml ike this:
<connection-factories>

   <tx-connection-factory>
      <jndi-name>activemq/QueueConnectionFactory</jndi-name>
      <xa-transaction/>
      <track-connection-by-tx/>
      <rar-name>activemq-rar-5.3.0.rar</rar-name>
      
<connection-definition>javax.jms.QueueConnectionFactory</connection-definition>
      <ServerUrl>tcp://localhost:61616</ServerUrl>
      <min-pool-size>10</min-pool-size>
      <max-pool-size>200</max-pool-size>
      <blocking-timeout-millis>30000</blocking-timeout-millis>
      <idle-timeout-minutes>3</idle-timeout-minutes>
   </tx-connection-factory>

   <mbean code="org.jboss.jms.jndi.JMSProviderLoader"
          name="activemq:service=JMSProviderLoader,name=ActiveMQJMSProvider">
      <attribute name="ProviderName">ActiveMQJMSProvider</attribute>
      <attribute 
name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>
      <attribute 
name="FactoryRef">java:/activemq/QueueConnectionFactory</attribute>
      <attribute 
name="QueueFactoryRef">java:/activemq/QueueConnectionFactory</attribute>
      <attribute 
name="TopicFactoryRef">java:/activemq/QueueConnectionFactory</attribute>
   </mbean>
   
...
/>

This will result in a call to 
ActiveMQManagedConnectionFactory.createConnectionFactory during startup of 
JBoss (as configured in the ra.xml). But that will always create a 
ActiveMQConnectionFactory and never the ActiveMQXAConnectionFactory. 
And therefore, a ConnectionFactory instance is always bound in the JNDI and not 
an XAConnectionFactory.
So, it is not a bypass for the rar (it is still needed).

I see in the sources for ActiveMQXAConnectionFactory that all work is handled 
by the superclass (ActiveMQConnectionFactory), so it is only in JBoss actually 
performing the cast on the connectionfactory that causes a problem.

> ClassCast Exception in JBoss when using XA 
> -------------------------------------------
>
>                 Key: AMQ-2670
>                 URL: https://issues.apache.org/activemq/browse/AMQ-2670
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Connector
>    Affects Versions: 5.3.0
>         Environment: activemq-rar-5.3.0.rar deployed in jboss-5.1.0-GA
>            Reporter: Edwin van der Elst
>         Attachments: ActiveMQXAManagedConnectionFactory.java, ra.xml
>
>
> When deploying the rar under JBoss, the connectionfactory bound in de JNDI 
> tree is always of type 'ActiveMQConnectionFactory'., while it should be 
> ActiveMQXAConnectionFactory (which implements XAConnectionFactory).
> I attached a new class that creates the correct type of factory, and this can 
> be configured in the ra.xml (also attached).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to