2 Replies Latest reply: Jun 3, 2011 8:07 AM by 361137 RSS

    Unable to get transactions working with Weblogic/Spring/Hibernate/JMS

    361137
      I have a requirement to have a method which both sends data to the database and publishes a message to a JMS topic to be trasnactional.

      This is within an application which is deployed to Weblogic 11g, uses Spring as overall framework, Hibernate as database layer and Tibco EMS as JMS layer.

      To activate transactions, I modified my spring config as follows:

      <bean id="transactionManager" class="org.springframework.transaction.jta.WebLogicJtaTransactionManager">
      <property name="transactionManagerName" value="javax.transaction.TransactionManager"/>
      </bean>

      And when I tested this using Hibernate alone, it works great. It rolls back when I forced a RuntimeException, and no problems when everything succeeds.

      However, as soon as I add my call to publish to JMS topic, I get an error as follows:

      21:48:18,594 ERROR task-scheduler-1 support.TransactionSynchronizationUtils:136 - TransactionSynchronization.afterCompletion threw exception
      java.lang.NullPointerException
           at org.springframework.transaction.support.ResourceHolderSynchronization.afterCompletion(ResourceHolderSynchronization.java:105)
           at org.springframework.transaction.support.TransactionSynchronizationUtils.invokeAfterCompletion(TransactionSynchronizationUtils.java:133)
      etc...

      There is no further indication of what is wrong, just this vague NullPointerException.

      I have struggled with this all day and am not having any success in debugging this issue. Would anyone please give me some suggestions or ideas on how to fix this? I am not experienced with Spring so it could very well be an obvious newbie error.