jeudi 25 juin 2015

ConcurrentModificationException thrown by GlassFish 3.1.2.2 on commit of XA transaction

We have a Singleton EJB bean deployed in GlassFish 3.1.2.2 server with the following annotations:

@ConcurrencyManagement(ConcurrencyManagementType.BEAN)
@Singleton
@Startup
@Local(XXX.class)
@TransactionAttribute(TransactionAttributeType.NEVER)

The bean is injected into a servlet which calls several methods on it. Randomly, the server.log shows that there are ConcurrentModificationException thrown by random methods of the bean on commit of XA transaction.

javax.transaction.xa.XAException: java.util.ConcurrentModificationException
    at com.sun.enterprise.resource.ConnectorXAResource.handleResourceException(ConnectorXAResource.java:115)
    at com.sun.enterprise.resource.ConnectorXAResource.resetAssociation(ConnectorXAResource.java:287)
    at com.sun.enterprise.resource.ConnectorXAResource.commit(ConnectorXAResource.java:128)
    at com.sun.enterprise.transaction.JavaEETransactionImpl.commit(JavaEETransactionImpl.java:501)
    at com.sun.enterprise.transaction.JavaEETransactionManagerSimplified.commit(JavaEETransactionManagerSimplified.java:855)
    at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:5136)
    at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4901)
    at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2045)
    at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1994)
    at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:222)
    at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:89)
    at com.sun.proxy.$Proxy258.getHostMonitorRecord(Unknown Source)

Apparently, the method calls are attached to the container managed transaction, even though the bean is annotated with TransactionAttributeType.NEVER. My question is why is the bean still transactional and what may be causing the random occurrence of this exception.

Aucun commentaire:

Enregistrer un commentaire