Karaf-4.2.5 - Duplicate MySQL DataSourceFactories

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

Karaf-4.2.5 - Duplicate MySQL DataSourceFactories

Erwin Hogeweg
Hi,

Not sure if I am doing something wrong or if this is a known issue. I am using Karaf-4.2.5 with pax-jdbc-1.3.1 and I end up with two identical DataSourceFactories and 2 identical Data Sources. One from the mysql-5.1.34 Oracle bundle and one from the pax-jdbc-mysql adapter bundle.

When I use jdbc:ds-list I see 2 Datasources for ea. database and Karaf even generates a warning msg that I have duplicate DataSources and that I should check my config.

I only have ONE config file for ea. database.

Name           │ Product │ Version    │ URL                                                                                         │ Status
───────────────┼─────────┼────────────┼─────────────────────────────────────────────────────────────────────────────────────────────┼───────
jdbc/database1 │ MySQL   │ 5.5.61-cll │ jdbc:<a href="mysql://p.q.r.s:3306/Schema?useSSL=false&amp;zeroDateTimeBehavior=convertToNull" class="">mysql://p.q.r.s:3306/Schema?useSSL=false&zeroDateTimeBehavior=convertToNull │ OK
jdbc/database2 │ MySQL   │ 5.6.31-log │ jdbc:<a href="mysql://the_db_server:3306/schema?useSSL=false" class="">mysql://the_db_server:3306/schema?useSSL=false                                          │ OK
jdbc/database2 │ MySQL   │ 5.6.31-log │ jdbc:<a href="mysql://the_db_server:3306/schema?useSSL=false" class="">mysql://the_db_server:3306/schema?useSSL=false                                          │ OK
jdbc/databawe1 │ MySQL   │ 5.5.61-cll │ jdbc:<a href="mysql://p.q.r.s:3306/Schema?useSSL=false&amp;zeroDateTimeBehavior=convertToNull" class="">mysql://p.q.r.s:3306/Schema?useSSL=false&zeroDateTimeBehavior=convertToNull │ OK

  [pipe-jdbc:ds-list] WARN org.apache.karaf.jdbc.internal.JdbcServiceImpl - Multiple JDBC datasources found with the same service ranking for jdbc/myDB


[org.osgi.service.jdbc.DataSourceFactory]
-----------------------------------------
 osgi.jdbc.driver.class = com.mysql.jdbc.Driver
 osgi.jdbc.driver.name = com.mysql.jdbc
 osgi.jdbc.driver.version = 5.1.34
 service.bundleid = 172
 service.id = 415
 service.scope = singleton
Provided by : 
 Oracle Corporation's JDBC Driver for MySQL (172)

Used by: 
 OPS4J Pax JDBC Config (12)

[org.osgi.service.jdbc.DataSourceFactory]
-----------------------------------------
 osgi.jdbc.driver.class = com.mysql.jdbc.Driver
 osgi.jdbc.driver.name = mysql
 service.bundleid = 235
 service.id = 420
 service.scope = singleton
Provided by : 
 OPS4J Pax JDBC MySQL Driver Adapter (235)

Used by: 
 OPS4J Pax JDBC Config (12)


Kind Regards,

Erwin
Reply | Threaded
Open this post in threaded view
|

Re: Karaf-4.2.5 - Duplicate MySQL DataSourceFactories

jbonofre
Hi Erwin,

First, I'm suggesting to upgrade to Pax JDBC 1.3.5 containing fixes.

I guess you have both pax-jdbc-config feature and pax-jdbc bundle installed.
pax-jdbc bundle is a wrapper that automatically detect and expose a factory.

It's similar to what I fixed in https://ops4j1.jira.com/browse/PAXJDBC-135.

You should not install pax-jdbc bundle IMHO as you are using
pax-jdbc-mysql feature.

Regards
JB

On 22/05/2019 04:28, Erwin Hogeweg wrote:

> Hi,
>
> Not sure if I am doing something wrong or if this is a known issue. I am
> using Karaf-4.2.5 with pax-jdbc-1.3.1 and I end up with two identical
> DataSourceFactories and 2 identical Data Sources. One from the
> mysql-5.1.34 Oracle bundle and one from the pax-jdbc-mysql adapter bundle.
>
> When I use jdbc:ds-list I see 2 Datasources for ea. database and Karaf
> even generates a warning msg that I have duplicate DataSources and that
> I should check my config.
>
> I only have ONE config file for ea. database.
>
> Name           │ Product │ Version    │ URL                            
>                                                             │ Status
> ───────────────┼─────────┼────────────┼─────────────────────────────────────────────────────────────────────────────────────────────┼───────
> jdbc/database1 │ MySQL   │ 5.5.61-cll │
> jdbc:mysql://p.q.r.s:3306/Schema?useSSL=false&zeroDateTimeBehavior=convertToNull
> │ OK
> jdbc/database2 │ MySQL   │ 5.6.31-log │
> jdbc:mysql://the_db_server:3306/schema?useSSL=false                     
>                     │ OK
> jdbc/database2 │ MySQL   │ 5.6.31-log │
> jdbc:mysql://the_db_server:3306/schema?useSSL=false                     
>                     │ OK
> jdbc/databawe1 │ MySQL   │ 5.5.61-cll │
> jdbc:mysql://p.q.r.s:3306/Schema?useSSL=false&zeroDateTimeBehavior=convertToNull
> │ OK
>
>   [pipe-jdbc:ds-list] WARN
> org.apache.karaf.jdbc.internal.JdbcServiceImpl - Multiple JDBC
> datasources found with the same service ranking for jdbc/myDB
>
>
> [org.osgi.service.jdbc.DataSourceFactory]
> -----------------------------------------
>  osgi.jdbc.driver.class = com.mysql.jdbc.Driver
>  osgi.jdbc.driver.name = com.mysql.jdbc
>  osgi.jdbc.driver.version = 5.1.34
>  service.bundleid = 172
>  service.id <http://service.id> = 415
>  service.scope = singleton
> *Provided by : 
>  Oracle Corporation's JDBC Driver for MySQL (172)*
> Used by: 
>  OPS4J Pax JDBC Config (12)
>
> [org.osgi.service.jdbc.DataSourceFactory]
> -----------------------------------------
>  osgi.jdbc.driver.class = com.mysql.jdbc.Driver
>  osgi.jdbc.driver.name = mysql
>  service.bundleid = 235
>  service.id <http://service.id> = 420
>  service.scope = singleton
> *Provided by : 
>  OPS4J Pax JDBC MySQL Driver Adapter (235)*
> Used by: 
>  OPS4J Pax JDBC Config (12)
>
>
> Kind Regards,
>
> Erwin

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: Karaf-4.2.5 - Duplicate MySQL DataSourceFactories

Erwin Hogeweg
Thanks JB…

Trying to get this to work by modding the feature.xml. This approach doesn’t work because the the pax-jdbc feature is still pulled in as a depended feature.
<!--feature version="1.3.1">pax-jdbc</feature>-->
        <feature version="1.3.1">pax-jdbc-config</feature>
        <feature version="1.3.1">pax-jdbc-pool-dbcp2</feature>
        <feature version="1.3.1">pax-jdbc-mysql</feature>

So I tried 1.3.5 as you recommended: 
<!--feature version="1.3.1">pax-jdbc</feature>-->
        <feature version="1.3.5">pax-jdbc-config</feature>
        <feature version="1.3.5">pax-jdbc-pool-dbcp2</feature>
        <feature version="1.3.5">pax-jdbc-mysql</feature>

But those 1.3.5 features don’t appear to exist yet. 

Next approach, just include the individual bundles: 
<!-- pax-jdbc 1.3.5 -->
<bundle start-level="30">mvn:org.apache.commons/commons-dbcp2/2.6.0</bundle>
        <bundle start-level="30">mvn:org.ops4j.pax.jdbc/pax-jdbc-config/1.3.5</bundle>
        <bundle start-level="30">mvn:org.ops4j.pax.jdbc/pax-jdbc-pool-dbcp2/1.3.5</bundle>
        <bundle start-level="30">mvn:org.ops4j.pax.jdbc/pax-jdbc-mysql/1.3.5</bundle>

But now I am ending up pulling in a bunch of depended bundles. I have no problem to continue down this path but I am not sure this is the right direction.

Please share your opinion.


Thanks, Erwin  

On May 22, 2019, at 00:53, Jean-Baptiste Onofré <[hidden email]> wrote:

Hi Erwin,

First, I'm suggesting to upgrade to Pax JDBC 1.3.5 containing fixes.

I guess you have both pax-jdbc-config feature and pax-jdbc bundle installed.
pax-jdbc bundle is a wrapper that automatically detect and expose a factory.

It's similar to what I fixed in https://ops4j1.jira.com/browse/PAXJDBC-135.

You should not install pax-jdbc bundle IMHO as you are using
pax-jdbc-mysql feature.

Regards
JB

On 22/05/2019 04:28, Erwin Hogeweg wrote:
Hi,

Not sure if I am doing something wrong or if this is a known issue. I am
using Karaf-4.2.5 with pax-jdbc-1.3.1 and I end up with two identical
DataSourceFactories and 2 identical Data Sources. One from the
mysql-5.1.34 Oracle bundle and one from the pax-jdbc-mysql adapter bundle.

When I use jdbc:ds-list I see 2 Datasources for ea. database and Karaf
even generates a warning msg that I have duplicate DataSources and that
I should check my config.

I only have ONE config file for ea. database.

Name           │ Product │ Version    │ URL                            
                                                            │ Status
───────────────┼─────────┼────────────┼─────────────────────────────────────────────────────────────────────────────────────────────┼───────
jdbc/database1 │ MySQL   │ 5.5.61-cll │
jdbc:<a href="mysql://p.q.r.s:3306/Schema?useSSL=false&amp;zeroDateTimeBehavior=convertToNull" class="">mysql://p.q.r.s:3306/Schema?useSSL=false&zeroDateTimeBehavior=convertToNull
│ OK
jdbc/database2 │ MySQL   │ 5.6.31-log │
jdbc:<a href="mysql://the_db_server:3306/schema?useSSL=false" class="">mysql://the_db_server:3306/schema?useSSL=false                     
                    │ OK
jdbc/database2 │ MySQL   │ 5.6.31-log │
jdbc:<a href="mysql://the_db_server:3306/schema?useSSL=false" class="">mysql://the_db_server:3306/schema?useSSL=false                     
                    │ OK
jdbc/databawe1 │ MySQL   │ 5.5.61-cll │
jdbc:<a href="mysql://p.q.r.s:3306/Schema?useSSL=false&amp;zeroDateTimeBehavior=convertToNull" class="">mysql://p.q.r.s:3306/Schema?useSSL=false&zeroDateTimeBehavior=convertToNull
│ OK

  [pipe-jdbc:ds-list] WARN
org.apache.karaf.jdbc.internal.JdbcServiceImpl - Multiple JDBC
datasources found with the same service ranking for jdbc/myDB


[org.osgi.service.jdbc.DataSourceFactory]
-----------------------------------------
 osgi.jdbc.driver.class = com.mysql.jdbc.Driver
 osgi.jdbc.driver.name = com.mysql.jdbc
 osgi.jdbc.driver.version = 5.1.34
 service.bundleid = 172
 service.id <http://service.id> = 415
 service.scope = singleton
*Provided by : 
 Oracle Corporation's JDBC Driver for MySQL (172)*
Used by: 
 OPS4J Pax JDBC Config (12)

[org.osgi.service.jdbc.DataSourceFactory]
-----------------------------------------
 osgi.jdbc.driver.class = com.mysql.jdbc.Driver
 osgi.jdbc.driver.name = mysql
 service.bundleid = 235
 service.id <http://service.id> = 420
 service.scope = singleton
*Provided by : 
 OPS4J Pax JDBC MySQL Driver Adapter (235)*
Used by: 
 OPS4J Pax JDBC Config (12)


Kind Regards,

Erwin

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com

Reply | Threaded
Open this post in threaded view
|

Re: Karaf-4.2.5 - Duplicate MySQL DataSourceFactories

jbonofre
Hi Erwin,

Hmmm, that's weird. Let me try to reproduce on Karaf example using MySQL.

Regards
JB

On 22/05/2019 15:33, Erwin Hogeweg wrote:

> Thanks JB…
>
> Trying to get this to work by modding the feature.xml. This approach
> doesn’t work because the the pax-jdbc feature is still pulled in as a
> depended feature.
> <!--feature version="1.3.1">pax-jdbc</feature>-->
>         <feature version="1.3.1">pax-jdbc-config</feature>
>         <feature version="1.3.1">pax-jdbc-pool-dbcp2</feature>
>         <feature version="1.3.1">pax-jdbc-mysql</feature>
>
> So I tried 1.3.5 as you recommended: 
> <!--feature version="1.3.1">pax-jdbc</feature>-->
>         <feature version="1.3.5">pax-jdbc-config</feature>
>         <feature version="1.3.5">pax-jdbc-pool-dbcp2</feature>
>         <feature version="1.3.5">pax-jdbc-mysql</feature>
>
> But those 1.3.5 features don’t appear to exist yet. 
>
> Next approach, just include the individual bundles: 
> <!-- pax-jdbc 1.3.5 -->
> <bundle start-level="30">mvn:org.apache.commons/commons-dbcp2/2.6.0</bundle>
>         <bundle
> start-level="30">mvn:org.ops4j.pax.jdbc/pax-jdbc-config/1.3.5</bundle>
>         <bundle
> start-level="30">mvn:org.ops4j.pax.jdbc/pax-jdbc-pool-dbcp2/1.3.5</bundle>
>         <bundle
> start-level="30">mvn:org.ops4j.pax.jdbc/pax-jdbc-mysql/1.3.5</bundle>
>
> But now I am ending up pulling in a bunch of depended bundles. I have no
> problem to continue down this path but I am not sure this is the right
> direction.
>
> Please share your opinion.
>
>
> Thanks, Erwin  
>
>> On May 22, 2019, at 00:53, Jean-Baptiste Onofré <[hidden email]
>> <mailto:[hidden email]>> wrote:
>>
>> Hi Erwin,
>>
>> First, I'm suggesting to upgrade to Pax JDBC 1.3.5 containing fixes.
>>
>> I guess you have both pax-jdbc-config feature and pax-jdbc bundle
>> installed.
>> pax-jdbc bundle is a wrapper that automatically detect and expose a
>> factory.
>>
>> It's similar to what I fixed in
>> https://ops4j1.jira.com/browse/PAXJDBC-135.
>>
>> You should not install pax-jdbc bundle IMHO as you are using
>> pax-jdbc-mysql feature.
>>
>> Regards
>> JB
>>
>> On 22/05/2019 04:28, Erwin Hogeweg wrote:
>>> Hi,
>>>
>>> Not sure if I am doing something wrong or if this is a known issue. I am
>>> using Karaf-4.2.5 with pax-jdbc-1.3.1 and I end up with two identical
>>> DataSourceFactories and 2 identical Data Sources. One from the
>>> mysql-5.1.34 Oracle bundle and one from the pax-jdbc-mysql adapter
>>> bundle.
>>>
>>> When I use jdbc:ds-list I see 2 Datasources for ea. database and Karaf
>>> even generates a warning msg that I have duplicate DataSources and that
>>> I should check my config.
>>>
>>> I only have ONE config file for ea. database.
>>>
>>> Name           │ Product │ Version    │ URL                            
>>>                                                             │ Status
>>> ───────────────┼─────────┼────────────┼─────────────────────────────────────────────────────────────────────────────────────────────┼───────
>>> jdbc/database1 │ MySQL   │ 5.5.61-cll │
>>> jdbc:mysql://p.q.r.s:3306/Schema?useSSL=false&zeroDateTimeBehavior=convertToNull
>>> │ OK
>>> jdbc/database2 │ MySQL   │ 5.6.31-log │
>>> jdbc:mysql://the_db_server:3306/schema?useSSL=false                     
>>>                     │ OK
>>> jdbc/database2 │ MySQL   │ 5.6.31-log │
>>> jdbc:mysql://the_db_server:3306/schema?useSSL=false                     
>>>                     │ OK
>>> jdbc/databawe1 │ MySQL   │ 5.5.61-cll │
>>> jdbc:mysql://p.q.r.s:3306/Schema?useSSL=false&zeroDateTimeBehavior=convertToNull
>>> │ OK
>>>
>>>   [pipe-jdbc:ds-list] WARN
>>> org.apache.karaf.jdbc.internal.JdbcServiceImpl - Multiple JDBC
>>> datasources found with the same service ranking for jdbc/myDB
>>>
>>>
>>> [org.osgi.service.jdbc.DataSourceFactory]
>>> -----------------------------------------
>>>  osgi.jdbc.driver.class = com.mysql.jdbc.Driver
>>>  osgi.jdbc.driver.name = com.mysql.jdbc
>>>  osgi.jdbc.driver.version = 5.1.34
>>>  service.bundleid = 172
>>>  service.id <http://service.id> <http://service.id> = 415
>>>  service.scope = singleton
>>> *Provided by : 
>>>  Oracle Corporation's JDBC Driver for MySQL (172)*
>>> Used by: 
>>>  OPS4J Pax JDBC Config (12)
>>>
>>> [org.osgi.service.jdbc.DataSourceFactory]
>>> -----------------------------------------
>>>  osgi.jdbc.driver.class = com.mysql.jdbc.Driver
>>>  osgi.jdbc.driver.name = mysql
>>>  service.bundleid = 235
>>>  service.id <http://service.id> <http://service.id> = 420
>>>  service.scope = singleton
>>> *Provided by : 
>>>  OPS4J Pax JDBC MySQL Driver Adapter (235)*
>>> Used by: 
>>>  OPS4J Pax JDBC Config (12)
>>>
>>>
>>> Kind Regards,
>>>
>>> Erwin
>>
>> --
>> Jean-Baptiste Onofré
>> [hidden email] <mailto:[hidden email]>
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: Karaf-4.2.5 - Duplicate MySQL DataSourceFactories

Erwin Hogeweg
Hi JB,

I poked around a bit more. This is what I found.

When I replace the jdbc feature in the bootFeatures section with only the required features I do end up with a single DataSourceFactory and two Datasources (which is expected)

<bootFeatures>
...
<!--feature>jdbc</feature-->
<feature>pax-jdbc-spec</feature>
<feature>pax-jdbc-mysql</feature>
<feature>pax-jdbc-config</feature>
<feature>pax-jdbc-pool-dbcp2</feature>
...

karaf@root()> services | grep DataSource
[javax.sql.DataSource]
[javax.sql.DataSource]
[org.osgi.service.jdbc.DataSourceFactory]
[org.ops4j.pax.jdbc.pool.common.PooledDataSourceFactory]
[org.ops4j.pax.jdbc.pool.common.PooledDataSourceFactory]

But now I have lost the console commands. When I manually install the jdbc feature I get the console commands back but now I also have duplicate DSFactory again.

Just FYI.


Regards,

Erwin


On May 22, 2019, at 09:39, Jean-Baptiste Onofré <[hidden email]> wrote:

Hi Erwin,

Hmmm, that's weird. Let me try to reproduce on Karaf example using MySQL.

Regards
JB

On 22/05/2019 15:33, Erwin Hogeweg wrote:
Thanks JB…

Trying to get this to work by modding the feature.xml. This approach
doesn’t work because the the pax-jdbc feature is still pulled in as a
depended feature.
<!--feature version="1.3.1">pax-jdbc</feature>-->
        <feature version="1.3.1">pax-jdbc-config</feature>
        <feature version="1.3.1">pax-jdbc-pool-dbcp2</feature>
        <feature version="1.3.1">pax-jdbc-mysql</feature>

So I tried 1.3.5 as you recommended: 
<!--feature version="1.3.1">pax-jdbc</feature>-->
        <feature version="1.3.5">pax-jdbc-config</feature>
        <feature version="1.3.5">pax-jdbc-pool-dbcp2</feature>
        <feature version="1.3.5">pax-jdbc-mysql</feature>

But those 1.3.5 features don’t appear to exist yet. 

Next approach, just include the individual bundles: 
<!-- pax-jdbc 1.3.5 -->
<bundle start-level="30">mvn:org.apache.commons/commons-dbcp2/2.6.0</bundle>
        <bundle
start-level="30">mvn:org.ops4j.pax.jdbc/pax-jdbc-config/1.3.5</bundle>
        <bundle
start-level="30">mvn:org.ops4j.pax.jdbc/pax-jdbc-pool-dbcp2/1.3.5</bundle>
        <bundle
start-level="30">mvn:org.ops4j.pax.jdbc/pax-jdbc-mysql/1.3.5</bundle>

But now I am ending up pulling in a bunch of depended bundles. I have no
problem to continue down this path but I am not sure this is the right
direction.

Please share your opinion.


Thanks, Erwin  

On May 22, 2019, at 00:53, Jean-Baptiste Onofré <[hidden email]
<[hidden email]>> wrote:

Hi Erwin,

First, I'm suggesting to upgrade to Pax JDBC 1.3.5 containing fixes.

I guess you have both pax-jdbc-config feature and pax-jdbc bundle
installed.
pax-jdbc bundle is a wrapper that automatically detect and expose a
factory.

It's similar to what I fixed in
https://ops4j1.jira.com/browse/PAXJDBC-135.

You should not install pax-jdbc bundle IMHO as you are using
pax-jdbc-mysql feature.

Regards
JB

On 22/05/2019 04:28, Erwin Hogeweg wrote:
Hi,

Not sure if I am doing something wrong or if this is a known issue. I am
using Karaf-4.2.5 with pax-jdbc-1.3.1 and I end up with two identical
DataSourceFactories and 2 identical Data Sources. One from the
mysql-5.1.34 Oracle bundle and one from the pax-jdbc-mysql adapter
bundle.

When I use jdbc:ds-list I see 2 Datasources for ea. database and Karaf
even generates a warning msg that I have duplicate DataSources and that
I should check my config.

I only have ONE config file for ea. database.

Name           │ Product │ Version    │ URL                            
                                                            │ Status
───────────────┼─────────┼────────────┼─────────────────────────────────────────────────────────────────────────────────────────────┼───────
jdbc/database1 │ MySQL   │ 5.5.61-cll │
jdbc:<a href="mysql://p.q.r.s:3306/Schema?useSSL=false&amp;zeroDateTimeBehavior=convertToNull" class="">mysql://p.q.r.s:3306/Schema?useSSL=false&zeroDateTimeBehavior=convertToNull
│ OK
jdbc/database2 │ MySQL   │ 5.6.31-log │
jdbc:<a href="mysql://the_db_server:3306/schema?useSSL=false" class="">mysql://the_db_server:3306/schema?useSSL=false                     
                    │ OK
jdbc/database2 │ MySQL   │ 5.6.31-log │
jdbc:<a href="mysql://the_db_server:3306/schema?useSSL=false" class="">mysql://the_db_server:3306/schema?useSSL=false                     
                    │ OK
jdbc/databawe1 │ MySQL   │ 5.5.61-cll │
jdbc:<a href="mysql://p.q.r.s:3306/Schema?useSSL=false&amp;zeroDateTimeBehavior=convertToNull" class="">mysql://p.q.r.s:3306/Schema?useSSL=false&zeroDateTimeBehavior=convertToNull
│ OK

  [pipe-jdbc:ds-list] WARN
org.apache.karaf.jdbc.internal.JdbcServiceImpl - Multiple JDBC
datasources found with the same service ranking for jdbc/myDB


[org.osgi.service.jdbc.DataSourceFactory]
-----------------------------------------
 osgi.jdbc.driver.class = com.mysql.jdbc.Driver
 osgi.jdbc.driver.name = com.mysql.jdbc
 osgi.jdbc.driver.version = 5.1.34
 service.bundleid = 172
 service.id <http://service.id> <http://service.id> = 415
 service.scope = singleton
*Provided by : 
 Oracle Corporation's JDBC Driver for MySQL (172)*
Used by: 
 OPS4J Pax JDBC Config (12)

[org.osgi.service.jdbc.DataSourceFactory]
-----------------------------------------
 osgi.jdbc.driver.class = com.mysql.jdbc.Driver
 osgi.jdbc.driver.name = mysql
 service.bundleid = 235
 service.id <http://service.id> <http://service.id> = 420
 service.scope = singleton
*Provided by : 
 OPS4J Pax JDBC MySQL Driver Adapter (235)*
Used by: 
 OPS4J Pax JDBC Config (12)


Kind Regards,

Erwin

--
Jean-Baptiste Onofré
[hidden email] <[hidden email]>
http://blog.nanthrax.net
Talend - http://www.talend.com


--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com

Reply | Threaded
Open this post in threaded view
|

Re: Karaf-4.2.5 - Duplicate MySQL DataSourceFactories

jbonofre
Hi,

I guess you don't use stage in your boot features right ?

Regards
JB

On 28/05/2019 02:20, Erwin Hogeweg wrote:

> Hi JB,
>
> I poked around a bit more. This is what I found.
>
> When I replace the jdbc feature in the bootFeatures section with only
> the required features I do end up with a single DataSourceFactory and
> two Datasources (which is expected)
>
> <bootFeatures>
> ...
> <!--feature>jdbc</feature-->
> <feature>pax-jdbc-spec</feature>
> <feature>pax-jdbc-mysql</feature>
> <feature>pax-jdbc-config</feature>
> <feature>pax-jdbc-pool-dbcp2</feature>
> ...
>
> *karaf*@root()> services|grepDataSource
> [javax.sql.*DataSource*]
> [javax.sql.*DataSource*]
> [org.osgi.service.jdbc.*DataSource*Factory]
> [org.ops4j.pax.jdbc.pool.common.Pooled*DataSource*Factory]
> [org.ops4j.pax.jdbc.pool.common.Pooled*DataSource*Factory]
>
> But now I have lost the console commands. When I manually install the
> jdbc feature I get the console commands back but now I also have
> duplicate DSFactory again.
>
> Just FYI.
>
>
> Regards,
>
> Erwin
>
>
>> On May 22, 2019, at 09:39, Jean-Baptiste Onofré <[hidden email]
>> <mailto:[hidden email]>> wrote:
>>
>> Hi Erwin,
>>
>> Hmmm, that's weird. Let me try to reproduce on Karaf example using MySQL.
>>
>> Regards
>> JB
>>
>> On 22/05/2019 15:33, Erwin Hogeweg wrote:
>>> Thanks JB…
>>>
>>> Trying to get this to work by modding the feature.xml. This approach
>>> doesn’t work because the the pax-jdbc feature is still pulled in as a
>>> depended feature.
>>> <!--feature version="1.3.1">pax-jdbc</feature>-->
>>>         <feature version="1.3.1">pax-jdbc-config</feature>
>>>         <feature version="1.3.1">pax-jdbc-pool-dbcp2</feature>
>>>         <feature version="1.3.1">pax-jdbc-mysql</feature>
>>>
>>> So I tried 1.3.5 as you recommended: 
>>> <!--feature version="1.3.1">pax-jdbc</feature>-->
>>>         <feature version="1.3.5">pax-jdbc-config</feature>
>>>         <feature version="1.3.5">pax-jdbc-pool-dbcp2</feature>
>>>         <feature version="1.3.5">pax-jdbc-mysql</feature>
>>>
>>> But those 1.3.5 features don’t appear to exist yet. 
>>>
>>> Next approach, just include the individual bundles: 
>>> <!-- pax-jdbc 1.3.5 -->
>>> <bundle
>>> start-level="30">mvn:org.apache.commons/commons-dbcp2/2.6.0</bundle>
>>>         <bundle
>>> start-level="30">mvn:org.ops4j.pax.jdbc/pax-jdbc-config/1.3.5</bundle>
>>>         <bundle
>>> start-level="30">mvn:org.ops4j.pax.jdbc/pax-jdbc-pool-dbcp2/1.3.5</bundle>
>>>         <bundle
>>> start-level="30">mvn:org.ops4j.pax.jdbc/pax-jdbc-mysql/1.3.5</bundle>
>>>
>>> But now I am ending up pulling in a bunch of depended bundles. I have no
>>> problem to continue down this path but I am not sure this is the right
>>> direction.
>>>
>>> Please share your opinion.
>>>
>>>
>>> Thanks, Erwin  
>>>
>>>> On May 22, 2019, at 00:53, Jean-Baptiste Onofré <[hidden email]
>>>> <mailto:[hidden email]>
>>>> <mailto:[hidden email]>> wrote:
>>>>
>>>> Hi Erwin,
>>>>
>>>> First, I'm suggesting to upgrade to Pax JDBC 1.3.5 containing fixes.
>>>>
>>>> I guess you have both pax-jdbc-config feature and pax-jdbc bundle
>>>> installed.
>>>> pax-jdbc bundle is a wrapper that automatically detect and expose a
>>>> factory.
>>>>
>>>> It's similar to what I fixed in
>>>> https://ops4j1.jira.com/browse/PAXJDBC-135.
>>>>
>>>> You should not install pax-jdbc bundle IMHO as you are using
>>>> pax-jdbc-mysql feature.
>>>>
>>>> Regards
>>>> JB
>>>>
>>>> On 22/05/2019 04:28, Erwin Hogeweg wrote:
>>>>> Hi,
>>>>>
>>>>> Not sure if I am doing something wrong or if this is a known issue.
>>>>> I am
>>>>> using Karaf-4.2.5 with pax-jdbc-1.3.1 and I end up with two identical
>>>>> DataSourceFactories and 2 identical Data Sources. One from the
>>>>> mysql-5.1.34 Oracle bundle and one from the pax-jdbc-mysql adapter
>>>>> bundle.
>>>>>
>>>>> When I use jdbc:ds-list I see 2 Datasources for ea. database and Karaf
>>>>> even generates a warning msg that I have duplicate DataSources and that
>>>>> I should check my config.
>>>>>
>>>>> I only have ONE config file for ea. database.
>>>>>
>>>>> Name           │ Product │ Version    │ URL                            
>>>>>                                                             │ Status
>>>>> ───────────────┼─────────┼────────────┼─────────────────────────────────────────────────────────────────────────────────────────────┼───────
>>>>> jdbc/database1 │ MySQL   │ 5.5.61-cll │
>>>>> jdbc:mysql://p.q.r.s:3306/Schema?useSSL=false&zeroDateTimeBehavior=convertToNull
>>>>> │ OK
>>>>> jdbc/database2 │ MySQL   │ 5.6.31-log │
>>>>> jdbc:mysql://the_db_server:3306/schema?useSSL=false               
>>>>>      
>>>>>                     │ OK
>>>>> jdbc/database2 │ MySQL   │ 5.6.31-log │
>>>>> jdbc:mysql://the_db_server:3306/schema?useSSL=false               
>>>>>      
>>>>>                     │ OK
>>>>> jdbc/databawe1 │ MySQL   │ 5.5.61-cll │
>>>>> jdbc:mysql://p.q.r.s:3306/Schema?useSSL=false&zeroDateTimeBehavior=convertToNull
>>>>> │ OK
>>>>>
>>>>>   [pipe-jdbc:ds-list] WARN
>>>>> org.apache.karaf.jdbc.internal.JdbcServiceImpl - Multiple JDBC
>>>>> datasources found with the same service ranking for jdbc/myDB
>>>>>
>>>>>
>>>>> [org.osgi.service.jdbc.DataSourceFactory]
>>>>> -----------------------------------------
>>>>>  osgi.jdbc.driver.class = com.mysql.jdbc.Driver
>>>>>  osgi.jdbc.driver.name = com.mysql.jdbc
>>>>>  osgi.jdbc.driver.version = 5.1.34
>>>>>  service.bundleid = 172
>>>>>  service.id <http://service.id> <http://service.id>
>>>>> <http://service.id> = 415
>>>>>  service.scope = singleton
>>>>> *Provided by : 
>>>>>  Oracle Corporation's JDBC Driver for MySQL (172)*
>>>>> Used by: 
>>>>>  OPS4J Pax JDBC Config (12)
>>>>>
>>>>> [org.osgi.service.jdbc.DataSourceFactory]
>>>>> -----------------------------------------
>>>>>  osgi.jdbc.driver.class = com.mysql.jdbc.Driver
>>>>>  osgi.jdbc.driver.name = mysql
>>>>>  service.bundleid = 235
>>>>>  service.id <http://service.id> <http://service.id>
>>>>> <http://service.id> = 420
>>>>>  service.scope = singleton
>>>>> *Provided by : 
>>>>>  OPS4J Pax JDBC MySQL Driver Adapter (235)*
>>>>> Used by: 
>>>>>  OPS4J Pax JDBC Config (12)
>>>>>
>>>>>
>>>>> Kind Regards,
>>>>>
>>>>> Erwin
>>>>
>>>> --
>>>> Jean-Baptiste Onofré
>>>> [hidden email] <mailto:[hidden email]>
>>>> <mailto:[hidden email]>
>>>> http://blog.nanthrax.net
>>>> Talend - http://www.talend.com
>>>
>>
>> --
>> Jean-Baptiste Onofré
>> [hidden email] <mailto:[hidden email]>
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: Karaf-4.2.5 - Duplicate MySQL DataSourceFactories

cschneider
Could it be that the bundle "org.ops4j.pax.jdbc" provides a generic wrapper while pax-jdbc-mysql provides the specific one?

It might be difficult to spot as org.ops4j.pax.jdbc acts on behalf of the mysql driver. So it is not obvious what happens.

If it is the case we might have to look into the the generic wrapper .. we already had this with a different database driver. These duplicate DataSourceFactories are a bit annoying.

Christian


Am Di., 28. Mai 2019 um 06:15 Uhr schrieb Jean-Baptiste Onofré <[hidden email]>:
Hi,

I guess you don't use stage in your boot features right ?

Regards
JB

On 28/05/2019 02:20, Erwin Hogeweg wrote:
> Hi JB,
>
> I poked around a bit more. This is what I found.
>
> When I replace the jdbc feature in the bootFeatures section with only
> the required features I do end up with a single DataSourceFactory and
> two Datasources (which is expected)
>
> <bootFeatures>
> ...
> <!--feature>jdbc</feature-->
> <feature>pax-jdbc-spec</feature>
> <feature>pax-jdbc-mysql</feature>
> <feature>pax-jdbc-config</feature>
> <feature>pax-jdbc-pool-dbcp2</feature>
> ...
>
> *karaf*@root()> services|grepDataSource
> [javax.sql.*DataSource*]
> [javax.sql.*DataSource*]
> [org.osgi.service.jdbc.*DataSource*Factory]
> [org.ops4j.pax.jdbc.pool.common.Pooled*DataSource*Factory]
> [org.ops4j.pax.jdbc.pool.common.Pooled*DataSource*Factory]
>
> But now I have lost the console commands. When I manually install the
> jdbc feature I get the console commands back but now I also have
> duplicate DSFactory again.
>
> Just FYI.
>
>
> Regards,
>
> Erwin
>
>
>> On May 22, 2019, at 09:39, Jean-Baptiste Onofré <[hidden email]
>> <mailto:[hidden email]>> wrote:
>>
>> Hi Erwin,
>>
>> Hmmm, that's weird. Let me try to reproduce on Karaf example using MySQL.
>>
>> Regards
>> JB
>>
>> On 22/05/2019 15:33, Erwin Hogeweg wrote:
>>> Thanks JB…
>>>
>>> Trying to get this to work by modding the feature.xml. This approach
>>> doesn’t work because the the pax-jdbc feature is still pulled in as a
>>> depended feature.
>>> <!--feature version="1.3.1">pax-jdbc</feature>-->
>>>         <feature version="1.3.1">pax-jdbc-config</feature>
>>>         <feature version="1.3.1">pax-jdbc-pool-dbcp2</feature>
>>>         <feature version="1.3.1">pax-jdbc-mysql</feature>
>>>
>>> So I tried 1.3.5 as you recommended: 
>>> <!--feature version="1.3.1">pax-jdbc</feature>-->
>>>         <feature version="1.3.5">pax-jdbc-config</feature>
>>>         <feature version="1.3.5">pax-jdbc-pool-dbcp2</feature>
>>>         <feature version="1.3.5">pax-jdbc-mysql</feature>
>>>
>>> But those 1.3.5 features don’t appear to exist yet. 
>>>
>>> Next approach, just include the individual bundles: 
>>> <!-- pax-jdbc 1.3.5 -->
>>> <bundle
>>> start-level="30">mvn:org.apache.commons/commons-dbcp2/2.6.0</bundle>
>>>         <bundle
>>> start-level="30">mvn:org.ops4j.pax.jdbc/pax-jdbc-config/1.3.5</bundle>
>>>         <bundle
>>> start-level="30">mvn:org.ops4j.pax.jdbc/pax-jdbc-pool-dbcp2/1.3.5</bundle>
>>>         <bundle
>>> start-level="30">mvn:org.ops4j.pax.jdbc/pax-jdbc-mysql/1.3.5</bundle>
>>>
>>> But now I am ending up pulling in a bunch of depended bundles. I have no
>>> problem to continue down this path but I am not sure this is the right
>>> direction.
>>>
>>> Please share your opinion.
>>>
>>>
>>> Thanks, Erwin  
>>>
>>>> On May 22, 2019, at 00:53, Jean-Baptiste Onofré <[hidden email]
>>>> <mailto:[hidden email]>
>>>> <mailto:[hidden email]>> wrote:
>>>>
>>>> Hi Erwin,
>>>>
>>>> First, I'm suggesting to upgrade to Pax JDBC 1.3.5 containing fixes.
>>>>
>>>> I guess you have both pax-jdbc-config feature and pax-jdbc bundle
>>>> installed.
>>>> pax-jdbc bundle is a wrapper that automatically detect and expose a
>>>> factory.
>>>>
>>>> It's similar to what I fixed in
>>>> https://ops4j1.jira.com/browse/PAXJDBC-135.
>>>>
>>>> You should not install pax-jdbc bundle IMHO as you are using
>>>> pax-jdbc-mysql feature.
>>>>
>>>> Regards
>>>> JB
>>>>
>>>> On 22/05/2019 04:28, Erwin Hogeweg wrote:
>>>>> Hi,
>>>>>
>>>>> Not sure if I am doing something wrong or if this is a known issue.
>>>>> I am
>>>>> using Karaf-4.2.5 with pax-jdbc-1.3.1 and I end up with two identical
>>>>> DataSourceFactories and 2 identical Data Sources. One from the
>>>>> mysql-5.1.34 Oracle bundle and one from the pax-jdbc-mysql adapter
>>>>> bundle.
>>>>>
>>>>> When I use jdbc:ds-list I see 2 Datasources for ea. database and Karaf
>>>>> even generates a warning msg that I have duplicate DataSources and that
>>>>> I should check my config.
>>>>>
>>>>> I only have ONE config file for ea. database.
>>>>>
>>>>> Name           │ Product │ Version    │ URL                            
>>>>>                                                             │ Status
>>>>> ───────────────┼─────────┼────────────┼─────────────────────────────────────────────────────────────────────────────────────────────┼───────
>>>>> jdbc/database1 │ MySQL   │ 5.5.61-cll │
>>>>> jdbc:mysql://p.q.r.s:3306/Schema?useSSL=false&zeroDateTimeBehavior=convertToNull
>>>>> │ OK
>>>>> jdbc/database2 │ MySQL   │ 5.6.31-log │
>>>>> jdbc:mysql://the_db_server:3306/schema?useSSL=false               
>>>>>      
>>>>>                     │ OK
>>>>> jdbc/database2 │ MySQL   │ 5.6.31-log │
>>>>> jdbc:mysql://the_db_server:3306/schema?useSSL=false               
>>>>>      
>>>>>                     │ OK
>>>>> jdbc/databawe1 │ MySQL   │ 5.5.61-cll │
>>>>> jdbc:mysql://p.q.r.s:3306/Schema?useSSL=false&zeroDateTimeBehavior=convertToNull
>>>>> │ OK
>>>>>
>>>>>   [pipe-jdbc:ds-list] WARN
>>>>> org.apache.karaf.jdbc.internal.JdbcServiceImpl - Multiple JDBC
>>>>> datasources found with the same service ranking for jdbc/myDB
>>>>>
>>>>>
>>>>> [org.osgi.service.jdbc.DataSourceFactory]
>>>>> -----------------------------------------
>>>>>  osgi.jdbc.driver.class = com.mysql.jdbc.Driver
>>>>>  osgi.jdbc.driver.name = com.mysql.jdbc
>>>>>  osgi.jdbc.driver.version = 5.1.34
>>>>>  service.bundleid = 172
>>>>>  service.id <http://service.id> <http://service.id>
>>>>> <http://service.id> = 415
>>>>>  service.scope = singleton
>>>>> *Provided by : 
>>>>>  Oracle Corporation's JDBC Driver for MySQL (172)*
>>>>> Used by: 
>>>>>  OPS4J Pax JDBC Config (12)
>>>>>
>>>>> [org.osgi.service.jdbc.DataSourceFactory]
>>>>> -----------------------------------------
>>>>>  osgi.jdbc.driver.class = com.mysql.jdbc.Driver
>>>>>  osgi.jdbc.driver.name = mysql
>>>>>  service.bundleid = 235
>>>>>  service.id <http://service.id> <http://service.id>
>>>>> <http://service.id> = 420
>>>>>  service.scope = singleton
>>>>> *Provided by : 
>>>>>  OPS4J Pax JDBC MySQL Driver Adapter (235)*
>>>>> Used by: 
>>>>>  OPS4J Pax JDBC Config (12)
>>>>>
>>>>>
>>>>> Kind Regards,
>>>>>
>>>>> Erwin
>>>>
>>>> --
>>>> Jean-Baptiste Onofré
>>>> [hidden email] <mailto:[hidden email]>
>>>> <mailto:[hidden email]>
>>>> http://blog.nanthrax.net
>>>> Talend - http://www.talend.com
>>>
>>
>> --
>> Jean-Baptiste Onofré
>> [hidden email] <mailto:[hidden email]>
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com


--
--
Christian Schneider

http://www.liquid-reality.de

Computer Scientist

Reply | Threaded
Open this post in threaded view
|

Re: Karaf-4.2.5 - Duplicate MySQL DataSourceFactories

Erwin Hogeweg
In reply to this post by jbonofre
Hi JB,

> I guess you don't use stage in your boot features right ?
Can you elaborate on this? I am not sure I understand what you are asking.

Regards,

Erwin

>
> Regards
> JB
>
>> On 28/05/2019 02:20, Erwin Hogeweg wrote:
>> Hi JB,
>>
>> I poked around a bit more. This is what I found.
>>
>> When I replace the jdbc feature in the bootFeatures section with only
>> the required features I do end up with a single DataSourceFactory and
>> two Datasources (which is expected)
>>
>> <bootFeatures>
>> ...
>> <!--feature>jdbc</feature-->
>> <feature>pax-jdbc-spec</feature>
>> <feature>pax-jdbc-mysql</feature>
>> <feature>pax-jdbc-config</feature>
>> <feature>pax-jdbc-pool-dbcp2</feature>
>> ...
>>
>> *karaf*@root()> services|grepDataSource
>> [javax.sql.*DataSource*]
>> [javax.sql.*DataSource*]
>> [org.osgi.service.jdbc.*DataSource*Factory]
>> [org.ops4j.pax.jdbc.pool.common.Pooled*DataSource*Factory]
>> [org.ops4j.pax.jdbc.pool.common.Pooled*DataSource*Factory]
>>
>> But now I have lost the console commands. When I manually install the
>> jdbc feature I get the console commands back but now I also have
>> duplicate DSFactory again.
>>
>> Just FYI.
>>
>>
>> Regards,
>>
>> Erwin
>>
>>
>>> On May 22, 2019, at 09:39, Jean-Baptiste Onofré <[hidden email]
>>> <mailto:[hidden email]>> wrote:
>>>
>>> Hi Erwin,
>>>
>>> Hmmm, that's weird. Let me try to reproduce on Karaf example using MySQL.
>>>
>>> Regards
>>> JB
>>>
>>>> On 22/05/2019 15:33, Erwin Hogeweg wrote:
>>>> Thanks JB…
>>>>
>>>> Trying to get this to work by modding the feature.xml. This approach
>>>> doesn’t work because the the pax-jdbc feature is still pulled in as a
>>>> depended feature.
>>>> <!--feature version="1.3.1">pax-jdbc</feature>-->
>>>>         <feature version="1.3.1">pax-jdbc-config</feature>
>>>>         <feature version="1.3.1">pax-jdbc-pool-dbcp2</feature>
>>>>         <feature version="1.3.1">pax-jdbc-mysql</feature>
>>>>
>>>> So I tried 1.3.5 as you recommended:
>>>> <!--feature version="1.3.1">pax-jdbc</feature>-->
>>>>         <feature version="1.3.5">pax-jdbc-config</feature>
>>>>         <feature version="1.3.5">pax-jdbc-pool-dbcp2</feature>
>>>>         <feature version="1.3.5">pax-jdbc-mysql</feature>
>>>>
>>>> But those 1.3.5 features don’t appear to exist yet.
>>>>
>>>> Next approach, just include the individual bundles:
>>>> <!-- pax-jdbc 1.3.5 -->
>>>> <bundle
>>>> start-level="30">mvn:org.apache.commons/commons-dbcp2/2.6.0</bundle>
>>>>         <bundle
>>>> start-level="30">mvn:org.ops4j.pax.jdbc/pax-jdbc-config/1.3.5</bundle>
>>>>         <bundle
>>>> start-level="30">mvn:org.ops4j.pax.jdbc/pax-jdbc-pool-dbcp2/1.3.5</bundle>
>>>>         <bundle
>>>> start-level="30">mvn:org.ops4j.pax.jdbc/pax-jdbc-mysql/1.3.5</bundle>
>>>>
>>>> But now I am ending up pulling in a bunch of depended bundles. I have no
>>>> problem to continue down this path but I am not sure this is the right
>>>> direction.
>>>>
>>>> Please share your opinion.
>>>>
>>>>
>>>> Thanks, Erwin  
>>>>
>>>>> On May 22, 2019, at 00:53, Jean-Baptiste Onofré <[hidden email]
>>>>> <mailto:[hidden email]>
>>>>> <mailto:[hidden email]>> wrote:
>>>>>
>>>>> Hi Erwin,
>>>>>
>>>>> First, I'm suggesting to upgrade to Pax JDBC 1.3.5 containing fixes.
>>>>>
>>>>> I guess you have both pax-jdbc-config feature and pax-jdbc bundle
>>>>> installed.
>>>>> pax-jdbc bundle is a wrapper that automatically detect and expose a
>>>>> factory.
>>>>>
>>>>> It's similar to what I fixed in
>>>>> https://ops4j1.jira.com/browse/PAXJDBC-135.
>>>>>
>>>>> You should not install pax-jdbc bundle IMHO as you are using
>>>>> pax-jdbc-mysql feature.
>>>>>
>>>>> Regards
>>>>> JB
>>>>>
>>>>>> On 22/05/2019 04:28, Erwin Hogeweg wrote:
>>>>>> Hi,
>>>>>>
>>>>>> Not sure if I am doing something wrong or if this is a known issue.
>>>>>> I am
>>>>>> using Karaf-4.2.5 with pax-jdbc-1.3.1 and I end up with two identical
>>>>>> DataSourceFactories and 2 identical Data Sources. One from the
>>>>>> mysql-5.1.34 Oracle bundle and one from the pax-jdbc-mysql adapter
>>>>>> bundle.
>>>>>>
>>>>>> When I use jdbc:ds-list I see 2 Datasources for ea. database and Karaf
>>>>>> even generates a warning msg that I have duplicate DataSources and that
>>>>>> I should check my config.
>>>>>>
>>>>>> I only have ONE config file for ea. database.
>>>>>>
>>>>>> Name           │ Product │ Version    │ URL                            
>>>>>>                                                             │ Status
>>>>>> ───────────────┼─────────┼────────────┼─────────────────────────────────────────────────────────────────────────────────────────────┼───────
>>>>>> jdbc/database1 │ MySQL   │ 5.5.61-cll │
>>>>>> jdbc:mysql://p.q.r.s:3306/Schema?useSSL=false&zeroDateTimeBehavior=convertToNull
>>>>>> │ OK
>>>>>> jdbc/database2 │ MySQL   │ 5.6.31-log │
>>>>>> jdbc:mysql://the_db_server:3306/schema?useSSL=false              
>>>>>>      
>>>>>>                     │ OK
>>>>>> jdbc/database2 │ MySQL   │ 5.6.31-log │
>>>>>> jdbc:mysql://the_db_server:3306/schema?useSSL=false              
>>>>>>      
>>>>>>                     │ OK
>>>>>> jdbc/databawe1 │ MySQL   │ 5.5.61-cll │
>>>>>> jdbc:mysql://p.q.r.s:3306/Schema?useSSL=false&zeroDateTimeBehavior=convertToNull
>>>>>> │ OK
>>>>>>
>>>>>>   [pipe-jdbc:ds-list] WARN
>>>>>> org.apache.karaf.jdbc.internal.JdbcServiceImpl - Multiple JDBC
>>>>>> datasources found with the same service ranking for jdbc/myDB
>>>>>>
>>>>>>
>>>>>> [org.osgi.service.jdbc.DataSourceFactory]
>>>>>> -----------------------------------------
>>>>>>  osgi.jdbc.driver.class = com.mysql.jdbc.Driver
>>>>>>  osgi.jdbc.driver.name = com.mysql.jdbc
>>>>>>  osgi.jdbc.driver.version = 5.1.34
>>>>>>  service.bundleid = 172
>>>>>>  service.id <http://service.id> <http://service.id>
>>>>>> <http://service.id> = 415
>>>>>>  service.scope = singleton
>>>>>> *Provided by :
>>>>>>  Oracle Corporation's JDBC Driver for MySQL (172)*
>>>>>> Used by:
>>>>>>  OPS4J Pax JDBC Config (12)
>>>>>>
>>>>>> [org.osgi.service.jdbc.DataSourceFactory]
>>>>>> -----------------------------------------
>>>>>>  osgi.jdbc.driver.class = com.mysql.jdbc.Driver
>>>>>>  osgi.jdbc.driver.name = mysql
>>>>>>  service.bundleid = 235
>>>>>>  service.id <http://service.id> <http://service.id>
>>>>>> <http://service.id> = 420
>>>>>>  service.scope = singleton
>>>>>> *Provided by :
>>>>>>  OPS4J Pax JDBC MySQL Driver Adapter (235)*
>>>>>> Used by:
>>>>>>  OPS4J Pax JDBC Config (12)
>>>>>>
>>>>>>
>>>>>> Kind Regards,
>>>>>>
>>>>>> Erwin
>>>>>
>>>>> --
>>>>> Jean-Baptiste Onofré
>>>>> [hidden email] <mailto:[hidden email]>
>>>>> <mailto:[hidden email]>
>>>>> http://blog.nanthrax.net
>>>>> Talend - http://www.talend.com
>>>>
>>>
>>> --
>>> Jean-Baptiste Onofré
>>> [hidden email] <mailto:[hidden email]>
>>> http://blog.nanthrax.net
>>> Talend - http://www.talend.com
>>
>
> --
> Jean-Baptiste Onofré
> [hidden email]
> http://blog.nanthrax.net
> Talend - http://www.talend.com

Reply | Threaded
Open this post in threaded view
|

Re: Karaf-4.2.5 - Duplicate MySQL DataSourceFactories

Erwin Hogeweg
Hi JB,

>> I guess you don't use stage in your boot features right ?
> Can you elaborate on this? I am not sure I understand what you are asking.
I understand the question now, and indeed, I do not. I am not sure how this could/should solve this issue though. I doesn’t seem to matter in which order these bundles are installed.

Erwin

>
> Regards,
>
> Erwin
>
>>
>> Regards
>> JB
>>
>>> On 28/05/2019 02:20, Erwin Hogeweg wrote:
>>> Hi JB,
>>>
>>> I poked around a bit more. This is what I found.
>>>
>>> When I replace the jdbc feature in the bootFeatures section with only
>>> the required features I do end up with a single DataSourceFactory and
>>> two Datasources (which is expected)
>>>
>>> <bootFeatures>
>>> ...
>>> <!--feature>jdbc</feature-->
>>> <feature>pax-jdbc-spec</feature>
>>> <feature>pax-jdbc-mysql</feature>
>>> <feature>pax-jdbc-config</feature>
>>> <feature>pax-jdbc-pool-dbcp2</feature>
>>> ...
>>>
>>> *karaf*@root()> services|grepDataSource
>>> [javax.sql.*DataSource*]
>>> [javax.sql.*DataSource*]
>>> [org.osgi.service.jdbc.*DataSource*Factory]
>>> [org.ops4j.pax.jdbc.pool.common.Pooled*DataSource*Factory]
>>> [org.ops4j.pax.jdbc.pool.common.Pooled*DataSource*Factory]
>>>
>>> But now I have lost the console commands. When I manually install the
>>> jdbc feature I get the console commands back but now I also have
>>> duplicate DSFactory again.
>>>
>>> Just FYI.
>>>
>>>
>>> Regards,
>>>
>>> Erwin
>>>
>>>
>>>> On May 22, 2019, at 09:39, Jean-Baptiste Onofré <[hidden email]
>>>> <mailto:[hidden email]>> wrote:
>>>>
>>>> Hi Erwin,
>>>>
>>>> Hmmm, that's weird. Let me try to reproduce on Karaf example using MySQL.
>>>>
>>>> Regards
>>>> JB
>>>>
>>>>> On 22/05/2019 15:33, Erwin Hogeweg wrote:
>>>>> Thanks JB…
>>>>>
>>>>> Trying to get this to work by modding the feature.xml. This approach
>>>>> doesn’t work because the the pax-jdbc feature is still pulled in as a
>>>>> depended feature.
>>>>> <!--feature version="1.3.1">pax-jdbc</feature>-->
>>>>>        <feature version="1.3.1">pax-jdbc-config</feature>
>>>>>        <feature version="1.3.1">pax-jdbc-pool-dbcp2</feature>
>>>>>        <feature version="1.3.1">pax-jdbc-mysql</feature>
>>>>>
>>>>> So I tried 1.3.5 as you recommended:
>>>>> <!--feature version="1.3.1">pax-jdbc</feature>-->
>>>>>        <feature version="1.3.5">pax-jdbc-config</feature>
>>>>>        <feature version="1.3.5">pax-jdbc-pool-dbcp2</feature>
>>>>>        <feature version="1.3.5">pax-jdbc-mysql</feature>
>>>>>
>>>>> But those 1.3.5 features don’t appear to exist yet.
>>>>>
>>>>> Next approach, just include the individual bundles:
>>>>> <!-- pax-jdbc 1.3.5 -->
>>>>> <bundle
>>>>> start-level="30">mvn:org.apache.commons/commons-dbcp2/2.6.0</bundle>
>>>>>        <bundle
>>>>> start-level="30">mvn:org.ops4j.pax.jdbc/pax-jdbc-config/1.3.5</bundle>
>>>>>        <bundle
>>>>> start-level="30">mvn:org.ops4j.pax.jdbc/pax-jdbc-pool-dbcp2/1.3.5</bundle>
>>>>>        <bundle
>>>>> start-level="30">mvn:org.ops4j.pax.jdbc/pax-jdbc-mysql/1.3.5</bundle>
>>>>>
>>>>> But now I am ending up pulling in a bunch of depended bundles. I have no
>>>>> problem to continue down this path but I am not sure this is the right
>>>>> direction.
>>>>>
>>>>> Please share your opinion.
>>>>>
>>>>>
>>>>> Thanks, Erwin  
>>>>>
>>>>>> On May 22, 2019, at 00:53, Jean-Baptiste Onofré <[hidden email]
>>>>>> <mailto:[hidden email]>
>>>>>> <mailto:[hidden email]>> wrote:
>>>>>>
>>>>>> Hi Erwin,
>>>>>>
>>>>>> First, I'm suggesting to upgrade to Pax JDBC 1.3.5 containing fixes.
>>>>>>
>>>>>> I guess you have both pax-jdbc-config feature and pax-jdbc bundle
>>>>>> installed.
>>>>>> pax-jdbc bundle is a wrapper that automatically detect and expose a
>>>>>> factory.
>>>>>>
>>>>>> It's similar to what I fixed in
>>>>>> https://ops4j1.jira.com/browse/PAXJDBC-135.
>>>>>>
>>>>>> You should not install pax-jdbc bundle IMHO as you are using
>>>>>> pax-jdbc-mysql feature.
>>>>>>
>>>>>> Regards
>>>>>> JB
>>>>>>
>>>>>>> On 22/05/2019 04:28, Erwin Hogeweg wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> Not sure if I am doing something wrong or if this is a known issue.
>>>>>>> I am
>>>>>>> using Karaf-4.2.5 with pax-jdbc-1.3.1 and I end up with two identical
>>>>>>> DataSourceFactories and 2 identical Data Sources. One from the
>>>>>>> mysql-5.1.34 Oracle bundle and one from the pax-jdbc-mysql adapter
>>>>>>> bundle.
>>>>>>>
>>>>>>> When I use jdbc:ds-list I see 2 Datasources for ea. database and Karaf
>>>>>>> even generates a warning msg that I have duplicate DataSources and that
>>>>>>> I should check my config.
>>>>>>>
>>>>>>> I only have ONE config file for ea. database.
>>>>>>>
>>>>>>> Name           │ Product │ Version    │ URL                            
>>>>>>>                                                            │ Status
>>>>>>> ───────────────┼─────────┼────────────┼─────────────────────────────────────────────────────────────────────────────────────────────┼───────
>>>>>>> jdbc/database1 │ MySQL   │ 5.5.61-cll │
>>>>>>> jdbc:mysql://p.q.r.s:3306/Schema?useSSL=false&zeroDateTimeBehavior=convertToNull
>>>>>>> │ OK
>>>>>>> jdbc/database2 │ MySQL   │ 5.6.31-log │
>>>>>>> jdbc:mysql://the_db_server:3306/schema?useSSL=false              
>>>>>>>
>>>>>>>                    │ OK
>>>>>>> jdbc/database2 │ MySQL   │ 5.6.31-log │
>>>>>>> jdbc:mysql://the_db_server:3306/schema?useSSL=false              
>>>>>>>
>>>>>>>                    │ OK
>>>>>>> jdbc/databawe1 │ MySQL   │ 5.5.61-cll │
>>>>>>> jdbc:mysql://p.q.r.s:3306/Schema?useSSL=false&zeroDateTimeBehavior=convertToNull
>>>>>>> │ OK
>>>>>>>
>>>>>>>  [pipe-jdbc:ds-list] WARN
>>>>>>> org.apache.karaf.jdbc.internal.JdbcServiceImpl - Multiple JDBC
>>>>>>> datasources found with the same service ranking for jdbc/myDB
>>>>>>>
>>>>>>>
>>>>>>> [org.osgi.service.jdbc.DataSourceFactory]
>>>>>>> -----------------------------------------
>>>>>>> osgi.jdbc.driver.class = com.mysql.jdbc.Driver
>>>>>>> osgi.jdbc.driver.name = com.mysql.jdbc
>>>>>>> osgi.jdbc.driver.version = 5.1.34
>>>>>>> service.bundleid = 172
>>>>>>> service.id <http://service.id> <http://service.id>
>>>>>>> <http://service.id> = 415
>>>>>>> service.scope = singleton
>>>>>>> *Provided by :
>>>>>>> Oracle Corporation's JDBC Driver for MySQL (172)*
>>>>>>> Used by:
>>>>>>> OPS4J Pax JDBC Config (12)
>>>>>>>
>>>>>>> [org.osgi.service.jdbc.DataSourceFactory]
>>>>>>> -----------------------------------------
>>>>>>> osgi.jdbc.driver.class = com.mysql.jdbc.Driver
>>>>>>> osgi.jdbc.driver.name = mysql
>>>>>>> service.bundleid = 235
>>>>>>> service.id <http://service.id> <http://service.id>
>>>>>>> <http://service.id> = 420
>>>>>>> service.scope = singleton
>>>>>>> *Provided by :
>>>>>>> OPS4J Pax JDBC MySQL Driver Adapter (235)*
>>>>>>> Used by:
>>>>>>> OPS4J Pax JDBC Config (12)
>>>>>>>
>>>>>>>
>>>>>>> Kind Regards,
>>>>>>>
>>>>>>> Erwin
>>>>>>
>>>>>> --
>>>>>> Jean-Baptiste Onofré
>>>>>> [hidden email] <mailto:[hidden email]>
>>>>>> <mailto:[hidden email]>
>>>>>> http://blog.nanthrax.net
>>>>>> Talend - http://www.talend.com
>>>>>
>>>>
>>>> --
>>>> Jean-Baptiste Onofré
>>>> [hidden email] <mailto:[hidden email]>
>>>> http://blog.nanthrax.net
>>>> Talend - http://www.talend.com
>>>
>>
>> --
>> Jean-Baptiste Onofré
>> [hidden email]
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
>