[jboss-jira] [JBoss JIRA] (AS7-5888) Errors accessing CMR from ejbStore of the CMP EntityBean (EJB 2.1 spec)

Kamesh Marellapudi (JIRA) jira-events at lists.jboss.org
Thu Nov 8 19:03:18 EST 2012


    [ https://issues.jboss.org/browse/AS7-5888?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12732968#comment-12732968 ] 

Kamesh Marellapudi commented on AS7-5888:
-----------------------------------------

I think I am running into an even bigger problem here. In Jboss 4 we have these container configurations using which we were able to delay the actual ejbStore till the end of the transaction. Do we have a similar mechanism in JBoss 7.1.1? Probably that would fix the problem I reported because, by the time the CMR is invoked in the ejbStore it would already have been loaded by my application. 

Could you please let us know on this?

Thanks again.
                
> Errors accessing CMR from ejbStore of the CMP EntityBean (EJB 2.1 spec)
> -----------------------------------------------------------------------
>
>                 Key: AS7-5888
>                 URL: https://issues.jboss.org/browse/AS7-5888
>             Project: Application Server 7
>          Issue Type: Bug
>          Components: EJB
>    Affects Versions: 7.1.1.Final
>         Environment: Windows
>            Reporter: Kamesh Marellapudi
>              Labels: jboss
>
> Background :: We are trying to upgrade our app from JBoss 4.0.1Sp3 to Jboss 7.1.1-Final. We have a lot of entity beans based on EJB 2.1 spec. We are noticing the following when we run our application on Jboss 7.1.1-Final. We did NOT have these issues on Jboss 4.0.1. 
> Issue :: : ARJUNA016082: Synchronizations are not allowed! Transaction status isActionStatus.RUNNING
> What I found? 
>      1. In our application we access CMRs of an entity bean from the ejbStore of the same entity bean.
>      2. ejbStore is invoked from the beforeCompletion of EntityBeanSynchronizationInterceptor$EntityBeanSynchronization. 
>      3. During the invocation of CMR on the entity bean the call gets delegated to JDBCCMRFieldBridge.getrelationSet(). In this method we have 
> the following 
> try {
>                 // get the current transaction
>                 CmpEntityBeanComponent component = getJDBCStoreManager().getComponent();
>                 TransactionManager tm = component.getTransactionManager();
>                 Transaction tx = tm.getTransaction();
>                 // if whe have a valid transaction...
>                 if (tx != null && (tx.getStatus() == Status.STATUS_ACTIVE || tx.getStatus() == Status.STATUS_PREPARING)) {
>                     // crete the relation set and register for a tx callback
>                     relationSet = new RelationSet(JDBCCMRFieldBridge.this, ctx, setHandle, false);
>                     TxSynchronization sync = new TxSynchronization(FieldState.this);
>                     tx.registerSynchronization(sync);
>                 } else {
>                     // if there is no transaction create a pre-failed list
>                     relationSet = new RelationSet(JDBCCMRFieldBridge.this, ctx, new List[1], false);
>                 }
>                 return relationSet;
>             } catch (SystemException e) {
>                 throw MESSAGES.errorCreatingRelationSet(e);
>             } catch (RollbackException e) {
>                 throw MESSAGES.errorCreatingRelationSet(e);
>             }
> So we are trying to register TxSynchronization from beforeCompletion of EntityBeanSynchronization. 
> 4. Now in the TwoPhaseCoordinator.addSynchronization method we have the following piece of code
> // disallow addition of Synchronizations that would appear
> 		    // earlier in sequence than any that has already been called
> 		    // during the pre-commmit phase. This generic support is required for
> 		    // JTA Synchronization ordering behaviour
> 		    if(sr instanceof Comparable && _currentRecord != null) {
> 		        Comparable c = (Comparable)sr;
> 		        if(c.compareTo(_currentRecord) != 1) {
> 		            return AddOutcome.AR_REJECTED;
> 		        }
> 		    }
> and the SynchronizationImple.compareTo has the following 
> public int compareTo(Object object)
> 	{
> 		SynchronizationImple other = (SynchronizationImple)object;
> 		if(this._isInterposed && (!other._isInterposed))
> 		{
> 			return 1;
> 		}
> 		else if((!this._isInterposed) && other._isInterposed)
> 		{
> 			return -1;
> 		}
> 		else if(this._theUid.equals(other._theUid))
> 		{
> 			return 0;
> 		}
> 		else
> 		{
> 			return this._theUid.lessThan(other._theUid) ? -1 : 1;
> 		}
> 	}
> So basically what I understood is the TxSynchronization registration from ejbStore is a bit too late because we are already in the beforeCompletion of one of the synchronizations listed in the transaction unless its registered through TransactionSynchronizationRegistry.registerInterposedSynchronization. 
> Here is the full stacktrace
> Caused by: javax.transaction.RollbackException: ARJUNA016053: Could not commit transaction.
> 	at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1177) [jbossjts-4.16.2.Final.jar:]
> 	at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:117) [jbossjts-4.16.2.Final.jar:]
> 	at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75)
> 	at org.jboss.as.ejb3.inflow.MessageEndpointInvocationHandler.afterDelivery(MessageEndpointInvocationHandler.java:72)
> 	... 16 more
> Caused by: javax.ejb.EJBException: javax.ejb.TransactionRolledbackLocalException: ARJUNA016082: Synchronizations are not allowed! Transaction status isActionStatus.RUNNING
> 	at org.jboss.as.cmp.component.CmpEntityBeanComponentInstance.store(CmpEntityBeanComponentInstance.java:108)
> 	at org.jboss.as.ejb3.component.entity.interceptors.EntityBeanSynchronizationInterceptor$EntityBeanSynchronization.beforeCompletion(EntityBeanSynchronizationInterceptor.java:185)
> 	at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:76) [jbossjts-4.16.2.Final.jar:]
> 	at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:273) [jbossjts-4.16.2.Final.jar:]
> 	at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:93) [jbossjts-4.16.2.Final.jar:]
> 	at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:164) [jbossjts-4.16.2.Final.jar:]
> 	at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1165) [jbossjts-4.16.2.Final.jar:]
> 	... 19 more
> Caused by: javax.ejb.TransactionRolledbackLocalException: ARJUNA016082: Synchronizations are not allowed! Transaction status isActionStatus.RUNNING
> 	at org.jboss.as.ejb3.component.interceptors.EjbExceptionTransformingInterceptorFactories$2.processInvocation(EjbExceptionTransformingInterceptorFactories.java:93)
> 	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
> 	at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
> 	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
> 	at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:32)
> 	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
> 	at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)
> 	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
> 	at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
> 	at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165)
> 	at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:173)
> 	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
> 	at org.jboss.as.ejb3.component.entity.interceptors.EntityBeanPrimaryKeyInterceptor.processInvocation(EntityBeanPrimaryKeyInterceptor.java:52)
> 	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
> 	at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
> 	at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72)
> 	at com.taliantsoftware.policy.payrollreport.ejb.PayrollReportLocal$$$view1774.getPremiumPeriodCMR(Unknown Source)
> 	at com.taliantsoftware.policy.payrollreport.ejb.PayrollReportBean.getContextRootId(PayrollReportBean.java:491)
> 	at insureworx.ejbservices.history.ejb.JDBCHistoryHandler.createActivityDetail(JDBCHistoryHandler.java:628)
> 	at insureworx.ejbservices.history.ejb.JDBCHistoryHandler.createActivity(JDBCHistoryHandler.java:430)
> 	at insureworx.ejbservices.history.ejb.JDBCHistoryHandler.expireOldHistoryAndCreateNewHistory(JDBCHistoryHandler.java:390)
> 	at insureworx.ejbservices.history.ejb.HistoryCapableJDBCEntityBean.expireOldHistoryAndCreateNewHistory(HistoryCapableJDBCEntityBean.java:67)
> 	at insureworx.ejbservices.history.ejb.HistoryCapableJDBCEntityBean.registerForHistory(HistoryCapableJDBCEntityBean.java:253)
> 	at insureworx.ejbservices.history.ejb.HistoryCapableJDBCEntityBean.ejbStore(HistoryCapableJDBCEntityBean.java:159)
> 	at sun.reflect.GeneratedMethodAccessor44.invoke(Unknown Source) [:1.7.0_09]
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09]
> 	at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09]
> 	at org.jboss.as.ejb3.component.InvokeMethodOnTargetInterceptor.processInvocation(InvokeMethodOnTargetInterceptor.java:57)
> 	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
> 	at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
> 	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
> 	at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
> 	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
> 	at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)
> 	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)
> 	at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
> 	at org.jboss.as.ejb3.component.entity.EntityBeanComponentInstance.invokeEjbStore(EntityBeanComponentInstance.java:163)
> 	at org.jboss.as.cmp.component.CmpEntityBeanComponentInstance.store(CmpEntityBeanComponentInstance.java:97)
> 	... 25 more

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list