pax-jdbc-config connection pool configuration

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

pax-jdbc-config connection pool configuration

Alex Soto
Using Karaf  4.2.0, I am trying to configure connection pool using pax-jdbc-config  approach.  I installed features:

pax-jdbc-mariadb
pax-jdbc-config
pax-jdbc-pool-dbcp2



I dropped a org.ops4j.datasource-responder.cfg file in the etc directory:

osgi.jdbc.driver.name = mariadb
dataSourceName=responder
url = jdbc:<a href="mariadb://localhost:3306/responder" class="">mariadb://localhost:3306/responder
user=XXXX
password=XXXX
pool=dbcp2
xa=true
databaseName=responder
jdbc.pool.maxTotal=8


The last line causes this error:

cannot set properties [pool.maxTotal]
java.sql.SQLException: cannot set properties [pool.maxTotal]
at org.ops4j.pax.jdbc.mariadb.impl.MariaDbDataSourceFactory.setProperties(MariaDbDataSourceFactory.java:70) ~[?:?]
at org.ops4j.pax.jdbc.mariadb.impl.MariaDbDataSourceFactory.createDataSource(MariaDbDataSourceFactory.java:36) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceRegistration.createDs(DataSourceRegistration.java:134) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceRegistration.<init>(DataSourceRegistration.java:80) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$null$0(DataSourceConfigManager.java:81) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper$1.addingService(ServiceTrackerHelper.java:131) ~[?:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941) ~[?:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183) ~[?:?]
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318) ~[?:?]
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:140) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$null$1(DataSourceConfigManager.java:77) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:146) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:85) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$null$2(DataSourceConfigManager.java:76) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper$1.addingService(ServiceTrackerHelper.java:131) ~[?:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941) ~[?:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183) ~[?:?]
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318) ~[?:?]
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:140) ~[14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:85) ~[14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$updated$3(DataSourceConfigManager.java:75) ~[14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:146) [14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:85) [14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.updated(DataSourceConfigManager.java:74) [14:org.ops4j.pax.jdbc.config:1.2.0]
at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.updated(ManagedServiceFactoryTracker.java:159) [8:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.provideConfiguration(ManagedServiceFactoryTracker.java:93) [8:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.ConfigurationManager$UpdateConfiguration.run(ConfigurationManager.java:1792) [8:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141) [8:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109) [8:org.apache.felix.configadmin:1.8.16]
at java.lang.Thread.run(Thread.java:748) [?:?]


How do I configure the various parameters of the connection pool?


Best regards,
Alex soto




Reply | Threaded
Open this post in threaded view
|

Re: pax-jdbc-config connection pool configuration

jbonofre
Hi Alex,

the MariaDbDataSourceFactory uses MySQLDataSource internally. And the
properties is not passed in the factory.

Can you please create a Jira at pax jdbc ?

Thanks
Regards
JB

On 14/05/2018 21:47, Alex Soto wrote:

> Using Karaf  4.2.0, I am trying to configure connection pool
> using pax-jdbc-config  approach.  I installed features:
>
>     pax-jdbc-mariadb
>     pax-jdbc-config
>     pax-jdbc-pool-dbcp2
>
>
>
>
> I dropped a /org.ops4j.datasource-responder.cfg/ file in the etc directory:
>
>
>     osgi.jdbc.driver.name = mariadb
>     dataSourceName=responder
>     url = jdbc:mariadb://localhost:3306/responder
>     user=XXXX
>     password=XXXX
>     pool=dbcp2
>     xa=true
>     databaseName=responder
>     jdbc.pool.maxTotal=8
>
>
> The last line causes this error:
>
>     cannot set properties [pool.maxTotal]
>     java.sql.SQLException: cannot set properties [pool.maxTotal]
>     at org.ops4j.pax.jdbc.mariadb.impl.MariaDbDataSourceFactory.setProperties(MariaDbDataSourceFactory.java:70)
>     ~[?:?]
>     at org.ops4j.pax.jdbc.mariadb.impl.MariaDbDataSourceFactory.createDataSource(MariaDbDataSourceFactory.java:36)
>     ~[?:?]
>     at
>     org.ops4j.pax.jdbc.config.impl.DataSourceRegistration.createDs(DataSourceRegistration.java:134)
>     ~[?:?]
>     at
>     org.ops4j.pax.jdbc.config.impl.DataSourceRegistration.<init>(DataSourceRegistration.java:80)
>     ~[?:?]
>     at
>     org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$null$0(DataSourceConfigManager.java:81)
>     ~[?:?]
>     at
>     org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper$1.addingService(ServiceTrackerHelper.java:131)
>     ~[?:?]
>     at
>     org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
>     ~[?:?]
>     at
>     org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870)
>     ~[?:?]
>     at
>     org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
>     ~[?:?]
>     at
>     org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)
>     ~[?:?]
>     at
>     org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318)
>     ~[?:?]
>     at
>     org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261)
>     ~[?:?]
>     at
>     org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:140)
>     ~[?:?]
>     at
>     org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$null$1(DataSourceConfigManager.java:77)
>     ~[?:?]
>     at
>     org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:146)
>     ~[?:?]
>     at
>     org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:85)
>     ~[?:?]
>     at
>     org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$null$2(DataSourceConfigManager.java:76)
>     ~[?:?]
>     at
>     org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper$1.addingService(ServiceTrackerHelper.java:131)
>     ~[?:?]
>     at
>     org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
>     ~[?:?]
>     at
>     org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870)
>     ~[?:?]
>     at
>     org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
>     ~[?:?]
>     at
>     org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)
>     ~[?:?]
>     at
>     org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318)
>     ~[?:?]
>     at
>     org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261)
>     ~[?:?]
>     at
>     org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:140)
>     ~[14:org.ops4j.pax.jdbc.config:1.2.0]
>     at
>     org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:85)
>     ~[14:org.ops4j.pax.jdbc.config:1.2.0]
>     at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$updated$3(DataSourceConfigManager.java:75)
>     ~[14:org.ops4j.pax.jdbc.config:1.2.0]
>     at
>     org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:146) [14:org.ops4j.pax.jdbc.config:1.2.0]
>     at
>     org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:85) [14:org.ops4j.pax.jdbc.config:1.2.0]
>     at
>     org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.updated(DataSourceConfigManager.java:74) [14:org.ops4j.pax.jdbc.config:1.2.0]
>     at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.updated(ManagedServiceFactoryTracker.java:159) [8:org.apache.felix.configadmin:1.8.16]
>     at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.provideConfiguration(ManagedServiceFactoryTracker.java:93)
>     [8:org.apache.felix.configadmin:1.8.16]
>     at
>     org.apache.felix.cm.impl.ConfigurationManager$UpdateConfiguration.run(ConfigurationManager.java:1792) [8:org.apache.felix.configadmin:1.8.16]
>     at
>     org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141) [8:org.apache.felix.configadmin:1.8.16]
>     at
>     org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109) [8:org.apache.felix.configadmin:1.8.16]
>     at java.lang.Thread.run(Thread.java:748) [?:?]
>
>
>
> How do I configure the various parameters of the connection pool?
>
>
> Best regards,
> Alex soto
>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: pax-jdbc-config connection pool configuration

Alex Soto
Sure, but I can’t find where, can you share a link?

Best regards,
Alex soto




On May 14, 2018, at 4:07 PM, Jean-Baptiste Onofré <[hidden email]> wrote:

Hi Alex,

the MariaDbDataSourceFactory uses MySQLDataSource internally. And the properties is not passed in the factory.

Can you please create a Jira at pax jdbc ?

Thanks
Regards
JB

On 14/05/2018 21:47, Alex Soto wrote:
Using Karaf  4.2.0, I am trying to configure connection pool using pax-jdbc-config  approach.  I installed features:
   pax-jdbc-mariadb
   pax-jdbc-config
   pax-jdbc-pool-dbcp2
I dropped a /org.ops4j.datasource-responder.cfg/ file in the etc directory:
   osgi.jdbc.driver.name = mariadb
   dataSourceName=responder
   url = jdbc:<a href="mariadb://localhost:3306/responder" class="">mariadb://localhost:3306/responder
   user=XXXX
   password=XXXX
   pool=dbcp2
   xa=true
   databaseName=responder
   jdbc.pool.maxTotal=8
The last line causes this error:
   cannot set properties [pool.maxTotal]
   java.sql.SQLException: cannot set properties [pool.maxTotal]
   at org.ops4j.pax.jdbc.mariadb.impl.MariaDbDataSourceFactory.setProperties(MariaDbDataSourceFactory.java:70)
   ~[?:?]
   at org.ops4j.pax.jdbc.mariadb.impl.MariaDbDataSourceFactory.createDataSource(MariaDbDataSourceFactory.java:36)
   ~[?:?]
   at
   org.ops4j.pax.jdbc.config.impl.DataSourceRegistration.createDs(DataSourceRegistration.java:134)
   ~[?:?]
   at
   org.ops4j.pax.jdbc.config.impl.DataSourceRegistration.<init>(DataSourceRegistration.java:80)
   ~[?:?]
   at
   org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$null$0(DataSourceConfigManager.java:81)
   ~[?:?]
   at
   org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper$1.addingService(ServiceTrackerHelper.java:131)
   ~[?:?]
   at
   org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
   ~[?:?]
   at
   org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870)
   ~[?:?]
   at
   org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
   ~[?:?]
   at
   org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)
   ~[?:?]
   at
   org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318)
   ~[?:?]
   at
   org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261)
   ~[?:?]
   at
   org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:140)
   ~[?:?]
   at
   org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$null$1(DataSourceConfigManager.java:77)
   ~[?:?]
   at
   org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:146)
   ~[?:?]
   at
   org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:85)
   ~[?:?]
   at
   org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$null$2(DataSourceConfigManager.java:76)
   ~[?:?]
   at
   org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper$1.addingService(ServiceTrackerHelper.java:131)
   ~[?:?]
   at
   org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
   ~[?:?]
   at
   org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870)
   ~[?:?]
   at
   org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
   ~[?:?]
   at
   org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)
   ~[?:?]
   at
   org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318)
   ~[?:?]
   at
   org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261)
   ~[?:?]
   at
   org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:140)
   ~[14:org.ops4j.pax.jdbc.config:1.2.0]
   at
   org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:85)
   ~[14:org.ops4j.pax.jdbc.config:1.2.0]
   at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$updated$3(DataSourceConfigManager.java:75)
   ~[14:org.ops4j.pax.jdbc.config:1.2.0]
   at
   org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:146) [14:org.ops4j.pax.jdbc.config:1.2.0]
   at
   org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:85) [14:org.ops4j.pax.jdbc.config:1.2.0]
   at
   org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.updated(DataSourceConfigManager.java:74) [14:org.ops4j.pax.jdbc.config:1.2.0]
   at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.updated(ManagedServiceFactoryTracker.java:159) [8:org.apache.felix.configadmin:1.8.16]
   at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.provideConfiguration(ManagedServiceFactoryTracker.java:93)
   [8:org.apache.felix.configadmin:1.8.16]
   at
   org.apache.felix.cm.impl.ConfigurationManager$UpdateConfiguration.run(ConfigurationManager.java:1792) [8:org.apache.felix.configadmin:1.8.16]
   at
   org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141) [8:org.apache.felix.configadmin:1.8.16]
   at
   org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109) [8:org.apache.felix.configadmin:1.8.16]
   at java.lang.Thread.run(Thread.java:748) [?:?]
How do I configure the various parameters of the connection pool?
Best regards,
Alex soto

Reply | Threaded
Open this post in threaded view
|

Re: pax-jdbc-config connection pool configuration

cschneider
In reply to this post by Alex Soto
The docs indeed show to use jdbc.pool.maxTotal but in the code I see that the pool properties are filtered using "pool." 

See:
https://github.com/ops4j/org.ops4j.pax.jdbc/blob/master/pax-jdbc-pool-dbcp2/src/main/java/org/ops4j/pax/jdbc/pool/dbcp2/impl/DbcpPooledDataSourceFactory.java

So can you try with pool.maxTotal? Still this is a bug - either the docs or the code is wrong.

You can find the link to the issue tracker on the top level of the code base in the README:

Be aware though that you need to ask for a jira user on the ops4j list (ops4j@googlegroups.com) first. 
The self registration is switched off as there was lots of spam.

Christian


2018-05-14 21:47 GMT+02:00 Alex Soto <[hidden email]>:
Using Karaf  4.2.0, I am trying to configure connection pool using pax-jdbc-config  approach.  I installed features:

pax-jdbc-mariadb
pax-jdbc-config
pax-jdbc-pool-dbcp2



I dropped a org.ops4j.datasource-responder.cfg file in the etc directory:

dataSourceName=responder
user=XXXX
password=XXXX
pool=dbcp2
xa=true
databaseName=responder
jdbc.pool.maxTotal=8


The last line causes this error:

cannot set properties [pool.maxTotal]
java.sql.SQLException: cannot set properties [pool.maxTotal]
at org.ops4j.pax.jdbc.mariadb.impl.MariaDbDataSourceFactory.setProperties(MariaDbDataSourceFactory.java:70) ~[?:?]
at org.ops4j.pax.jdbc.mariadb.impl.MariaDbDataSourceFactory.createDataSource(MariaDbDataSourceFactory.java:36) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceRegistration.createDs(DataSourceRegistration.java:134) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceRegistration.<init>(DataSourceRegistration.java:80) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$null$0(DataSourceConfigManager.java:81) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper$1.addingService(ServiceTrackerHelper.java:131) ~[?:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941) ~[?:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183) ~[?:?]
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318) ~[?:?]
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:140) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$null$1(DataSourceConfigManager.java:77) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:146) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:85) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$null$2(DataSourceConfigManager.java:76) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper$1.addingService(ServiceTrackerHelper.java:131) ~[?:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941) ~[?:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183) ~[?:?]
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318) ~[?:?]
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:140) ~[14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:85) ~[14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$updated$3(DataSourceConfigManager.java:75) ~[14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:146) [14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:85) [14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.updated(DataSourceConfigManager.java:74) [14:org.ops4j.pax.jdbc.config:1.2.0]
at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.updated(ManagedServiceFactoryTracker.java:159) [8:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.provideConfiguration(ManagedServiceFactoryTracker.java:93) [8:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.ConfigurationManager$UpdateConfiguration.run(ConfigurationManager.java:1792) [8:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141) [8:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109) [8:org.apache.felix.configadmin:1.8.16]
at java.lang.Thread.run(Thread.java:748) [?:?]


How do I configure the various parameters of the connection pool?


Best regards,
Alex soto







--
--
Christian Schneider

http://www.liquid-reality.de

Computer Scientist

Reply | Threaded
Open this post in threaded view
|

Re: pax-jdbc-config connection pool configuration

Tim Ward-2
Another option for connection pooling would be to use the OSGi Transaction Control service from the R7 release. The resource providers all give implicit support for pooling, and the Aries implementation allows you to create them purely from configuration. 

The transaction control service also provides a more reliable mechanism for managing the transaction lifecycle than proxying/annotations. 

There’s a post about Transaction Control on the OSGi blog at https://blog.osgi.org/2018/05/osgi-r7-highlights-transaction-control.html and documentation at Apache Aries. The 1.0.0 release happened about two weeks ago and has been tested in Karaf.

Best Regards,

Tim

Sent from my iPhone

On 15 May 2018, at 08:37, Christian Schneider <[hidden email]> wrote:

The docs indeed show to use jdbc.pool.maxTotal but in the code I see that the pool properties are filtered using "pool." 

See:
https://github.com/ops4j/org.ops4j.pax.jdbc/blob/master/pax-jdbc-pool-dbcp2/src/main/java/org/ops4j/pax/jdbc/pool/dbcp2/impl/DbcpPooledDataSourceFactory.java

So can you try with pool.maxTotal? Still this is a bug - either the docs or the code is wrong.

You can find the link to the issue tracker on the top level of the code base in the README:

Be aware though that you need to ask for a jira user on the ops4j list (ops4j@googlegroups.com) first. 
The self registration is switched off as there was lots of spam.

Christian


2018-05-14 21:47 GMT+02:00 Alex Soto <[hidden email]>:
Using Karaf  4.2.0, I am trying to configure connection pool using pax-jdbc-config  approach.  I installed features:

pax-jdbc-mariadb
pax-jdbc-config
pax-jdbc-pool-dbcp2



I dropped a org.ops4j.datasource-responder.cfg file in the etc directory:

dataSourceName=responder
user=XXXX
password=XXXX
pool=dbcp2
xa=true
databaseName=responder
jdbc.pool.maxTotal=8


The last line causes this error:

cannot set properties [pool.maxTotal]
java.sql.SQLException: cannot set properties [pool.maxTotal]
at org.ops4j.pax.jdbc.mariadb.impl.MariaDbDataSourceFactory.setProperties(MariaDbDataSourceFactory.java:70) ~[?:?]
at org.ops4j.pax.jdbc.mariadb.impl.MariaDbDataSourceFactory.createDataSource(MariaDbDataSourceFactory.java:36) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceRegistration.createDs(DataSourceRegistration.java:134) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceRegistration.<init>(DataSourceRegistration.java:80) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$null$0(DataSourceConfigManager.java:81) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper$1.addingService(ServiceTrackerHelper.java:131) ~[?:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941) ~[?:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183) ~[?:?]
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318) ~[?:?]
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:140) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$null$1(DataSourceConfigManager.java:77) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:146) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:85) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$null$2(DataSourceConfigManager.java:76) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper$1.addingService(ServiceTrackerHelper.java:131) ~[?:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941) ~[?:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183) ~[?:?]
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318) ~[?:?]
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:140) ~[14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:85) ~[14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$updated$3(DataSourceConfigManager.java:75) ~[14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:146) [14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:85) [14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.updated(DataSourceConfigManager.java:74) [14:org.ops4j.pax.jdbc.config:1.2.0]
at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.updated(ManagedServiceFactoryTracker.java:159) [8:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.provideConfiguration(ManagedServiceFactoryTracker.java:93) [8:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.ConfigurationManager$UpdateConfiguration.run(ConfigurationManager.java:1792) [8:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141) [8:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109) [8:org.apache.felix.configadmin:1.8.16]
at java.lang.Thread.run(Thread.java:748) [?:?]


How do I configure the various parameters of the connection pool?


Best regards,
Alex soto







--
--
Christian Schneider

http://www.liquid-reality.de

Computer Scientist

Reply | Threaded
Open this post in threaded view
|

Re: pax-jdbc-config connection pool configuration

Alex Soto
In reply to this post by cschneider
I am requesting the access to create the issue. 

Using “pool” does not work either.

In the mean time, which Pool should I use?, I looked at Hikari, but I see a comment that says:  “XA datasources are not supported.”


Best regards,
Alex soto




On May 15, 2018, at 2:37 AM, Christian Schneider <[hidden email]> wrote:

The docs indeed show to use jdbc.pool.maxTotal but in the code I see that the pool properties are filtered using "pool." 

See:
https://github.com/ops4j/org.ops4j.pax.jdbc/blob/master/pax-jdbc-pool-dbcp2/src/main/java/org/ops4j/pax/jdbc/pool/dbcp2/impl/DbcpPooledDataSourceFactory.java

So can you try with pool.maxTotal? Still this is a bug - either the docs or the code is wrong.

You can find the link to the issue tracker on the top level of the code base in the README:

Be aware though that you need to ask for a jira user on the ops4j list (ops4j@googlegroups.com) first. 
The self registration is switched off as there was lots of spam.

Christian


2018-05-14 21:47 GMT+02:00 Alex Soto <[hidden email]>:
Using Karaf  4.2.0, I am trying to configure connection pool using pax-jdbc-config  approach.  I installed features:

pax-jdbc-mariadb
pax-jdbc-config
pax-jdbc-pool-dbcp2



I dropped a org.ops4j.datasource-responder.cfg file in the etc directory:

dataSourceName=responder
user=XXXX
password=XXXX
pool=dbcp2
xa=true
databaseName=responder
jdbc.pool.maxTotal=8


The last line causes this error:

cannot set properties [pool.maxTotal]
java.sql.SQLException: cannot set properties [pool.maxTotal]
at org.ops4j.pax.jdbc.mariadb.impl.MariaDbDataSourceFactory.setProperties(MariaDbDataSourceFactory.java:70) ~[?:?]
at org.ops4j.pax.jdbc.mariadb.impl.MariaDbDataSourceFactory.createDataSource(MariaDbDataSourceFactory.java:36) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceRegistration.createDs(DataSourceRegistration.java:134) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceRegistration.<init>(DataSourceRegistration.java:80) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$null$0(DataSourceConfigManager.java:81) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper$1.addingService(ServiceTrackerHelper.java:131) ~[?:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941) ~[?:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183) ~[?:?]
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318) ~[?:?]
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:140) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$null$1(DataSourceConfigManager.java:77) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:146) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:85) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$null$2(DataSourceConfigManager.java:76) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper$1.addingService(ServiceTrackerHelper.java:131) ~[?:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941) ~[?:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183) ~[?:?]
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318) ~[?:?]
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:140) ~[14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:85) ~[14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$updated$3(DataSourceConfigManager.java:75) ~[14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:146) [14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:85) [14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.updated(DataSourceConfigManager.java:74) [14:org.ops4j.pax.jdbc.config:1.2.0]
at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.updated(ManagedServiceFactoryTracker.java:159) [8:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.provideConfiguration(ManagedServiceFactoryTracker.java:93) [8:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.ConfigurationManager$UpdateConfiguration.run(ConfigurationManager.java:1792) [8:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141) [8:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109) [8:org.apache.felix.configadmin:1.8.16]
at java.lang.Thread.run(Thread.java:748) [?:?]


How do I configure the various parameters of the connection pool?


Best regards,
Alex soto







--
--
Christian Schneider

http://www.liquid-reality.de

Computer Scientist


Reply | Threaded
Open this post in threaded view
|

Re: pax-jdbc-config connection pool configuration

Alex Soto
In reply to this post by Tim Ward-2
I will read this Tim, thanks for sharing, but I can’t start using OSGi R7 until it is released.



Best regards,
Alex soto




On May 15, 2018, at 3:00 AM, Tim Ward <[hidden email]> wrote:

Another option for connection pooling would be to use the OSGi Transaction Control service from the R7 release. The resource providers all give implicit support for pooling, and the Aries implementation allows you to create them purely from configuration. 

The transaction control service also provides a more reliable mechanism for managing the transaction lifecycle than proxying/annotations. 

There’s a post about Transaction Control on the OSGi blog at https://blog.osgi.org/2018/05/osgi-r7-highlights-transaction-control.html and documentation at Apache Aries. The 1.0.0 release happened about two weeks ago and has been tested in Karaf.

Best Regards,

Tim

Sent from my iPhone

On 15 May 2018, at 08:37, Christian Schneider <[hidden email]> wrote:

The docs indeed show to use jdbc.pool.maxTotal but in the code I see that the pool properties are filtered using "pool." 

See:
https://github.com/ops4j/org.ops4j.pax.jdbc/blob/master/pax-jdbc-pool-dbcp2/src/main/java/org/ops4j/pax/jdbc/pool/dbcp2/impl/DbcpPooledDataSourceFactory.java

So can you try with pool.maxTotal? Still this is a bug - either the docs or the code is wrong.

You can find the link to the issue tracker on the top level of the code base in the README:

Be aware though that you need to ask for a jira user on the ops4j list (ops4j@googlegroups.com) first. 
The self registration is switched off as there was lots of spam.

Christian


2018-05-14 21:47 GMT+02:00 Alex Soto <[hidden email]>:
Using Karaf  4.2.0, I am trying to configure connection pool using pax-jdbc-config  approach.  I installed features:

pax-jdbc-mariadb
pax-jdbc-config
pax-jdbc-pool-dbcp2



I dropped a org.ops4j.datasource-responder.cfg file in the etc directory:

dataSourceName=responder
user=XXXX
password=XXXX
pool=dbcp2
xa=true
databaseName=responder
jdbc.pool.maxTotal=8


The last line causes this error:

cannot set properties [pool.maxTotal]
java.sql.SQLException: cannot set properties [pool.maxTotal]
at org.ops4j.pax.jdbc.mariadb.impl.MariaDbDataSourceFactory.setProperties(MariaDbDataSourceFactory.java:70) ~[?:?]
at org.ops4j.pax.jdbc.mariadb.impl.MariaDbDataSourceFactory.createDataSource(MariaDbDataSourceFactory.java:36) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceRegistration.createDs(DataSourceRegistration.java:134) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceRegistration.<init>(DataSourceRegistration.java:80) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$null$0(DataSourceConfigManager.java:81) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper$1.addingService(ServiceTrackerHelper.java:131) ~[?:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941) ~[?:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183) ~[?:?]
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318) ~[?:?]
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:140) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$null$1(DataSourceConfigManager.java:77) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:146) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:85) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$null$2(DataSourceConfigManager.java:76) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper$1.addingService(ServiceTrackerHelper.java:131) ~[?:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941) ~[?:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183) ~[?:?]
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318) ~[?:?]
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:140) ~[14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:85) ~[14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$updated$3(DataSourceConfigManager.java:75) ~[14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:146) [14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:85) [14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.updated(DataSourceConfigManager.java:74) [14:org.ops4j.pax.jdbc.config:1.2.0]
at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.updated(ManagedServiceFactoryTracker.java:159) [8:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.provideConfiguration(ManagedServiceFactoryTracker.java:93) [8:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.ConfigurationManager$UpdateConfiguration.run(ConfigurationManager.java:1792) [8:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141) [8:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109) [8:org.apache.felix.configadmin:1.8.16]
at java.lang.Thread.run(Thread.java:748) [?:?]


How do I configure the various parameters of the connection pool?


Best regards,
Alex soto







--
--
Christian Schneider

http://www.liquid-reality.de

Computer Scientist


Reply | Threaded
Open this post in threaded view
|

Re: pax-jdbc-config connection pool configuration

Tim Ward-2
R7 is formally released. The Alliance press release is here: https://www.osgi.org/osgi-core-release-7-and-compendium-release-7-now-available/

Tim

Sent from my iPhone

On 15 May 2018, at 14:58, Alex Soto <[hidden email]> wrote:

I will read this Tim, thanks for sharing, but I can’t start using OSGi R7 until it is released.



Best regards,
Alex soto




On May 15, 2018, at 3:00 AM, Tim Ward <[hidden email]> wrote:

Another option for connection pooling would be to use the OSGi Transaction Control service from the R7 release. The resource providers all give implicit support for pooling, and the Aries implementation allows you to create them purely from configuration. 

The transaction control service also provides a more reliable mechanism for managing the transaction lifecycle than proxying/annotations. 

There’s a post about Transaction Control on the OSGi blog at https://blog.osgi.org/2018/05/osgi-r7-highlights-transaction-control.html and documentation at Apache Aries. The 1.0.0 release happened about two weeks ago and has been tested in Karaf.

Best Regards,

Tim

Sent from my iPhone

On 15 May 2018, at 08:37, Christian Schneider <[hidden email]> wrote:

The docs indeed show to use jdbc.pool.maxTotal but in the code I see that the pool properties are filtered using "pool." 

See:
https://github.com/ops4j/org.ops4j.pax.jdbc/blob/master/pax-jdbc-pool-dbcp2/src/main/java/org/ops4j/pax/jdbc/pool/dbcp2/impl/DbcpPooledDataSourceFactory.java

So can you try with pool.maxTotal? Still this is a bug - either the docs or the code is wrong.

You can find the link to the issue tracker on the top level of the code base in the README:

Be aware though that you need to ask for a jira user on the ops4j list (ops4j@googlegroups.com) first. 
The self registration is switched off as there was lots of spam.

Christian


2018-05-14 21:47 GMT+02:00 Alex Soto <[hidden email]>:
Using Karaf  4.2.0, I am trying to configure connection pool using pax-jdbc-config  approach.  I installed features:

pax-jdbc-mariadb
pax-jdbc-config
pax-jdbc-pool-dbcp2



I dropped a org.ops4j.datasource-responder.cfg file in the etc directory:

dataSourceName=responder
user=XXXX
password=XXXX
pool=dbcp2
xa=true
databaseName=responder
jdbc.pool.maxTotal=8


The last line causes this error:

cannot set properties [pool.maxTotal]
java.sql.SQLException: cannot set properties [pool.maxTotal]
at org.ops4j.pax.jdbc.mariadb.impl.MariaDbDataSourceFactory.setProperties(MariaDbDataSourceFactory.java:70) ~[?:?]
at org.ops4j.pax.jdbc.mariadb.impl.MariaDbDataSourceFactory.createDataSource(MariaDbDataSourceFactory.java:36) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceRegistration.createDs(DataSourceRegistration.java:134) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceRegistration.<init>(DataSourceRegistration.java:80) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$null$0(DataSourceConfigManager.java:81) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper$1.addingService(ServiceTrackerHelper.java:131) ~[?:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941) ~[?:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183) ~[?:?]
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318) ~[?:?]
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:140) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$null$1(DataSourceConfigManager.java:77) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:146) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:85) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$null$2(DataSourceConfigManager.java:76) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper$1.addingService(ServiceTrackerHelper.java:131) ~[?:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941) ~[?:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183) ~[?:?]
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318) ~[?:?]
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:140) ~[14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:85) ~[14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$updated$3(DataSourceConfigManager.java:75) ~[14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:146) [14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:85) [14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.updated(DataSourceConfigManager.java:74) [14:org.ops4j.pax.jdbc.config:1.2.0]
at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.updated(ManagedServiceFactoryTracker.java:159) [8:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.provideConfiguration(ManagedServiceFactoryTracker.java:93) [8:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.ConfigurationManager$UpdateConfiguration.run(ConfigurationManager.java:1792) [8:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141) [8:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109) [8:org.apache.felix.configadmin:1.8.16]
at java.lang.Thread.run(Thread.java:748) [?:?]


How do I configure the various parameters of the connection pool?


Best regards,
Alex soto







--
--
Christian Schneider

http://www.liquid-reality.de

Computer Scientist


Reply | Threaded
Open this post in threaded view
|

Re: pax-jdbc-config connection pool configuration

Alex Soto
Oh, I missed this :) great!

Still, it may be too early for me to jump, has it been fully adopted and tested by the latest Karaf? 

(Trying to avoid more bruises)

Best regards,
Alex soto




On May 15, 2018, at 9:12 AM, Tim Ward <[hidden email]> wrote:

R7 is formally released. The Alliance press release is here: https://www.osgi.org/osgi-core-release-7-and-compendium-release-7-now-available/

Tim

Sent from my iPhone

On 15 May 2018, at 14:58, Alex Soto <[hidden email]> wrote:

I will read this Tim, thanks for sharing, but I can’t start using OSGi R7 until it is released.



Best regards,
Alex soto




On May 15, 2018, at 3:00 AM, Tim Ward <[hidden email]> wrote:

Another option for connection pooling would be to use the OSGi Transaction Control service from the R7 release. The resource providers all give implicit support for pooling, and the Aries implementation allows you to create them purely from configuration. 

The transaction control service also provides a more reliable mechanism for managing the transaction lifecycle than proxying/annotations. 

There’s a post about Transaction Control on the OSGi blog at https://blog.osgi.org/2018/05/osgi-r7-highlights-transaction-control.html and documentation at Apache Aries. The 1.0.0 release happened about two weeks ago and has been tested in Karaf.

Best Regards,

Tim

Sent from my iPhone

On 15 May 2018, at 08:37, Christian Schneider <[hidden email]> wrote:

The docs indeed show to use jdbc.pool.maxTotal but in the code I see that the pool properties are filtered using "pool." 

See:
https://github.com/ops4j/org.ops4j.pax.jdbc/blob/master/pax-jdbc-pool-dbcp2/src/main/java/org/ops4j/pax/jdbc/pool/dbcp2/impl/DbcpPooledDataSourceFactory.java

So can you try with pool.maxTotal? Still this is a bug - either the docs or the code is wrong.

You can find the link to the issue tracker on the top level of the code base in the README:

Be aware though that you need to ask for a jira user on the ops4j list (ops4j@googlegroups.com) first. 
The self registration is switched off as there was lots of spam.

Christian


2018-05-14 21:47 GMT+02:00 Alex Soto <[hidden email]>:
Using Karaf  4.2.0, I am trying to configure connection pool using pax-jdbc-config  approach.  I installed features:

pax-jdbc-mariadb
pax-jdbc-config
pax-jdbc-pool-dbcp2



I dropped a org.ops4j.datasource-responder.cfg file in the etc directory:

dataSourceName=responder
user=XXXX
password=XXXX
pool=dbcp2
xa=true
databaseName=responder
jdbc.pool.maxTotal=8


The last line causes this error:

cannot set properties [pool.maxTotal]
java.sql.SQLException: cannot set properties [pool.maxTotal]
at org.ops4j.pax.jdbc.mariadb.impl.MariaDbDataSourceFactory.setProperties(MariaDbDataSourceFactory.java:70) ~[?:?]
at org.ops4j.pax.jdbc.mariadb.impl.MariaDbDataSourceFactory.createDataSource(MariaDbDataSourceFactory.java:36) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceRegistration.createDs(DataSourceRegistration.java:134) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceRegistration.<init>(DataSourceRegistration.java:80) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$null$0(DataSourceConfigManager.java:81) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper$1.addingService(ServiceTrackerHelper.java:131) ~[?:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941) ~[?:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183) ~[?:?]
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318) ~[?:?]
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:140) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$null$1(DataSourceConfigManager.java:77) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:146) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:85) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$null$2(DataSourceConfigManager.java:76) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper$1.addingService(ServiceTrackerHelper.java:131) ~[?:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941) ~[?:?]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183) ~[?:?]
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318) ~[?:?]
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261) ~[?:?]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:140) ~[14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:85) ~[14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.lambda$updated$3(DataSourceConfigManager.java:75) ~[14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:146) [14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.ServiceTrackerHelper.track(ServiceTrackerHelper.java:85) [14:org.ops4j.pax.jdbc.config:1.2.0]
at org.ops4j.pax.jdbc.config.impl.DataSourceConfigManager.updated(DataSourceConfigManager.java:74) [14:org.ops4j.pax.jdbc.config:1.2.0]
at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.updated(ManagedServiceFactoryTracker.java:159) [8:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.provideConfiguration(ManagedServiceFactoryTracker.java:93) [8:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.ConfigurationManager$UpdateConfiguration.run(ConfigurationManager.java:1792) [8:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:141) [8:org.apache.felix.configadmin:1.8.16]
at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:109) [8:org.apache.felix.configadmin:1.8.16]
at java.lang.Thread.run(Thread.java:748) [?:?]


How do I configure the various parameters of the connection pool?


Best regards,
Alex soto







--
--
Christian Schneider

http://www.liquid-reality.de

Computer Scientist