Transaction handling exceptions using Stardust with JBoss 5.1 and Jackrabbit [message #742033] |
Thu, 20 October 2011 05:26 |
Srinivasan Iyer Messages: 36 Registered: October 2011 |
Member |
|
|
JBoss throws an IllegalStateException such as below when Stardust services are used. It seems to occur only after DMS operations have been executed.
java.lang.IllegalStateException: Trying to change transaction TransactionImple < ac, BasicAction: af492b4:c1e1:4e15bbe6:286 status: ActionStatus.RUNNING > in enlist! at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.enlist(TxConnectionManager.java:623) at org.jboss.resource.connectionmanager.TxConnectionManager.transactionStarted(TxConnectionManager.java:394) at org.jboss.resource.connectionmanager.CachedConnectionManager.userTransactionStarted(CachedConnectionManager.java:350) at org.jboss.tm.usertx.UserTransactionRegistry.userTransactionStarted(UserTransactionRegistry.java:119) at org.jboss.tm.usertx.client.ServerVMClientUserTransaction.begin(ServerVMClientUserTransaction.java:141) at org.springframework.transaction.jta.JtaTransactionManager.doJtaBegin(JtaTransactionManager.java:863) at org.springframework.transaction.jta.JtaTransactionManager.doBegin(JtaTransactionManager.java:820)
[Updated on: Thu, 20 October 2011 08:28] Report message to a moderator
|
|
|
Re: Transaction handling exceptions using Stardust with JBoss 5.1 and Jackrabbit [message #742037 is a reply to message #742033] |
Thu, 20 October 2011 05:30 |
Srinivasan Iyer Messages: 36 Registered: October 2011 |
Member |
|
|
Spring service calls using Stardust API initiate a new transaction. Stardust service calls participate in this transaction since Stardust services in general have the transaction propagation attribute required defined. An Stardust login call (done per service call), however, is executed in a nested transaction (transaction attribute requiresNew). So when it comes to an Stardust login, the current transaction is suspended and resumed once the nested transaction (the actual login) is done.
The problem is that Jackrabbit does not explicitly close sessions per transaction, but keeps it open and JBoss does not allow to suspend transactions if resource handles are still open. You need to make sure that all Stardust services used in any custom business facade method are retrieved first (enforcing login) before you use the DMS service for the very first time.
A service call stack such as the following fails:
>> start custom business method
>> do business logic
>> get DocumentManagementService
>> use DocumentManagentService
>> do business logic
>> get WorkflowService
>> use WorkflowService
>> use DocumentManagentService
>> do business logic
>> get QueryService
>> use QueryService
>> end custom business method
The following service call stack on the other hand does not fail:
>> start custom business method
>> get DocumentManagementService
>> get WorkflowService
>> get QueryService
>> do business logic
>> use DocumentManagentService
>> do business logic
>> use WorkflowService
>> use DocumentManagentService
>> do business logic
>> use QueryService
>> end custom business method
Please note: If you for example would have a service call (no Stardust service calls included at all) with transaction attribute requiresNew after Jackrabbit has been used, you would see this exception thrown from JBoss as well.
[Updated on: Thu, 20 October 2011 08:29] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03894 seconds