Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JmsResourceHolder.commit should not ignores IllegalStateException [SPR-7360] #12018

Closed
spring-issuemaster opened this issue Jul 7, 2010 · 1 comment
Assignees
Milestone

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Jul 7, 2010

Morten Andersen-Gott opened SPR-7360 and commented

A problem has occures when using ActiveMq with Spring and a non-jms/non-jta transaction manager. The TransactionSynchronizationUtils will try to commit jms transactions in the invokeAfterCommit method. This method calls the JmsResourceHolder.commitAll(), which silently ignores all IllegalStateException with an inline comment suggesting that it should only happen in the event of a Jta transaction being active.

Looking at the javax.jms.Session javadoc it seems that this is not the case, it states: "Invoking any other Session method on a closed session must throw a JMSException.IllegalStateException. Closing a closed session must not throw an exception" see: http://download.oracle.com/docs/cd/E17477_01/javaee/1.4/api/javax/jms/Session.html#close

I first raised this issue with ActiveMq: http://issues.apache.org/activemq/browse/AMQ-2812 where Rob Davies pointed me to the relevant point in the jms javadoc stating that IllegalStateException should be thrown if any operation is done on a closed session.

We are experiencing this issue when the ActiveMq server is going down and not coming up before the commit is executed.


Affects: 3.0.3

Issue Links:

  • #15455 spring-jms 3.0.4 introduces a change that breaks using JMSTemplate (and for that matter any JMS resource) with Oracle AQ when JMS Session are used in SESSION_TRANSACTED mode.

Referenced from: commits d1d5e2d

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jul 7, 2010

Juergen Hoeller commented

That's actually very old code, back from the original JmsTemplate days: Some providers seem to have thrown an IllegalStateException where they should have thrown a TransactionInProgressException, and we were just being defensive about that. I suppose this is not the case with modern providers anymore, 12 years after the JMS 1.0.2 specification clearly defined the use of TransactionInProgressException there. As a consequence, I removed the IllegalStateException catch clause from JmsResourceHolder without any further conditional checking.

This will be available in tonight's 3.0.4 snapshot. Feel free to give it an early try...

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.