snowdrop / narayana-spring-boot

Narayana Spring Boot autoconfiguration and starter
Apache License 2.0
44 stars 43 forks source link

SynchedLocalTransactionFailedException sending a message to a queue #94

Closed oburgosm closed 1 year ago

oburgosm commented 1 year ago

I'm trying to send a message inside a transaction to a queue using a JmsTemplate which uses a XAConnectionFactory wrapped with XAConnectionFactoryWrapper#wrapConnectionFactory and pooling enabled, but I have an Exception:

org.springframework.jms.connection.SynchedLocalTransactionFailedException: Local JMS transaction failed to commit; nested exception is javax.jms.IllegalStateException: The session has already been closed

I have a demo project to reproduce this behavior here

graben commented 1 year ago

Quite an easy conceptional bug in your code: this.jmsTemplate.setSessionTransacted(false);

oburgosm commented 1 year ago

Right, sorry