Announcement Announcement Module
Collapse
No announcement yet.
Using "aspectj" mode for annotation-driven transaction, breaks atomikos Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using "aspectj" mode for annotation-driven transaction, breaks atomikos

    Hello,

    I've been using a Spring + Atomikos + Hibernate(MySQL) + ActiveMQ configuration which worked fine, until I ran into a situation where I had to add a @Transactional method to a class that was @Configurable.

    At that point, I ran into the incompatibility of mixing aspect-weaving with spring-proxying, which led to this exception:

    Code:
    java.lang.IllegalStateException: Post-processor tried to replace bean instance of type [some.class.name] with (proxy) object of type [org.springframework.beans.factory.aspectj.$Proxy68] - not supported for aspect-configured classes!
    In this forum, it was suggested that I switch to using "aspectj" mode for the transaction management, which I did by using:

    Code:
        <tx:annotation-driven transaction-manager="transactionManager" 
        	mode="aspectj" proxy-target-class="false" />
    However, when I try to send a JMS message I now get a complaint from Atomikos claiming:

    Code:
    com.atomikos.jms.AtomikosTransactionRequiredJMSException: The JMS session you are using requires a JTA transaction context for the calling thread and none was found.
    Please correct your code to do one of the following: 
    1. start a JTA transaction if you want your JMS operations to be subject to JTA commit/rollback, or
    2. increase the maxPoolSize of the AtomikosConnectionFactoryBean to avoid transaction timeout while waiting for a connection, or
    3. create a non-transacted session and do session acknowledgment yourself, or
    4. set localTransactionMode to true so connection-level commit/rollback are enabled.
    	at com.atomikos.jms.AtomikosTransactionRequiredJMSException.throwAtomikosTransactionRequiredJMSException(AtomikosTransactionRequiredJMSException.java:38)
    	at com.atomikos.jms.ConsumerProducerSupport.enlist(ConsumerProducerSupport.java:107)
    	at com.atomikos.jms.AtomikosJmsMessageProducerProxy.send(AtomikosJmsMessageProducerProxy.java:50)
    	at com.atomikos.jms.AtomikosJmsMessageProducerProxy.send(AtomikosJmsMessageProducerProxy.java:131)
    	at org.springframework.jms.core.JmsTemplate.doSend(JmsTemplate.java:592)
    	at org.springframework.jms.core.JmsTemplate.doSend(JmsTemplate.java:569)
    	at org.springframework.jms.core.JmsTemplate$3.doInJms(JmsTemplate.java:536)
    	at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:466)
    	... 49 more
    Has anyone ever used aspectj-mode successfully with Atomikos?

  • #2
    Busted like a rookie! I had not configured the maven-aspectj-plugin to run for in the pom.xml of that specific module...

    Oh, the shame!

    Comment

    Working...
    X