Announcement Announcement Module
No announcement yet.
Oracle AQ Integration & Transaction Management Page Title Module
Move Remove Collapse
Conversation Detail Module
  • 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:

      <!-- this is the Message Driven POJO -->
      <bean id="myAQListener" class="">
        <property name="gatewayService" ref="gatewayService"/>
      <bean id="aqConnectionFactory" class="oracle.jms.AQJmsQueueConnectionFactoryProxy">
        <constructor-arg ref="myXADatasource"/>
      <bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager102">
        <property name="connectionFactory" ref="aqConnectionFactory"/>
      <!-- and this is the message listener container -->
      <bean id="aqListenerContainer"
        <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 name="messageListener" ref ="myAQListener"/>
        <property name="transactionManager" ref="transactionManager"/>
    I am getting the following error:
    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(
    	at oracle.jms.AQjmsSession.commitNoCheck(
    	at oracle.jms.AQjmsConsumer.doCommit(
    	at oracle.jms.AQjmsConsumer.dequeue(
    	at oracle.jms.AQjmsConsumer.receiveFromAQ(
    	at oracle.jms.AQjmsConsumer.receiveFromAQ(
    	at oracle.jms.AQjmsConsumer.receive(
    	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveMessage(
    	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(
    	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(
    	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(
    	at org.springframework.jms.listener.DefaultMessageListenerContainer$

    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.



  • #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


    • #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