[1] is a snippet from the stacktrace I get when using pax-jdbc-pool-dbcp2 instead of -aries. As you can see, ManagedJDBCConnection#localTransactionStart appears to call setAutoCommit on the connection class, which the DBCP2 impl short circuits at [2].
This same exact environment seems to run fine with the -aries pool bundle. I am running this with a customized transactions-jdbc bundle checked-out from SVN. But, the only change I made was the pull in all the tranql source to fix issues with the two-arg form of getConnection in some of those classes. Aside from that it's unchanged and works fine with the -aries pooling bundle. Any suggestions are greatly appreciated. [1] Caused by: javax.resource.spi.LocalTransactionException: Unable to disable autoCommit at org.tranql.connector.jdbc.ManagedJDBCConnection.localTransactionStart(Manage dJDBCConnection.java:83) ~[org.apache.aries.transaction.jdbc-2.1.2-SNAPSHOT.jar:2.1.2-SNAPSHOT] at org.tranql.connector.AbstractManagedConnection$LocalTransactionImpl.begin(Ab stractManagedConnection.java:195) ~[org.apache.aries.transaction.jdbc-2.1.2-SNAPSHOT.jar:2.1.2-SNAPSHOT] at org.apache.geronimo.connector.outbound.LocalXAResource.start(LocalXAResource .java:107) ~[geronimo-connector-3.1.3.jar:3.1.3] ... 76 common frames omitted Caused by: java.sql.SQLException: Auto-commit can not be set while enrolled in a transaction at org.apache.commons.dbcp2.managed.ManagedConnection.setAutoCommit(ManagedConn ection.java:223) ~[na:na] at org.tranql.connector.jdbc.ManagedJDBCConnection.localTransactionStart(Manage dJDBCConnection.java:81) ~[org.apache.aries.transaction.jdbc-2.1.2-SNAPSHOT.jar:2.1.2-SNAPSHOT] ... 78 common frames omitted [2] public void setAutoCommit(boolean autoCommit) throws SQLException { if (transactionContext != null) { throw new SQLException("Auto-commit can not be set while enrolled in a trans action"); } super.setAutoCommit(autoCommit); } -----Original Message----- From: matthew.w.pi...@wellsfargo.com [mailto:matthew.w.pi...@wellsfargo.com] Sent: Tuesday, September 22, 2015 11:14 AM To: user@aries.apache.org Subject: RE: Bundle set recommendations for JPA+JTA+Eclipselink Partitioning? Thanks very much for the references, I will definitely be looking over them. I was hoping the dbcp2 bundle would allow for the same XA capability, as I would prefer dbcp2 pooling since it seems fairly analogous to my current pooling - bonecp. However, I did some testing with dbcp2 and got exceptions during runtime when code from base datasource wrappers (from tranql maybe) was attempting to set the auto-commit flag and the DBCP datasource wrapper class was throwing an exception about setting auto-commit. I can't remember exactly the code flow but I'll try to test this again and see about getting a stacktrace. Does any of this sound familiar? Should I be able to simply replace pax-jdbc-pool-aries with pax-jdbc-pool-dbcp2 in my runtime? Maybe it was something in my jndi references not getting the aries-managed datasource services. As for the blueprint/DS question, I will be largely using DS to inject app-specific API that gives my code access to the JpaTemplate/EntityManager classes. I hope to move toward blueprint, but that will be another effort. Thanks again, -matt -----Original Message----- From: Christian Schneider [mailto:cschneider...@gmail.com] On Behalf Of Christian Schneider Sent: Tuesday, September 22, 2015 10:24 AM To: user@aries.apache.org Subject: Re: Bundle set recommendations for JPA+JTA+Eclipselink Partitioning? Hi Matthew, pax-jdbc-pool-dbcp2 as well as pax-jdbc-pool-aries should both be able to provide XA enlisting poolable DataSources. Aries JPA and Transaction actually use the above in their integration tests. So they should work together nicely. I got two tutorials that both use XA transactions with Aries: http://liquid-reality.de/display/liquid/2015/06/30/Apache+Karaf+Tutorial+par t+10+-+Declarative+services http://liquid-reality.de/display/liquid/2015/03/05/Apache+Karaf+Tutorial+Par t+9+-+Annotation+based+blueprint+and+JPA Btw. Do you plan to use blueprint or DS? Christian On 03.09.2015 22:51, matthew.w.pi...@wellsfargo.com wrote: > Ok, maybe I can answer my own questions here, but if I could get some > confirmation that would be great. I seem to have a working system running > with ops4j-pax-jdbc-pool-aries rather than dbcp2. > > Digging into the code in org.apache.aries.transaction.jdbc it looks like > RecoverableDataSource is the wrapper for my XADataSources and it does indeed > appear to support passing of pooling options onto ConnectionManagerFactory > which itself appears to use the pooling capabilities that come from the > Geronimo bundles. Does all this sound correct so far? > > So, it's not dbcp2, but it's pooling nonetheless and I can adjust > preferences by passing the appropriate bean options to my pax-jdbc service > with the 'pool.' prefix which will in-turn send those on to the > RecoverableDataSource instance. Sound ok still? > > And finally, my eclipselink JTA datasource JNDI lookups are formatted with > filters for the 'aries.managed' property [1] to ensure that I get the aries > auto-enlisting DataSources. > > So far, this is running my existing code ok with only two changes I had to > make: > > 1. Fixed ARIES-1171, but actually in the Tranql code as I was getting > connection errors and didn't see a logical place to fix it from an aries > class (using latest aries-transaction-jdbc from SVN). This required bringing > all the tranql source into my aries bundle and just removing the external > dependency. I didn't like doing that, but since that code hasn't changed in > a while and I'm still prototyping all this it was the path of least > resistance. > > 2. Changed RecoverableDataSource to not use empty strings by default for > username and password. Which seemed to be similar/related to the above and I > posted as ARIES-1376. > > Thoughts and criticisms welcome. Thanks! > > [1] > osgi:service/javax.sql.DataSource/(&(osgi.jndi.service.name=my-app-node1)(ar > ies.managed=true)) > > -----Original Message----- > From: matthew.w.pi...@wellsfargo.com [mailto:matthew.w.pi...@wellsfargo.com] > > Sent: Thursday, September 03, 2015 10:58 AM > To: user@aries.apache.org > Subject: Bundle set recommendations for JPA+JTA+Eclipselink Partitioning? > > I am in the process of refactoring an existing JPA/Eclipselink-based > application to introduce Eclipselink's partitioning support for database > sharding. My current application runs quite well with pooled jdbc > connections via boncep. > > However, with the sharded model there will be a number of entity types that > are Replicated to all shards and, as such, eclipselink will be doing writes > that span multiple jdbc connections. Per the eclipselink recommendations for > paritioning I would like to introduce JTA in order to enforce integrity > across commits that hit multiple partitions. > > It seems like the ops4j-pax-jdbc bundles are designed to support XA/JTA and > it seems like there is a lot of XA support in the various aries bundles > (aries.transaction. and aries.jpa.). However, I'm not sure of what > combination of these bundles+configuration will provide what I am after. > Since many of these bundles seem to be designed/documented around general > JTA usage - like performing a transaction that spans JMS and JDBC - I'm not > confident if that model works with my particular use case. > > To further add to this, I would like for my JDBC connections to be pooled > for performance. ops4j-pax-jdbc-pool-dbcp2 seems like a logical choice, but > again I'm not sure if it will play nicely with the transaction management > features from aries. > > I think I have a working model of this, but I'm rather new to XA/JTA > especially from OSGi so I want to make sure I'm getting this correct. So, I > guess my questions are: > > 1. Can ops4j-pax-jdbc-pool and it's dbcp2 sibling work with > aries-jpa/transaction to pool and auto-enlist XADataSources? > > 2. If not, will ops4j-pax-jdbc-pool-aries work? And if so, can its pooling > semantics be configured? E.g. minIdle, maxIdle, etc. > > 3. If neither of the above works, is there a recommended set of bundles to > accomplish pooled XADataSources with eclipselink+JTA? > > > Thanks, > > > Matthew Pitts > > Developer > Security Solutions Design & Automation > > Wells Fargo Bank | Tel 336.608.3332 | Cell 336.202.3913 | Kernersville, NC | > MAC D9693-010 > matthew.w.pi...@wellsfargo.com > > -- Christian Schneider http://www.liquid-reality.de Open Source Architect http://www.talend.com
smime.p7s
Description: S/MIME cryptographic signature