Hi all,
I am having issues with using database transactions in a Spring based
application. I have my data sources configured on TomEE and they work
fine for non-transactional database calls, but whenever I try to call a
method using Spring's @Transactional annotation a
TransactionRequiredException is thrown due to no active transactions. I
have this application working on Glassfish currently and am trying to
port it to TomEE.
The application is using JPA (through EclipseLink), Spring, and Spring
Data JPA to handle the database calls. I have a
org.springframework.transaction.jta.JtaTransactionManager configured and
it appears to be grabbing a
org.apache.geronimo.transaction.manager.GeronimoTransactionManager from
TomEE under a default JNDI name. I am not explicitly creating or
configuring a TransactionManager in TomEE.
As far as I can tell, everything is working up to a point of trying to
the point of committing a transaction. I enabled debug logging and I get
this in my logs:
2015-07-23 14:50:07,510 DEBUG
[AbstractPlatformTransactionManager.java:367] - Creating new transaction
with name
[org.springframework.data.jpa.repository.support.SimpleJpaRepository.saveAndFlush]:
PROPAGATION_REQUIRED,ISOLATION_DEFAULT; ''
2015-07-23 14:50:07,511 DEBUG
[AbstractPlatformTransactionManager.java:847] - Initiating transaction
rollback
Jul 23, 2015 2:50:07 PM org.apache.catalina.core.ApplicationDispatcher
invoke
SEVERE: Servlet.service() for servlet dispatcher threw exception
org.springframework.dao.InvalidDataAccessApiUsageException:
Exception Description: No transaction is currently active; nested
exception is javax.persistence.TransactionRequiredException:
Exception Description: No transaction is currently active
I do not know if I missed a configuration option in TomEE or not, but I
could use some help trying to find what I am missing.
Thanks,
Mike Spencer