DB Connection pool not getting created with KARAF 4.2.1 (Open JPA 3.0.0)

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

DB Connection pool not getting created with KARAF 4.2.1 (Open JPA 3.0.0)

munishgupta.asr
This post was updated on .
Hi All,

With KARAF 4.2.0, OpenJPA version was 2.4.2. I upgraded KARAF to 4.2.1 and
with that, Open JPA feature version has been upgraded to 3.0.0.

After bringing server up, I can see exceptions in log while DB pool is
getting created.

Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC
driver class 'org.hsqldb.jdbc.JDBCDriver'
        at
org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1429)
~[?:?]
        at
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
~[?:?]
        at
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
~[?:?]
        at
org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:110)
~[?:?]
        at
org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:86)
~[?:?]
        at
org.apache.openjpa.jdbc.sql.DBDictionaryFactory.newDBDictionary(DBDictionaryFactory.java:93)
~[?:?]

My JDBC driver bundles are same like before (SQL or Postgre or HSQL), that
does not have any changes.
I can see the org.hsqldb.jdbc.JDBCDriver is available and exported via
driver bundle.

Can you suggest something what could be probable issue here? it is working
fine with KARAF 4.2.0 / OpenJPA 2.4.2.

Regards
Munish
       



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Reply | Threaded
Open this post in threaded view
|

Re: DB Connection pool n ot getting created with KARAF 4.2.1 (Open JPA 3.0.0)

jbonofre
Hi,

did you install the pax-jdbc corresponding feature ?

How did you create the datasource ?

Regards
JB

On 04/10/2018 13:35, munishgupta.asr wrote:

> Hi All,
>
> With KARAF 4.2.0, OpenJPA version was 2.4.2. I upgraded KARAF to 4.2.1 and
> with that, Open JPA feature version has been upgraded to 3.0.0.
>
> After bringing server up, I can see exceptions in log while DB pool is
> getting created.
>
> Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC
> driver class 'org.hsqldb.jdbc.JDBCDriver'
> at
> org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1429)
> ~[?:?]
> at
> org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
> ~[?:?]
> at
> org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
> ~[?:?]
> at
> org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:110)
> ~[?:?]
> at
> org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:86)
> ~[?:?]
> at
> org.apache.openjpa.jdbc.sql.DBDictionaryFactory.newDBDictionary(DBDictionaryFactory.java:93)
> ~[?:?]
>
> My JDBC driver bundles are same like before (SQL or Postgre or HSQL), that
> does not have any changes.
> I can see the org.hsqldb.jdbc.JDBCDriver is available and exported via
> driver bundle.
>
> Can you suggest something what could be probable issue here? it is working
> fine with KARAF 4.2.0 / OpenJPA 2.4.2.
>
> Regards
> Munish
>
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>

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

Re: DB Connection pool n ot getting created with KARAF 4.2.1 (Open JPA 3.0.0)

munishgupta.asr
Hi JB,

We were not using Pax-JDBC earlier also. we are using JAVAX.SQL.Datasource
(implementation from common-dbcp) to create the DB pool.

in our project, we are starting the Native JDBC drivers of all database
(hsql, sql, posgre) and based on configuration, DB will get created at
startup.

This is my exact exception stack while JDBC driver class is available in
ClassPath. I did not change anything else in code except versions for 4.2.1
and required dependencies as per release notes (it includes OpenJPA too).
same thing was working fine earlier.

org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class
'org.hsqldb.jdbc.JDBCDriver'
        at
org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1429)
~[?:?]
        at
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
~[?:?]
        at
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
~[?:?]
        at Proxy98870fa8_a13e_49a3_b955_928296ff7d18.getConnection(Unknown Source)
~[?:?]
        at
com.good.gcs.jsonstore.dbmanager.DbManagerForDataSource.getDatabaseType(DbManagerForDataSource.java:53)
~[?:?]



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Reply | Threaded
Open this post in threaded view
|

Re: DB Connection pool n ot getting created with KARAF 4.2.1 (Open JPA 3.0.0)

jbonofre
Hi,

How do you load the JDBC driver ? Using something like Class.forName() ?

Regards
JB

On 05/10/2018 14:14, munishgupta.asr wrote:

> Hi JB,
>
> We were not using Pax-JDBC earlier also. we are using JAVAX.SQL.Datasource
> (implementation from common-dbcp) to create the DB pool.
>
> in our project, we are starting the Native JDBC drivers of all database
> (hsql, sql, posgre) and based on configuration, DB will get created at
> startup.
>
> This is my exact exception stack while JDBC driver class is available in
> ClassPath. I did not change anything else in code except versions for 4.2.1
> and required dependencies as per release notes (it includes OpenJPA too).
> same thing was working fine earlier.
>
> org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class
> 'org.hsqldb.jdbc.JDBCDriver'
> at
> org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1429)
> ~[?:?]
> at
> org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
> ~[?:?]
> at
> org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
> ~[?:?]
> at Proxy98870fa8_a13e_49a3_b955_928296ff7d18.getConnection(Unknown Source)
> ~[?:?]
> at
> com.good.gcs.jsonstore.dbmanager.DbManagerForDataSource.getDatabaseType(DbManagerForDataSource.java:53)
> ~[?:?]
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>

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

Re: DB Connection pool n ot getting created with KARAF 4.2.1 (Open JPA 3.0.0)

munishgupta.asr
yes exactly like that



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Reply | Threaded
Open this post in threaded view
|

Re: DB Connection pool n ot getting created with KARAF 4.2.1 (Open JPA 3.0.0)

Tim Ward-2
Have you considered using the OSGi Transaction Control specification to manage all of this? It provides support for pooling and reliable resource management in a Database vendor independent way. The Reference implementation from Apache Aries supports both resource local and XA when using JPA.

Best Regards,

Tim

> On 5 Oct 2018, at 13:37, munishgupta.asr <[hidden email]> wrote:
>
> yes exactly like that
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Reply | Threaded
Open this post in threaded view
|

Re: DB Connection pool n ot getting created with KARAF 4.2.1 (Open JPA 3.0.0)

jbonofre
Pax JDBC can also be used.

Regards
JB

On 05/10/2018 15:56, Tim Ward wrote:

> Have you considered using the OSGi Transaction Control specification to manage all of this? It provides support for pooling and reliable resource management in a Database vendor independent way. The Reference implementation from Apache Aries supports both resource local and XA when using JPA.
>
> Best Regards,
>
> Tim
>
>> On 5 Oct 2018, at 13:37, munishgupta.asr <[hidden email]> wrote:
>>
>> yes exactly like that
>>
>>
>>
>> --
>> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>

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

Re: DB Connection pool n ot getting created with KARAF 4.2.1 (Open JPA 3.0.0)

jbonofre
In reply to this post by munishgupta.asr
Just for a test, did you try to add the jdbc driver as Private-Package ?

I think the JDBC driver is not in the classloader and so it's not found
when you do Class.forName().

You have to use explicitly import the jdbc driver package or better to
define the datasource externally (using Karaf jdbc feature for instance).

Regards
JB

On 05/10/2018 14:37, munishgupta.asr wrote:
> yes exactly like that
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>

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

Re: DB Connection pool n ot getting created with KARAF 4.2.1 (Open JPA 3.0.0)

fpapon
Hi,

I had an issue when adding the karaf-jpa-example with OpenJPA 3 related
to the PersistenceProviderImpl and the SPI in Aries JPA.

I'm not sure it works well actually, I can make some new test.

regards,

François Papon
[hidden email]

Le 05/10/2018 à 17:58, Jean-Baptiste Onofré a écrit :

> Just for a test, did you try to add the jdbc driver as Private-Package ?
>
> I think the JDBC driver is not in the classloader and so it's not found
> when you do Class.forName().
>
> You have to use explicitly import the jdbc driver package or better to
> define the datasource externally (using Karaf jdbc feature for instance).
>
> Regards
> JB
>
> On 05/10/2018 14:37, munishgupta.asr wrote:
>> yes exactly like that
>>
>>
>>
>> --
>> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>>

François Papon
fpapon@apache.org
Yupiik - https://www.yupiik.com
Reply | Threaded
Open this post in threaded view
|

Re: DB Connection pool n ot getting created with KARAF 4.2.1 (Open JPA 3.0.0)

jbonofre
Not sure it's the same issue, here the user seems to have a problem with
the JDBC driver.

Regards
JB

On 05/10/2018 17:37, Francois Papon wrote:

> Hi,
>
> I had an issue when adding the karaf-jpa-example with OpenJPA 3 related
> to the PersistenceProviderImpl and the SPI in Aries JPA.
>
> I'm not sure it works well actually, I can make some new test.
>
> regards,
>
> François Papon
> [hidden email]
>
> Le 05/10/2018 à 17:58, Jean-Baptiste Onofré a écrit :
>> Just for a test, did you try to add the jdbc driver as Private-Package ?
>>
>> I think the JDBC driver is not in the classloader and so it's not found
>> when you do Class.forName().
>>
>> You have to use explicitly import the jdbc driver package or better to
>> define the datasource externally (using Karaf jdbc feature for instance).
>>
>> Regards
>> JB
>>
>> On 05/10/2018 14:37, munishgupta.asr wrote:
>>> yes exactly like that
>>>
>>>
>>>
>>> --
>>> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>>>
>

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

Re: DB Connection pool n ot getting created with KARAF 4.2.1 (Open JPA 3.0.0)

fpapon
Ah yes, JB you're right, I read too fast and I thought it was related to
Aries JPA.

Sorry for the noise ;)

regards,

François Papon
[hidden email]

Le 05/10/2018 à 20:23, Jean-Baptiste Onofré a écrit :

> Not sure it's the same issue, here the user seems to have a problem with
> the JDBC driver.
>
> Regards
> JB
>
> On 05/10/2018 17:37, Francois Papon wrote:
>> Hi,
>>
>> I had an issue when adding the karaf-jpa-example with OpenJPA 3 related
>> to the PersistenceProviderImpl and the SPI in Aries JPA.
>>
>> I'm not sure it works well actually, I can make some new test.
>>
>> regards,
>>
>> François Papon
>> [hidden email]
>>
>> Le 05/10/2018 à 17:58, Jean-Baptiste Onofré a écrit :
>>> Just for a test, did you try to add the jdbc driver as Private-Package ?
>>>
>>> I think the JDBC driver is not in the classloader and so it's not found
>>> when you do Class.forName().
>>>
>>> You have to use explicitly import the jdbc driver package or better to
>>> define the datasource externally (using Karaf jdbc feature for instance).
>>>
>>> Regards
>>> JB
>>>
>>> On 05/10/2018 14:37, munishgupta.asr wrote:
>>>> yes exactly like that
>>>>
>>>>
>>>>
>>>> --
>>>> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>>>>


François Papon
fpapon@apache.org
Yupiik - https://www.yupiik.com