Re: TomEE 1.5.1-SNAPSHOT: strange JPA behavior
Hi Romain, Hi all, finally I wrote a little sample to reproduce the strange JPA behavior. Please, download it from github: git clone https://github.com/diuis/test-jpa-tx.git change directory: cd test-jpa-tx/ and run TomEE 1.5.1: mvn package tomee:run I wrote a simple REST service; you could open these urls: http://localhost:8080/test-jpa-tx-0.0.1-SNAPSHOT/start/tx1 The 'tx1 service' open a connection to the first persistence unit (PUBLIC is the CATALOG and sa1 the username). http://localhost:8080/test-jpa-tx-0.0.1-SNAPSHOT/start/tx2 The 'tx2 service' open a connection to the second persistence unit (PUBLIC is the CATALOG and sa2 the username). http://localhost:8080/test-jpa-tx-0.0.1-SNAPSHOT/start/tx The 'tx service' uses both the persistence units, but first, in the same ejb transaction, and after in two different transactions. When the transaction is the same, I guess that the second entity manager takes the already opened db connection, instead of the connection of the datasource configured in the persistence.xml. I have not used the XA jdbc driver in this test, but I used it in my real application, where I have two different databases (MySQL and H2) and the result is the same. Thank for the support, Demis Gallisto -- View this message in context: http://openejb.979440.n4.nabble.com/TomEE-1-5-1-SNAPSHOT-strange-JPA-behavior-tp4658500p4660225.html Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: TomEE 1.5.1-SNAPSHOT: strange JPA behavior
Thanks for the report! Here the fix: https://issues.apache.org/jira/browse/TOMEE-720 Using commons dbcp instead of tomcat jdbc you shouldn't get this behavior *Romain Manni-Bucau* *Twitter: @rmannibucau https://twitter.com/rmannibucau* *Blog: **http://rmannibucau.wordpress.com/*http://rmannibucau.wordpress.com/ *LinkedIn: **http://fr.linkedin.com/in/rmannibucau* *Github: https://github.com/rmannibucau* 2013/1/10 diuis di...@yahoo.it Hi Romain, Hi all, finally I wrote a little sample to reproduce the strange JPA behavior. Please, download it from github: git clone https://github.com/diuis/test-jpa-tx.git change directory: cd test-jpa-tx/ and run TomEE 1.5.1: mvn package tomee:run I wrote a simple REST service; you could open these urls: http://localhost:8080/test-jpa-tx-0.0.1-SNAPSHOT/start/tx1 The 'tx1 service' open a connection to the first persistence unit (PUBLIC is the CATALOG and sa1 the username). http://localhost:8080/test-jpa-tx-0.0.1-SNAPSHOT/start/tx2 The 'tx2 service' open a connection to the second persistence unit (PUBLIC is the CATALOG and sa2 the username). http://localhost:8080/test-jpa-tx-0.0.1-SNAPSHOT/start/tx The 'tx service' uses both the persistence units, but first, in the same ejb transaction, and after in two different transactions. When the transaction is the same, I guess that the second entity manager takes the already opened db connection, instead of the connection of the datasource configured in the persistence.xml. I have not used the XA jdbc driver in this test, but I used it in my real application, where I have two different databases (MySQL and H2) and the result is the same. Thank for the support, Demis Gallisto -- View this message in context: http://openejb.979440.n4.nabble.com/TomEE-1-5-1-SNAPSHOT-strange-JPA-behavior-tp4658500p4660225.html Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: TomEE 1.5.1-SNAPSHOT: strange JPA behavior
Hi Romain, yes, there are the 'adujsting persistence unit' lines in the log. INFO: Auto-linking resource-ref 'jdbc/quartz' in bean bravofly-scheduler-2.0-SNAPSHOT.Comp to Resource(id=jdbc/indexer) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/indexer' in bean bravofly-scheduler-2.0-SNAPSHOT.Comp to Resource(id=jdbc/indexer) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/volagratis' in bean bravofly-scheduler-2.0-SNAPSHOT.Comp to Resource(id=jdbc/volagratis) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/quartz' in bean BookingIndexerScheduler to Resource(id=jdbc/indexer) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/indexer' in bean BookingIndexerScheduler to Resource(id=jdbc/indexer) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/volagratis' in bean BookingIndexerScheduler to Resource(id=jdbc/volagratis) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/quartz' in bean bookingIndexerFacade to Resource(id=jdbc/indexer) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/indexer' in bean bookingIndexerFacade to Resource(id=jdbc/indexer) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/volagratis' in bean bookingIndexerFacade to Resource(id=jdbc/volagratis) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/quartz' in bean jobConfigService to Resource(id=jdbc/indexer) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/indexer' in bean jobConfigService to Resource(id=jdbc/indexer) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/volagratis' in bean jobConfigService to Resource(id=jdbc/volagratis) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/quartz' in bean bookingIdsToIndexService to Resource(id=jdbc/indexer) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/indexer' in bean bookingIdsToIndexService to Resource(id=jdbc/indexer) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/volagratis' in bean bookingIdsToIndexService to Resource(id=jdbc/volagratis) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/quartz' in bean lastUpdateTimeService to Resource(id=jdbc/indexer) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/indexer' in bean lastUpdateTimeService to Resource(id=jdbc/indexer) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/volagratis' in bean lastUpdateTimeService to Resource(id=jdbc/volagratis) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/quartz' in bean bookingAuditService to Resource(id=jdbc/indexer) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/indexer' in bean bookingAuditService to Resource(id=jdbc/indexer) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/volagratis' in bean bookingAuditService to Resource(id=jdbc/volagratis) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig deploy INFO: Configuring PersistenceUnit(name=pu2) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig logAutoCreateResource INFO: Auto-creating a Resource with id 'jdbc/volagratisNonJta' of type 'DataSource for 'pu2'. Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig deploy INFO: Configuring Service(id=jdbc/volagratisNonJta, type=Resource, provider-id=jdbc/volagratis) Nov 12, 2012 9:44:35 AM org.apache.openejb.assembler.classic.Assembler createRecipe INFO: Creating Resource(id=jdbc/volagratisNonJta) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig setNonJtaDataSource INFO: Adjusting PersistenceUnit pu2 non-jta-data-source to Resource ID 'jdbc/volagratisNonJta' from 'null' Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig deploy INFO: Configuring PersistenceUnit(name=pu1) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig logAutoCreateResource INFO: Auto-creating a Resource with id
Re: TomEE 1.5.1-SNAPSHOT: strange JPA behavior
It seems not that bad do you think you can reproduce it in a unit test or a simple maven/ant/gradle project? *Romain Manni-Bucau* *Twitter: @rmannibucau https://twitter.com/rmannibucau* *Blog: **http://rmannibucau.wordpress.com/*http://rmannibucau.wordpress.com/ *LinkedIn: **http://fr.linkedin.com/in/rmannibucau* *Github: https://github.com/rmannibucau* 2012/11/12 diuis di...@yahoo.it Hi Romain, yes, there are the 'adujsting persistence unit' lines in the log. INFO: Auto-linking resource-ref 'jdbc/quartz' in bean bravofly-scheduler-2.0-SNAPSHOT.Comp to Resource(id=jdbc/indexer) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/indexer' in bean bravofly-scheduler-2.0-SNAPSHOT.Comp to Resource(id=jdbc/indexer) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/volagratis' in bean bravofly-scheduler-2.0-SNAPSHOT.Comp to Resource(id=jdbc/volagratis) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/quartz' in bean BookingIndexerScheduler to Resource(id=jdbc/indexer) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/indexer' in bean BookingIndexerScheduler to Resource(id=jdbc/indexer) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/volagratis' in bean BookingIndexerScheduler to Resource(id=jdbc/volagratis) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/quartz' in bean bookingIndexerFacade to Resource(id=jdbc/indexer) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/indexer' in bean bookingIndexerFacade to Resource(id=jdbc/indexer) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/volagratis' in bean bookingIndexerFacade to Resource(id=jdbc/volagratis) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/quartz' in bean jobConfigService to Resource(id=jdbc/indexer) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/indexer' in bean jobConfigService to Resource(id=jdbc/indexer) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/volagratis' in bean jobConfigService to Resource(id=jdbc/volagratis) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/quartz' in bean bookingIdsToIndexService to Resource(id=jdbc/indexer) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/indexer' in bean bookingIdsToIndexService to Resource(id=jdbc/indexer) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/volagratis' in bean bookingIdsToIndexService to Resource(id=jdbc/volagratis) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/quartz' in bean lastUpdateTimeService to Resource(id=jdbc/indexer) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/indexer' in bean lastUpdateTimeService to Resource(id=jdbc/indexer) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/volagratis' in bean lastUpdateTimeService to Resource(id=jdbc/volagratis) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/quartz' in bean bookingAuditService to Resource(id=jdbc/indexer) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/indexer' in bean bookingAuditService to Resource(id=jdbc/indexer) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig processResourceRef INFO: Auto-linking resource-ref 'jdbc/volagratis' in bean bookingAuditService to Resource(id=jdbc/volagratis) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig deploy INFO: Configuring PersistenceUnit(name=pu2) Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig logAutoCreateResource INFO: Auto-creating a Resource with id 'jdbc/volagratisNonJta' of type 'DataSource for 'pu2'. Nov 12, 2012 9:44:35 AM org.apache.openejb.config.AutoConfig deploy INFO: Configuring Service(id=jdbc/volagratisNonJta, type=Resource, provider-id=jdbc/volagratis) Nov 12, 2012 9:44:35 AM org.apache.openejb.assembler.classic.Assembler
Re: TomEE 1.5.1-SNAPSHOT: strange JPA behavior
I can try. Thank you, Demis Gallisto -- View this message in context: http://openejb.979440.n4.nabble.com/TomEE-1-5-1-SNAPSHOT-strange-JPA-behavior-tp4658500p4658533.html Sent from the OpenEJB User mailing list archive at Nabble.com.