java.sql.SQLException - "cannot commit a resource enlisted in a global transaction"

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

java.sql.SQLException - "cannot commit a resource enlisted in a global transaction"

acscheiner
Hi Folks,

I'm looking for a bit of help/advice on a web project I'm currently working on. It is an existing Spring/ORM project built to run on Tomcat. I've recently added JMS messaging (via ActiveMQ), and, since it now uses two transactional resources, I'm wanting to add global transaction management via XA/JTA (using Spring as my JTA transaction manager). I've followed the outline of Josh Long's spring source JTA article for building/configuring the pieces into my web app which support the XA/JTA functionality that I'm trying to achieve.

After a bit of tinkering, I've got my web app to the point where it loads successfully in Tomcat, but, when I attempt to make a request to the app (which will attempt to insert some data in the DB - no JMS involved at this point), it appears to be failing with a java.sql.SQLException being thrown fromĀ bitronix.tm.resource.jdbc.JdbcConnectionHandle.commit() ("cannot commit a resource enlisted in a global transaction").

I'm using Spring 3.1.2.RELEASE, EclipseLink 2.4.0, ActiveMQ 5.6.0 and Bitronix 2.1.3. Additionally, I'm using Spring Data JPA framework to build my DAO classes.

The java source code executing when the exception is thrown is in my main service class and is as follows:

@Override @Transactional public void populateSampleData() { SaamUser testRunner = this.saamUserDao.findOneByUsername(TestSystem.TEST_RUN_USERNAME); if (null == testRunner) { testRunner = new SaamUser(); testRunner.setEmail("[hidden email]"); testRunner.setPassword("drowssap"); testRunner.setUsername(TestSystem.TEST_RUN_USERNAME); this.saamUserDao.save(testRunner); } for (final String testStudyName : SaamTestSystemEnum.getAllSaamTests()) { final Iterable<SaamStudy> saamStudies = this.saamStudyDao.findByNameAndSaamUser( testStudyName, testRunner); SaamStudy testStudy = null; if (!(saamStudies.iterator().hasNext())) { final Date now = new Date(); final SaamTestSystemEnum testStudyEnum = SaamTestSystemEnum.getInstance(testStudyName); testStudy = new SaamStudy(); testStudy.setName(testStudyEnum.toString()); testStudy.setDateCreated(now); testStudy.setDateLastModified(now); testStudy.setSaamUser(testRunner); testStudy.setData(testStudyEnum.getStudyData()); this.saamStudyDao.save(testStudy); } else { testStudy = saamStudies.iterator().next(); } TestSystem testSystem = this.testSystemDao.findOneByName(testStudyName); if (null == testSystem) { testSystem = new TestSystem(); testSystem.setName(testStudyName); final List<SaamStudy> studies = new ArrayList<SaamStudy>(); studies.add(testStudy); testSystem.setSaamStudies(studies); this.testSystemDao.save(testSystem); } } }

Basically, it's creating some new entity object instances (of type SaamUser, SaamStudy, and TestSystem) and attempting to save these new instances to the underlying database (via the save() method call from my DAO objects). This all works fine in the absence of the XA/JTA global transaction framework, but, now is failing.

I can certainly provide as much logging and source code as needed, but, what follows is the log info near the point of failure. Is there something that this type of error is suggesting with regard to incorrect/missing implementation of my XA/JTA implementation?

2012-08-15 12:03:45,585 DEBUG [org.springframework.web.servlet.DispatcherServlet] - DispatcherServlet with name 'joblaunch' processing GET request for [/saamweb/joblaunch/testrunner] 2012-08-15 12:03:45,589 DEBUG [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping] - Looking up handler method for path /testrunner 2012-08-15 12:03:45,600 DEBUG [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping] - Returning handler method [public java.lang.String com.teg.saamweb.web.SaamWebTestRunnerController.getTestRunForm()] 2012-08-15 12:03:45,601 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'saamWebTestRunnerController' 2012-08-15 12:03:45,607 DEBUG [org.springframework.web.servlet.DispatcherServlet] - Last-Modified value for [/saamweb/joblaunch/testrunner] is: -1 2012-08-15 12:03:45,643 DEBUG [org.springframework.transaction.annotation.AnnotationTransactionAttributeSource] - Adding transactional method 'populateSampleData' with attribute: PROPAGATION_REQUIRED,ISOLATION_DEFAULT; '' 2012-08-15 12:03:45,645 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'transactionManager' 2012-08-15 12:03:45,647 DEBUG [org.springframework.transaction.jta.JtaTransactionManager] - Creating new transaction with name [com.teg.saamweb.service.SaamWebServiceTransactional.populateSampleData]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT; '' 2012-08-15 12:03:45,696 DEBUG [org.springframework.transaction.annotation.AnnotationTransactionAttributeSource] - Adding transactional method 'populateSampleData' with attribute: PROPAGATION_REQUIRED,ISOLATION_DEFAULT; '' 2012-08-15 12:03:45,696 DEBUG [org.springframework.transaction.aspectj.AnnotationTransactionAspect] - Skipping transactional joinpoint [com.teg.saamweb.service.SaamWebServiceTransactional.populateSampleData] because no transaction manager has been configured 2012-08-15 12:03:45,700 DEBUG [org.springframework.orm.jpa.EntityManagerFactoryUtils] - Opening JPA EntityManager 2012-08-15 12:03:45,700 DEBUG [org.springframework.orm.jpa.EntityManagerFactoryUtils] - Registering transaction synchronization for JPA EntityManager [EL Fine]: sql: 2012-08-15 12:03:45.743--ServerSession(513447154)--Connection(1617311511)--Thread(Thread[http-bio-8080-exec-1,5,main])--SELECT SAAM_USER_ID, EMAIL, PASSWORD, USERNAME, VERSION FROM tab_SAAM_USERS WHERE (USERNAME = ?) bind => [testRunner] 2012-08-15 12:03:45,802 DEBUG [org.springframework.data.repository.core.support.TransactionalRepositoryProxyPostProcessor$CustomAnnotationTransactionAttributeSource] - Adding transactional method 'save' with attribute: PROPAGATION_REQUIRED,ISOLATION_DEFAULT; '' 2012-08-15 12:03:45,802 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Returning cached instance of singleton bean 'transactionManager' 2012-08-15 12:03:45,802 DEBUG [org.springframework.transaction.jta.JtaTransactionManager] - Participating in existing transaction 2012-08-15 12:03:45,802 DEBUG [org.springframework.transaction.annotation.AnnotationTransactionAttributeSource] - Adding transactional method 'save' with attribute: PROPAGATION_REQUIRED,ISOLATION_DEFAULT; '' 2012-08-15 12:03:45,802 DEBUG [org.springframework.transaction.aspectj.AnnotationTransactionAspect] - Skipping transactional joinpoint [org.springframework.data.jpa.repository.support.SimpleJpaRepository.save] because no transaction manager has been configured [EL Fine]: sql: 2012-08-15 12:03:45.823--ClientSession(660525305)--Connection(1105829792)--Thread(Thread[http-bio-8080-exec-1,5,main])--UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT + ? WHERE SEQ_NAME = ? bind => [50, SEQ_GEN] [EL Fine]: sql: 2012-08-15 12:03:45.825--ClientSession(660525305)--Connection(1105829792)--Thread(Thread[http-bio-8080-exec-1,5,main])--SELECT SEQ_COUNT FROM SEQUENCE WHERE SEQ_NAME = ? bind => [SEQ_GEN] [EL Fine]: sql: 2012-08-15 12:03:45.827--ClientSession(660525305)--Thread(Thread[http-bio-8080-exec-1,5,main])--SELECT 1 [EL Warning]: 2012-08-15 12:03:45.828--ClientSession(660525305)--Thread(Thread[http-bio-8080-exec-1,5,main])--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.4.0.v20120608-r11652): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLException: cannot commit a resource enlisted in a global transaction Error Code: 0 [EL Fine]: sql: 2012-08-15 12:03:45.832--ClientSession(660525305)--Thread(Thread[http-bio-8080-exec-1,5,main])--SELECT 1 [EL Warning]: 2012-08-15 12:03:45.832--ClientSession(660525305)--Thread(Thread[http-bio-8080-exec-1,5,main])--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.4.0.v20120608-r11652): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLException: cannot rollback a resource enlisted in a global transaction Error Code: 0 2012-08-15 12:03:45,833 DEBUG [org.springframework.transaction.jta.JtaTransactionManager] - Participating transaction failed - marking existing transaction as rollback-only 2012-08-15 12:03:45,833 DEBUG [org.springframework.transaction.jta.JtaTransactionManager] - Setting JTA transaction rollback-only 2012-08-15 12:03:45,838 DEBUG [org.springframework.orm.jpa.EntityManagerFactoryUtils] - Closing JPA EntityManager 2012-08-15 12:03:45,838 DEBUG [org.springframework.transaction.jta.JtaTransactionManager] - Initiating transaction rollback 2012-08-15 12:03:45,843 DEBUG [org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver] - Resolving exception from handler [public java.lang.String com.teg.saamweb.web.SaamWebTestRunnerController.getTestRunForm()]: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.4.0.v20120608-r11652): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLException: cannot commit a resource enlisted in a global transaction Error Code: 0 2012-08-15 12:03:45,848 DEBUG [org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver] - Resolving exception from handler [public java.lang.String com.teg.saamweb.web.SaamWebTestRunnerController.getTestRunForm()]: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.4.0.v20120608-r11652): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLException: cannot commit a resource enlisted in a global transaction Error Code: 0 2012-08-15 12:03:45,849 DEBUG [org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver] - Resolving exception from handler [public java.lang.String com.teg.saamweb.web.SaamWebTestRunnerController.getTestRunForm()]: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.4.0.v20120608-r11652): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLException: cannot commit a resource enlisted in a global transaction Error Code: 0 2012-08-15 12:03:45,852 DEBUG [org.springframework.web.servlet.DispatcherServlet] - Could not complete request Local Exception Stack: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.4.0.v20120608-r11652): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLException: cannot commit a resource enlisted in a global transaction Error Code: 0 at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:324) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicCommitTransaction(DatabaseAccessor.java:428) at org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.commitTransaction(DatasourceAccessor.java:389) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.commitTransaction(DatabaseAccessor.java:411) at org.eclipse.persistence.internal.sessions.AbstractSession.basicCommitTransaction(AbstractSession.java:603) at org.eclipse.persistence.sessions.server.ClientSession.basicCommitTransaction(ClientSession.java:164) at org.eclipse.persistence.internal.sessions.AbstractSession.commitTransaction(AbstractSession.java:798) at org.eclipse.persistence.internal.sequencing.SequencingManager$Preallocation_Transaction_NoAccessor_State.getNextValue(SequencingManager.java:497) at org.eclipse.persistence.internal.sequencing.SequencingManager.getNextValue(SequencingManager.java:1067) at org.eclipse.persistence.internal.sequencing.ClientSessionSequencing.getNextValue(ClientSessionSequencing.java:70) at org.eclipse.persistence.internal.descriptors.ObjectBuilder.assignSequenceNumber(ObjectBuilder.java:351) at org.eclipse.persistence.internal.descriptors.ObjectBuilder.assignSequenceNumber(ObjectBuilder.java:310) at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.assignSequenceNumber(UnitOfWorkImpl.java:469) at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.registerNotRegisteredNewObjectForPersist(UnitOfWorkImpl.java:4238) at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.registerNotRegisteredNewObjectForPersist(RepeatableWriteUnitOfWork.java:511) at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.registerNewObjectForPersist(UnitOfWorkImpl.java:4183) at org.eclipse.persistence.internal.jpa.EntityManagerImpl.persist(EntityManagerImpl.java:451) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:365) at $Proxy23.persist(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:240) at $Proxy23.persist(Unknown Source) at org.springframework.data.jpa.repository.support.SimpleJpaRepository.save(SimpleJpaRepository.java:341) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:334) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:319) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:155) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.data.jpa.repository.support.LockModeRepositoryPostProcessor$LockModePopulatingMethodIntercceptor.invoke(LockModeRepositoryPostProcessor.java:91) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) at $Proxy30.save(Unknown Source) at com.teg.saamweb.service.SaamWebServiceTransactional.populateSampleData(SaamWebServiceTransactional.java:99) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) at $Proxy35.populateSampleData(Unknown Source) at com.teg.saamweb.service.SaamWebServiceImpl.populateSampleData(SaamWebServiceImpl.java:46) at com.teg.saamweb.web.SaamWebTestRunnerController.populateTestRunFormData(SaamWebTestRunnerController.java:45) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126) at org.springframework.web.method.annotation.ModelFactory.invokeModelAttributeMethods(ModelFactory.java:123) at org.springframework.web.method.annotation.ModelFactory.initModel(ModelFactory.java:97) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:614) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778) at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:722) Caused by: java.sql.SQLException: cannot commit a resource enlisted in a global transaction at bitronix.tm.resource.jdbc.JdbcConnectionHandle.commit(JdbcConnectionHandle.java:111) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at bitronix.tm.resource.jdbc.BaseProxyHandlerClass.invoke(BaseProxyHandlerClass.java:64) at $Proxy25.commit(Unknown Source) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicCommitTransaction(DatabaseAccessor.java:420) ... 92 more Aug 15, 2012 12:03:45 PM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [joblaunch] in context with path [/saamweb] threw exception [Request processing failed; nested exception is Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.4.0.v20120608-r11652): org.eclipse.persistence.exceptions.DatabaseException

Thanks very much for any enlightenment you can provide.

Andrew Scheiner
Reply | Threaded
Open this post in threaded view
|

Re: java.sql.SQLException - "cannot commit a resource enlisted in a global transaction"

Ludovic Orban-2
It looks like you're using EclipseLink as your ORM but you probably
haven't configured it (and maybe not Spring either) to use JTA
transactions.

The SQLException "cannot commit a resource enlisted in a global
transaction" means that commit has been called on the
java.sql.Connection instance which is forbidden in the context of a
JTA transaction, UserTransaction.commit() has to be called instead.
According to the stack trace you posted, EclipseLink itself made that
call so I'm quite positive that the problem is there.

Another user had a very similar use case quite recently and
successfully managed to integrate everything together:
http://old.nabble.com/Tomcat-7%2C-Bitronix%2C-Spring-JTA%2C-JPA-tt34218255.html

I recommend you to replicate the config steps Chris explained in his
post to make sure EclipseLink is aware of the transaction manager.


On Wed, Aug 15, 2012 at 6:50 PM, Andrew Scheiner <[hidden email]> wrote:

> Hi Folks,
>
> I'm looking for a bit of help/advice on a web project I'm currently working
> on. It is an existing Spring/ORM project built to run on Tomcat. I've
> recently added JMS messaging (via ActiveMQ), and, since it now uses two
> transactional resources, I'm wanting to add global transaction management
> via XA/JTA (using Spring as my JTA transaction manager). I've followed the
> outline of Josh Long's spring source JTA article for building/configuring
> the pieces into my web app which support the XA/JTA functionality that I'm
> trying to achieve.
>
> After a bit of tinkering, I've got my web app to the point where it loads
> successfully in Tomcat, but, when I attempt to make a request to the app
> (which will attempt to insert some data in the DB - no JMS involved at this
> point), it appears to be failing with a java.sql.SQLException being thrown
> from bitronix.tm.resource.jdbc.JdbcConnectionHandle.commit() ("cannot commit
> a resource enlisted in a global transaction").
>
> I'm using Spring 3.1.2.RELEASE, EclipseLink 2.4.0, ActiveMQ 5.6.0 and
> Bitronix 2.1.3. Additionally, I'm using Spring Data JPA framework to build
> my DAO classes.
>
> The java source code executing when the exception is thrown is in my main
> service class and is as follows:
>
> @Override @Transactional public void populateSampleData() { SaamUser
> testRunner =
> this.saamUserDao.findOneByUsername(TestSystem.TEST_RUN_USERNAME); if (null
> == testRunner) { testRunner = new SaamUser();
> testRunner.setEmail("[hidden email]");
> testRunner.setPassword("drowssap");
> testRunner.setUsername(TestSystem.TEST_RUN_USERNAME);
> this.saamUserDao.save(testRunner); } for (final String testStudyName :
> SaamTestSystemEnum.getAllSaamTests()) { final Iterable<SaamStudy>
> saamStudies = this.saamStudyDao.findByNameAndSaamUser( testStudyName,
> testRunner); SaamStudy testStudy = null; if
> (!(saamStudies.iterator().hasNext())) { final Date now = new Date(); final
> SaamTestSystemEnum testStudyEnum =
> SaamTestSystemEnum.getInstance(testStudyName); testStudy = new SaamStudy();
> testStudy.setName(testStudyEnum.toString()); testStudy.setDateCreated(now);
> testStudy.setDateLastModified(now); testStudy.setSaamUser(testRunner);
> testStudy.setData(testStudyEnum.getStudyData());
> this.saamStudyDao.save(testStudy); } else { testStudy =
> saamStudies.iterator().next(); } TestSystem testSystem =
> this.testSystemDao.findOneByName(testStudyName); if (null == testSystem) {
> testSystem = new TestSystem(); testSystem.setName(testStudyName); final
> List<SaamStudy> studies = new ArrayList<SaamStudy>();
> studies.add(testStudy); testSystem.setSaamStudies(studies);
> this.testSystemDao.save(testSystem); } } }
>
> Basically, it's creating some new entity object instances (of type SaamUser,
> SaamStudy, and TestSystem) and attempting to save these new instances to the
> underlying database (via the save() method call from my DAO objects). This
> all works fine in the absence of the XA/JTA global transaction framework,
> but, now is failing.
>
> I can certainly provide as much logging and source code as needed, but, what
> follows is the log info near the point of failure. Is there something that
> this type of error is suggesting with regard to incorrect/missing
> implementation of my XA/JTA implementation?
>
> 2012-08-15 12:03:45,585 DEBUG
> [org.springframework.web.servlet.DispatcherServlet] - DispatcherServlet with
> name 'joblaunch' processing GET request for [/saamweb/joblaunch/testrunner]
> 2012-08-15 12:03:45,589 DEBUG
> [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping]
> - Looking up handler method for path /testrunner 2012-08-15 12:03:45,600
> DEBUG
> [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping]
> - Returning handler method [public java.lang.String
> com.teg.saamweb.web.SaamWebTestRunnerController.getTestRunForm()] 2012-08-15
> 12:03:45,601 DEBUG
> [org.springframework.beans.factory.support.DefaultListableBeanFactory] -
> Returning cached instance of singleton bean 'saamWebTestRunnerController'
> 2012-08-15 12:03:45,607 DEBUG
> [org.springframework.web.servlet.DispatcherServlet] - Last-Modified value
> for [/saamweb/joblaunch/testrunner] is: -1 2012-08-15 12:03:45,643 DEBUG
> [org.springframework.transaction.annotation.AnnotationTransactionAttributeSource]
> - Adding transactional method 'populateSampleData' with attribute:
> PROPAGATION_REQUIRED,ISOLATION_DEFAULT; '' 2012-08-15 12:03:45,645 DEBUG
> [org.springframework.beans.factory.support.DefaultListableBeanFactory] -
> Returning cached instance of singleton bean 'transactionManager' 2012-08-15
> 12:03:45,647 DEBUG
> [org.springframework.transaction.jta.JtaTransactionManager] - Creating new
> transaction with name
> [com.teg.saamweb.service.SaamWebServiceTransactional.populateSampleData]:
> PROPAGATION_REQUIRED,ISOLATION_DEFAULT; '' 2012-08-15 12:03:45,696 DEBUG
> [org.springframework.transaction.annotation.AnnotationTransactionAttributeSource]
> - Adding transactional method 'populateSampleData' with attribute:
> PROPAGATION_REQUIRED,ISOLATION_DEFAULT; '' 2012-08-15 12:03:45,696 DEBUG
> [org.springframework.transaction.aspectj.AnnotationTransactionAspect] -
> Skipping transactional joinpoint
> [com.teg.saamweb.service.SaamWebServiceTransactional.populateSampleData]
> because no transaction manager has been configured 2012-08-15 12:03:45,700
> DEBUG [org.springframework.orm.jpa.EntityManagerFactoryUtils] - Opening JPA
> EntityManager 2012-08-15 12:03:45,700 DEBUG
> [org.springframework.orm.jpa.EntityManagerFactoryUtils] - Registering
> transaction synchronization for JPA EntityManager [EL Fine]: sql: 2012-08-15
> 12:03:45.743--ServerSession(513447154)--Connection(1617311511)--Thread(Thread[http-bio-8080-exec-1,5,main])--SELECT
> SAAM_USER_ID, EMAIL, PASSWORD, USERNAME, VERSION FROM tab_SAAM_USERS WHERE
> (USERNAME = ?) bind => [testRunner] 2012-08-15 12:03:45,802 DEBUG
> [org.springframework.data.repository.core.support.TransactionalRepositoryProxyPostProcessor$CustomAnnotationTransactionAttributeSource]
> - Adding transactional method 'save' with attribute:
> PROPAGATION_REQUIRED,ISOLATION_DEFAULT; '' 2012-08-15 12:03:45,802 DEBUG
> [org.springframework.beans.factory.support.DefaultListableBeanFactory] -
> Returning cached instance of singleton bean 'transactionManager' 2012-08-15
> 12:03:45,802 DEBUG
> [org.springframework.transaction.jta.JtaTransactionManager] - Participating
> in existing transaction 2012-08-15 12:03:45,802 DEBUG
> [org.springframework.transaction.annotation.AnnotationTransactionAttributeSource]
> - Adding transactional method 'save' with attribute:
> PROPAGATION_REQUIRED,ISOLATION_DEFAULT; '' 2012-08-15 12:03:45,802 DEBUG
> [org.springframework.transaction.aspectj.AnnotationTransactionAspect] -
> Skipping transactional joinpoint
> [org.springframework.data.jpa.repository.support.SimpleJpaRepository.save]
> because no transaction manager has been configured [EL Fine]: sql:
> 2012-08-15
> 12:03:45.823--ClientSession(660525305)--Connection(1105829792)--Thread(Thread[http-bio-8080-exec-1,5,main])--UPDATE
> SEQUENCE SET SEQ_COUNT = SEQ_COUNT + ? WHERE SEQ_NAME = ? bind => [50,
> SEQ_GEN] [EL Fine]: sql: 2012-08-15
> 12:03:45.825--ClientSession(660525305)--Connection(1105829792)--Thread(Thread[http-bio-8080-exec-1,5,main])--SELECT
> SEQ_COUNT FROM SEQUENCE WHERE SEQ_NAME = ? bind => [SEQ_GEN] [EL Fine]: sql:
> 2012-08-15
> 12:03:45.827--ClientSession(660525305)--Thread(Thread[http-bio-8080-exec-1,5,main])--SELECT
> 1 [EL Warning]: 2012-08-15
> 12:03:45.828--ClientSession(660525305)--Thread(Thread[http-bio-8080-exec-1,5,main])--Exception
> [EclipseLink-4002] (Eclipse Persistence Services - 2.4.0.v20120608-r11652):
> org.eclipse.persistence.exceptions.DatabaseException Internal Exception:
> java.sql.SQLException: cannot commit a resource enlisted in a global
> transaction Error Code: 0 [EL Fine]: sql: 2012-08-15
> 12:03:45.832--ClientSession(660525305)--Thread(Thread[http-bio-8080-exec-1,5,main])--SELECT
> 1 [EL Warning]: 2012-08-15
> 12:03:45.832--ClientSession(660525305)--Thread(Thread[http-bio-8080-exec-1,5,main])--Exception
> [EclipseLink-4002] (Eclipse Persistence Services - 2.4.0.v20120608-r11652):
> org.eclipse.persistence.exceptions.DatabaseException Internal Exception:
> java.sql.SQLException: cannot rollback a resource enlisted in a global
> transaction Error Code: 0 2012-08-15 12:03:45,833 DEBUG
> [org.springframework.transaction.jta.JtaTransactionManager] - Participating
> transaction failed - marking existing transaction as rollback-only
> 2012-08-15 12:03:45,833 DEBUG
> [org.springframework.transaction.jta.JtaTransactionManager] - Setting JTA
> transaction rollback-only 2012-08-15 12:03:45,838 DEBUG
> [org.springframework.orm.jpa.EntityManagerFactoryUtils] - Closing JPA
> EntityManager 2012-08-15 12:03:45,838 DEBUG
> [org.springframework.transaction.jta.JtaTransactionManager] - Initiating
> transaction rollback 2012-08-15 12:03:45,843 DEBUG
> [org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver]
> - Resolving exception from handler [public java.lang.String
> com.teg.saamweb.web.SaamWebTestRunnerController.getTestRunForm()]: Exception
> [EclipseLink-4002] (Eclipse Persistence Services - 2.4.0.v20120608-r11652):
> org.eclipse.persistence.exceptions.DatabaseException Internal Exception:
> java.sql.SQLException: cannot commit a resource enlisted in a global
> transaction Error Code: 0 2012-08-15 12:03:45,848 DEBUG
> [org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver]
> - Resolving exception from handler [public java.lang.String
> com.teg.saamweb.web.SaamWebTestRunnerController.getTestRunForm()]: Exception
> [EclipseLink-4002] (Eclipse Persistence Services - 2.4.0.v20120608-r11652):
> org.eclipse.persistence.exceptions.DatabaseException Internal Exception:
> java.sql.SQLException: cannot commit a resource enlisted in a global
> transaction Error Code: 0 2012-08-15 12:03:45,849 DEBUG
> [org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver]
> - Resolving exception from handler [public java.lang.String
> com.teg.saamweb.web.SaamWebTestRunnerController.getTestRunForm()]: Exception
> [EclipseLink-4002] (Eclipse Persistence Services - 2.4.0.v20120608-r11652):
> org.eclipse.persistence.exceptions.DatabaseException Internal Exception:
> java.sql.SQLException: cannot commit a resource enlisted in a global
> transaction Error Code: 0 2012-08-15 12:03:45,852 DEBUG
> [org.springframework.web.servlet.DispatcherServlet] - Could not complete
> request Local Exception Stack: Exception [EclipseLink-4002] (Eclipse
> Persistence Services - 2.4.0.v20120608-r11652):
> org.eclipse.persistence.exceptions.DatabaseException Internal Exception:
> java.sql.SQLException: cannot commit a resource enlisted in a global
> transaction Error Code: 0 at
> org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:324)
> at
> org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicCommitTransaction(DatabaseAccessor.java:428)
> at
> org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.commitTransaction(DatasourceAccessor.java:389)
> at
> org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.commitTransaction(DatabaseAccessor.java:411)
> at
> org.eclipse.persistence.internal.sessions.AbstractSession.basicCommitTransaction(AbstractSession.java:603)
> at
> org.eclipse.persistence.sessions.server.ClientSession.basicCommitTransaction(ClientSession.java:164)
> at
> org.eclipse.persistence.internal.sessions.AbstractSession.commitTransaction(AbstractSession.java:798)
> at
> org.eclipse.persistence.internal.sequencing.SequencingManager$Preallocation_Transaction_NoAccessor_State.getNextValue(SequencingManager.java:497)
> at
> org.eclipse.persistence.internal.sequencing.SequencingManager.getNextValue(SequencingManager.java:1067)
> at
> org.eclipse.persistence.internal.sequencing.ClientSessionSequencing.getNextValue(ClientSessionSequencing.java:70)
> at
> org.eclipse.persistence.internal.descriptors.ObjectBuilder.assignSequenceNumber(ObjectBuilder.java:351)
> at
> org.eclipse.persistence.internal.descriptors.ObjectBuilder.assignSequenceNumber(ObjectBuilder.java:310)
> at
> org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.assignSequenceNumber(UnitOfWorkImpl.java:469)
> at
> org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.registerNotRegisteredNewObjectForPersist(UnitOfWorkImpl.java:4238)
> at
> org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.registerNotRegisteredNewObjectForPersist(RepeatableWriteUnitOfWork.java:511)
> at
> org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.registerNewObjectForPersist(UnitOfWorkImpl.java:4183)
> at
> org.eclipse.persistence.internal.jpa.EntityManagerImpl.persist(EntityManagerImpl.java:451)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:601) at
> org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:365)
> at $Proxy23.persist(Unknown Source) at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:601) at
> org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:240)
> at $Proxy23.persist(Unknown Source) at
> org.springframework.data.jpa.repository.support.SimpleJpaRepository.save(SimpleJpaRepository.java:341)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:601) at
> org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:334)
> at
> org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:319)
> at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
> at
> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
> at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
> at
> org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:155)
> at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
> at
> org.springframework.data.jpa.repository.support.LockModeRepositoryPostProcessor$LockModePopulatingMethodIntercceptor.invoke(LockModeRepositoryPostProcessor.java:91)
> at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
> at
> org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)
> at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
> at
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
> at $Proxy30.save(Unknown Source) at
> com.teg.saamweb.service.SaamWebServiceTransactional.populateSampleData(SaamWebServiceTransactional.java:99)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:601) at
> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319)
> at
> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
> at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
> at
> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
> at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
> at
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
> at $Proxy35.populateSampleData(Unknown Source) at
> com.teg.saamweb.service.SaamWebServiceImpl.populateSampleData(SaamWebServiceImpl.java:46)
> at
> com.teg.saamweb.web.SaamWebTestRunnerController.populateTestRunFormData(SaamWebTestRunnerController.java:45)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:601) at
> org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213)
> at
> org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
> at
> org.springframework.web.method.annotation.ModelFactory.invokeModelAttributeMethods(ModelFactory.java:123)
> at
> org.springframework.web.method.annotation.ModelFactory.initModel(ModelFactory.java:97)
> at
> org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:614)
> at
> org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)
> at
> org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
> at
> org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
> at
> org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
> at
> org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
> at
> org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
> at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
> at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
> at
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
> at
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
> at
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
> at java.lang.Thread.run(Thread.java:722) Caused by: java.sql.SQLException:
> cannot commit a resource enlisted in a global transaction at
> bitronix.tm.resource.jdbc.JdbcConnectionHandle.commit(JdbcConnectionHandle.java:111)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:601) at
> bitronix.tm.resource.jdbc.BaseProxyHandlerClass.invoke(BaseProxyHandlerClass.java:64)
> at $Proxy25.commit(Unknown Source) at
> org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicCommitTransaction(DatabaseAccessor.java:420)
> ... 92 more Aug 15, 2012 12:03:45 PM
> org.apache.catalina.core.StandardWrapperValve invoke SEVERE:
> Servlet.service() for servlet [joblaunch] in context with path [/saamweb]
> threw exception [Request processing failed; nested exception is Exception
> [EclipseLink-4002] (Eclipse Persistence Services - 2.4.0.v20120608-r11652):
> org.eclipse.persistence.exceptions.DatabaseException
>
> Thanks very much for any enlightenment you can provide.
>
> Andrew Scheiner

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: java.sql.SQLException - "cannot commit a resource enlisted in a global transaction"

acscheiner
Thanks very much for the reply Ludovic.

After more work on this, I'm now successfully running transactions using BTM to manage JMS (ActiveMQ) and JDBC (Hibernate persistence framework) in the scope of XA transactions (and, as noted originally, using Spring for JTA/XA configuration).

I went back to Hibernate (after having tried EclipseLink) since I have more experience with Hibernate and was ultimately able to get things going using it as my JPA persistence layer.

The source of my problem was that I had configured things (using Spring annotational configuration) without making use of a persistence.xml file. Rather, I had used the LocalContainerEntityManagerFactoryBean.setPackagesToScan to programmatically do what I would have included in the persistence.xml file. And, while the package scanning was indeed operating properly, the lack of the persistence.xml file meant that the transaction-type was being defaulted to RESOURCE_LOCAL (which is the default for non-JEE containers). I'm now explicitly providing a persistence.xml file and explicitly setting transaction-type="JTA". And, all is behaving properly.