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

Spring does not detect nested JBoss RollbackException [SPR-6450] #11116

Closed
spring-projects-issues opened this issue Nov 25, 2009 · 5 comments
Closed
Assignees
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

Olivier BILLIARD opened SPR-6450 and commented

I am using Spring 2.0.2 with JBoss 4.2.1 which uses Arjuna Transaction Manager. When i am trying to rollback a transaction i am getting the error message as IllegalStateException"No Active JTA Transaction" The integration between Spring and JBOSS does not work properly anymore after upgrading jboss from 4.0.4 to 4.2.1.

Raised the same issue in the JBoss forum but they have replied that it is a spring bug that it is trying to synchronise a inactive transaction.

For more information Please refer the below links.

http://jira.jboss.com/jira/browse/JBAS-4972
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=118261

I have also raised it in the spring forum Please refer the below link

http://forum.springframework.org/showthread.php?t=27867

Can you please help me out in this as this seems to be very critical.

Thanks,
Kavipriya


Affects: 2.5.6

Attachments:

Referenced from: commits c4d8f6b

@spring-projects-issues
Copy link
Collaborator Author

Olivier BILLIARD commented

Hi,

I'm using JBOSS AS 5.0.1 GA. Now it's a RollbackException that is thrown by JBOSS because Spring is trying to use an aborted transaction.
The problem is still present in the 2.5.6-SEC01 build. Like it is said in the jboss jira issue, Spring is trying to synchronize a JTA transaction that was just marked for rollback.

I checked the source code and modify the triggerAfterCompletion method, in the JTA case, to check if the transaction status is ACTIVE.
It solve my problem but can you double check the modifications.

@spring-projects-issues
Copy link
Collaborator Author

Olivier BILLIARD commented

I cloned the issue http://jira.springframework.org/browse/SPR-4107 to create this one

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

What exactly is the exception that you're getting there? Also, wouldn't overriding registerAfterCompletionWithExistingTransaction do the job as well? We are catching RollbackException there already so I wonder what the actual problem could be... other than an unpleasant debug log entry?

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Olivier BILLIARD commented

The exception I got was a real exception, a RuntimeException with a RollbackException for cause.
I apologies for what I wrote earlier because I didn't do a good review of the JtaTransactionManager class.
The registerAfterCompletionWithExistingTransaction method really catch the RollbackException, IllegateStateException and SystemException. I checked again the jboss source code with that info and I discovered that jboss don't entirely respect the JTA 1.1 specification for this method signature. Jboss should throw IllegalStateException instead of RuntimeException. Spring code don't catch the super class exception so I got a big stack trace with the Jboss info.
I will open an issue about this in the jboss's jira.

I'm still convinced there is a small problem about the exception management in the registerAfterCompletionWithExistingTransaction and doRegisterAfterCompletionWithJtaTransaction classes for Spring. In the JTA 1.1 case, jboss will throw an IllegalStateException (when it'll be corrected) but the cause of this exception will be a RollbackException or a SystemException. The IllegalStateException will be catched but no check will be done to verify if it's a SystemException. The way of dealing with this exception seem different.
One way could be to catch the exception around the registerInterposedSynchronization method call and to throw the cause exception.

if (this.transactionSynchronizationRegistry != null) {
// JTA 1.1 TransactionSynchronizationRegistry available - use it.
try {
new InterposedSynchronizationDelegate().registerInterposedSynchronization(
new JtaAfterCompletionSynchronization(synchronizations));
} catch (IllegalStateException e) {
if (e.getCause() != null) {
throw e.getCause();
}
throw e;
}
}

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

I've extended JtaTransactionManager's exception handling to catch any exception there, and also to detect RollbackException as cause as you suggested. This will make 3.0 GA and should work with any JBoss version then.

Juergen

@spring-projects-issues spring-projects-issues added in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 3.0 GA milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants