Announcement Announcement Module
Collapse
No announcement yet.
Oracle AQ Integration & Transaction Management Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Oracle AQ Integration & Transaction Management

    Hi Guys

    I am attempting to use Oracle AQ as a JMS Provider in a Spring application which is being deployed onto WebLogic 8.1/9 and I am encountering some issues around transaction handling.

    I am using a sub-class of DefaultMessageListenerContainer102 so that I can pass in the Oracle Queue Owner & Name so that the Destination can be resolved by a custom DestinationResolver.

    I have the following configuration:

    Code:
      <!-- this is the Message Driven POJO -->
      <bean id="myAQListener" class="uk.co.jfactory.gateway.MyJmsRequestListener">
        <property name="gatewayService" ref="gatewayService"/>
      </bean>
    
      <bean id="aqConnectionFactory" class="oracle.jms.AQJmsQueueConnectionFactoryProxy">
        <constructor-arg ref="myXADatasource"/>
      </bean>
    
      <bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager102">
        <property name="connectionFactory" ref="aqConnectionFactory"/>
      </bean>
    
      <!-- and this is the message listener container -->
      <bean id="aqListenerContainer"
            class="oracle.jms.DefaultMessageListenerContainerAQ">
        <property name="connectionFactory" ref="aqConnectionFactory"/>
        <property name="concurrentConsumers" value="2"/>
        <property name="queueOwner" value="MySchema"/>
        <property name="queueName" value="MyQueueName"/>
        <property name="destinationResolver">
          <bean class="oracle.jms.AQJmsDestinationResolver"/>
        </property>
        <property name="messageListener" ref ="myAQListener"/>
        <property name="transactionManager" ref="transactionManager"/>
       </bean>
    I am getting the following error:
    Code:
    java.sql.SQLException: Cannot call Connection.commit in distributed transaction.  Transaction Manager will commit the resource manager when the distributed transaction is committed.
    	at weblogic.jdbc.wrapper.JTSConnection.commit(JTSConnection.java:628)
    	at oracle.jms.AQjmsSession.commitNoCheck(AQjmsSession.java:816)
    	at oracle.jms.AQjmsConsumer.doCommit(AQjmsConsumer.java:574)
    	at oracle.jms.AQjmsConsumer.dequeue(AQjmsConsumer.java:2075)
    	at oracle.jms.AQjmsConsumer.receiveFromAQ(AQjmsConsumer.java:913)
    	at oracle.jms.AQjmsConsumer.receiveFromAQ(AQjmsConsumer.java:832)
    	at oracle.jms.AQjmsConsumer.receive(AQjmsConsumer.java:773)
    	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveMessage(AbstractPollingMessageListenerContainer.java:348)
    	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:284)
    	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:219)
    	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:872)
    	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:812)
    	at java.lang.Thread.run(Thread.java:534)

    It appears that the JMS Session provided by Oracle is not XA compliant Does anyone have a work-around or an alternative solution?

    I am hoping to be able to perform the removal of the item from the AQ and all of it's associated processing (i.e. the body of the onMessage() method in the Listener) with an atomic JTA transaction.

    Thanks

    Andy

  • #2
    Is that XA?

    I haven't worked on Oracle AQ, but seems like you are trying to use XA transactions using the JmsTransactionManager rather than using the JtaTransactionManager.

    That could be the issue here, apart from ensuring that you are using the appropriate XA connection factories and etc.

    There is an article I authored at JavaWorld recently, which might be helpful for XA related stuff

    - Murali Kosaraju

    Comment


    • #3
      Hi Murali

      I have tried the JTA Transaction manager as well. My problem seems to stem from fact that I need to create an XA Connection Factory so that the AQ management is incorporated into the transaction however this is easier said than done with my combination of Weblogic & Oracle.

      The constructor for the Oracle XA Transaction Factory requires a javax.sql.XADatasource however I am retreiving my Datasource from a WebLogic App Server using JNDI. Weblogic returns its own wrapper for the Datasources which is an extension of javax.sql.Datasource rather than XADatasource even if the datasource is defined as an XA compliant.

      Your article is v good, a bit surprised that I didn't find it during my intensive Googling of this issue.

      Thanks for your help

      Andy

      Comment

      Working...
      X