yes looks TxMgr setup is fine Eclipselinks is the default in glassfish and surely more integrated than in tomee, maybe the issue is just this
FYI in tomee we have a specific platform server for eclipselinks: jpaProperties.put("eclipselink.target-server", "org.apache.openejb.jpa.integration.eclipselink.OpenEJBServerPlatform"); Romain Manni-Bucau @rmannibucau <https://twitter.com/rmannibucau> | Blog <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> | LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber <http://www.tomitribe.com> 2015-07-27 14:26 GMT-07:00 Mike Spencer <mspen...@denniskirk.com>: > You should not have to install a SQL Server instance. I updated the > project to use H2 Database and it still triggers the issue I am having. > > The test case I am using is hitting <host>/<context > path>/?transactionId=1. An exception is displayed is displayed to the user. > > UPDATE WHILE WRITING THIS EMAIL: > When I was trying to write a unit test for you, I stopped using a JNDI > datasource and still encountered this exception. This leads me to believe > it is not related to TomEE at all and is something I have misconfigured in > Spring somewhere. > > Thanks, > Mike Spencer > > On 07/27/2015 03:45 PM, Romain Manni-Bucau wrote: > >> Do you think you could add a test (even if not executed during the build) >> I >> could use to reproduce? Think it would be the most relevant. BTW not sure >> I >> would get time to install a SQL Server the coming days but running a test >> is fine. >> >> >> Romain Manni-Bucau >> @rmannibucau <https://twitter.com/rmannibucau> | Blog >> <http://rmannibucau.wordpress.com> | Github < >> https://github.com/rmannibucau> | >> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber >> <http://www.tomitribe.com> >> >> 2015-07-27 13:28 GMT-07:00 Mike Spencer <mspen...@denniskirk.com>: >> >> Hi Romain, >>> >>> I realize that SQL Server is probably not the best one to use for a >>> sample >>> project, but I did not know how relevant that would be to my issue. I >>> wanted to replicate things as closely to my real project as possible. I >>> updated the project to use an H2 database instead of SQL Server. >>> >>> That JNDI name works for me. I am using TomEE 1.7.1, if that makes any >>> difference. I am able to query the underlying database but not save to >>> it. >>> >>> Thanks, >>> Mike Spencer >>> >>> On 07/27/2015 02:31 PM, Romain Manni-Bucau wrote: >>> >>> PS: just realized you use an XA DataSource, maybe check end of this >>>> page: >>>> http://tomee.apache.org/datasource-config.html. I'd go with "two >>>> resources >>>> definition" to avoid ambiguities. >>>> >>>> >>>> Romain Manni-Bucau >>>> @rmannibucau <https://twitter.com/rmannibucau> | Blog >>>> <http://rmannibucau.wordpress.com> | Github < >>>> https://github.com/rmannibucau> | >>>> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber >>>> <http://www.tomitribe.com> >>>> >>>> 2015-07-27 12:29 GMT-07:00 Romain Manni-Bucau <rmannibu...@gmail.com>: >>>> >>>> Hi Mike, >>>> >>>>> is it the setup you run on tomee? >>>>> >>>>> java:/jdbc/transaction-ds looks suspicious, should be >>>>> openejb:Resource/jdbc/transaction-ds. Doesnt start out of the box >>>>> locally >>>>> for me at least >>>>> >>>>> >>>>> Side note 1: any way to reproduce it with DB2 or HsqlDB or worse case >>>>> MySQL - SQL Server is not widely installed on our local machines I >>>>> think? >>>>> >>>>> Side note 2: if you dont need TomcatInstrumentableClassLoader in your >>>>> app >>>>> better to not add it >>>>> >>>>> >>>>> Romain Manni-Bucau >>>>> @rmannibucau <https://twitter.com/rmannibucau> | Blog >>>>> <http://rmannibucau.wordpress.com> | Github >>>>> <https://github.com/rmannibucau> | LinkedIn >>>>> <https://www.linkedin.com/in/rmannibucau> | Tomitriber >>>>> <http://www.tomitribe.com> >>>>> >>>>> 2015-07-27 12:13 GMT-07:00 Mike Spencer <mspen...@denniskirk.com>: >>>>> >>>>> I put a sample project on my github page at >>>>> >>>>>> https://github.com/firelore/transaction-test >>>>>> >>>>>> The DataSource definition is in the README.md. For the purposes of the >>>>>> sample project, there is nothing else in the tomee.xml besides the xml >>>>>> declaration and the <tomee> tags. The context.xml was modified to >>>>>> include >>>>>> <Loader >>>>>> >>>>>> >>>>>> loaderClass="org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader"/> >>>>>> as per Spring instructions. >>>>>> >>>>>> Thanks, >>>>>> Mike Spencer >>>>>> >>>>>> On 07/24/2015 11:59 AM, Romain Manni-Bucau wrote: >>>>>> >>>>>> just wanted to ensure figures were moving to validate it was the >>>>>> same >>>>>> >>>>>>> instance. >>>>>>> >>>>>>> Isnt your issue just the rollback which happens and then the tx is >>>>>>> missing? >>>>>>> >>>>>>> if you can reproduce it on a github project it would be easier to >>>>>>> investigate. >>>>>>> >>>>>>> >>>>>>> Romain Manni-Bucau >>>>>>> @rmannibucau <https://twitter.com/rmannibucau> | Blog >>>>>>> <http://rmannibucau.wordpress.com> | Github < >>>>>>> https://github.com/rmannibucau> | >>>>>>> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber >>>>>>> <http://www.tomitribe.com> >>>>>>> >>>>>>> 2015-07-24 9:54 GMT-07:00 Mike Spencer <mspen...@denniskirk.com>: >>>>>>> >>>>>>> Hi Romain, >>>>>>> >>>>>>> JMX (under openejb.management.TransactionManager) is showing commits >>>>>>>> and >>>>>>>> rollbacks, increasing as I use the application. If this is not the >>>>>>>> correct >>>>>>>> instance, what else could it be? >>>>>>>> >>>>>>>> >>>>>>>> On 07/24/2015 09:21 AM, Romain Manni-Bucau wrote: >>>>>>>> >>>>>>>> Yes it is the correct type but wonder if it is the correct >>>>>>>> instance. >>>>>>>> >>>>>>>> In JMX you have nulber of tx and commits, maybe check it as well. >>>>>>>>> Le 24 juil. 2015 15:46, "Andy Gumbrecht" < >>>>>>>>> agumbre...@tomitribe.com> >>>>>>>>> a >>>>>>>>> écrit : >>>>>>>>> >>>>>>>>> Hi Mike, >>>>>>>>> >>>>>>>>> Either add @Stateless to your bean that accesses the db and let >>>>>>>>> >>>>>>>>>> TomEE >>>>>>>>>> manage the transaction, or @Inject UserTransaction trans into your >>>>>>>>>> bean >>>>>>>>>> and >>>>>>>>>> call trans.begin() and trans.commit() >>>>>>>>>> >>>>>>>>>> Andy. >>>>>>>>>> >>>>>>>>>> On 24 July 2015 at 15:05, Mike Spencer <mspen...@denniskirk.com> >>>>>>>>>> wrote: >>>>>>>>>> >>>>>>>>>> Hi Romain, >>>>>>>>>> >>>>>>>>>> I am using Spring's JtaTransactionManager and it is finding a >>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> org.apache.geronimo.transaction.manager.GeronimoTransactionManager >>>>>>>>>>> at >>>>>>>>>>> the >>>>>>>>>>> JNDI location java:comp/UserTransaction. Is this the correct >>>>>>>>>>> transaction >>>>>>>>>>> manager to be using? >>>>>>>>>>> >>>>>>>>>>> Thanks, >>>>>>>>>>> Mike Spencer >>>>>>>>>>> >>>>>>>>>>> On 07/23/2015 04:11 PM, Romain Manni-Bucau wrote: >>>>>>>>>>> >>>>>>>>>>> Hi >>>>>>>>>>> >>>>>>>>>>> isnt it only that spring is not able to lookup tomee tx magaer >>>>>>>>>>> by >>>>>>>>>>> >>>>>>>>>>>> default? >>>>>>>>>>>> >>>>>>>>>>>> try to wire it in your app ctx. >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>> http://grepcode.com/file/repo1.maven.org/maven2/org.apache.openejb/openejb-core/4.7.1/org/apache/openejb/OpenEJB.java#OpenEJB.getTransactionManager%28%29 >>>>>>>>>> >>>>>>>>>> is the one (doable using methid invoker of spring IIRC) >>>>>>>>>> >>>>>>>>>> Romain Manni-Bucau >>>>>>>>>>> >>>>>>>>>>>> @rmannibucau <https://twitter.com/rmannibucau> | Blog >>>>>>>>>>>> <http://rmannibucau.wordpress.com> | Github < >>>>>>>>>>>> https://github.com/rmannibucau> | >>>>>>>>>>>> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber >>>>>>>>>>>> <http://www.tomitribe.com> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> 2015-07-23 14:04 GMT-07:00 Mike Spencer < >>>>>>>>>>>> mspen...@denniskirk.com >>>>>>>>>>>> >>>>>>>>>>>>> : >>>>>>>>>>>>> >>>>>>>>>>>> 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 >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> >>>>>>>>>>>>> -- >>>>>>>>>>>>> >>>>>>>>>>>>> Andy Gumbrecht >>>>>>>>>>>> >>>>>>>>>>> https://twitter.com/AndyGeeDe >>>>>>>>>> http://www.tomitribe.com >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >