OpenJPA with AriesJPA Java.peristence

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

OpenJPA with AriesJPA Java.peristence

Alex Soto
Hello,

I am running Karaf 4.2.0, trying to setup a project with OpenJPA.  I am getting error:


14:44:07.799 ERROR [FelixDispatchQueue] FrameworkEvent ERROR - org.apache.aries.jpa.container
java.lang.ClassCastException: org.apache.openjpa.persistence.PersistenceProviderImpl cannot be cast to javax.persistence.spi.PersistenceProvider
at org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:84) ~[?:?]
at org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:44) ~[?:?]
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.apache.aries.jpa.container.impl.PersistenceBundleTracker.trackProvider(PersistenceBundleTracker.java:103) ~[?:?]
at org.apache.aries.jpa.container.impl.PersistenceBundleTracker.findPersistenceUnits(PersistenceBundleTracker.java:87) ~[?:?]
at org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:66) ~[?:?]
at org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:39) ~[?:?]
at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:469) ~[?:?]
at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:415) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256) ~[?:?]
at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229) ~[?:?]
at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444) ~[?:?]
at org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915) ~[?:?]
at org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834) ~[?:?]
at org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516) ~[?:?]
at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579) ~[?:?]
at org.apache.felix.framework.Felix.startBundle(Felix.java:2174) ~[?:?]
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1373) ~[?:?]
at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308) ~[?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]



This looks like version mismatch.  I am loading the following packages in my feature:

<feature>aries-blueprint</feature>
<feature>war</feature>
  <feature>camel-core</feature>
<feature>camel-servlet</feature>
<feature>camel-blueprint</feature>
<feature>camel-jackson</feature>
<feature>jndi</feature>
<feature>jdbc</feature>
<feature>transaction</feature>
<feature>jpa</feature>
<feature>openjpa</feature>
<feature>pax-jdbc-mariadb</feature>
        <feature>pax-jdbc-config</feature>


One thing I don’t know if is correct is the javax.persistence dependency in my POM:

<dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>javax.persistence</artifactId>
            <version>2.0.5</version>
            <scope>provided</scope>
        </dependency>

Any hints?

Best regards,
Alex soto



Reply | Threaded
Open this post in threaded view
|

Re: OpenJPA with AriesJPA Java.peristence

jbonofre
Hi,

OpenJPA 2.x still uses JPA 1.x. By default, jpa feature will provide 2.x version.

You should specify the jpa feature version.

Regards
JB

On 05/10/2018 09:08 PM, Alex Soto wrote:

> Hello,
>
> I am running Karaf 4.2.0, trying to setup a project with OpenJPA.  I am getting
> error:
>
>
> 14:44:07.799 ERROR [FelixDispatchQueue] FrameworkEvent ERROR
> - org.apache.aries.jpa.container
> java.lang.ClassCastException: org.apache.openjpa.persistence.PersistenceProviderImpl
> cannot be cast to javax.persistence.spi.PersistenceProvider
> at org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:84)
> ~[?:?]
> at org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:44)
> ~[?:?]
> 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.apache.aries.jpa.container.impl.PersistenceBundleTracker.trackProvider(PersistenceBundleTracker.java:103)
> ~[?:?]
> at org.apache.aries.jpa.container.impl.PersistenceBundleTracker.findPersistenceUnits(PersistenceBundleTracker.java:87)
> ~[?:?]
> at org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:66)
> ~[?:?]
> at org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:39)
> ~[?:?]
> at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:469)
> ~[?:?]
> at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:415)
> ~[?:?]
> at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
> ~[?:?]
> at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229) ~[?:?]
> at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444)
> ~[?:?]
> at org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915)
> ~[?:?]
> at org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
> ~[?:?]
> at org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516)
> ~[?:?]
> at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579) ~[?:?]
> at org.apache.felix.framework.Felix.startBundle(Felix.java:2174) ~[?:?]
> at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1373) ~[?:?]
> at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
> ~[?:?]
> at java.lang.Thread.run(Thread.java:748) [?:?]
>
>
>
> This looks like version mismatch.  I am loading the following packages in my
> feature:
>
> <feature>aries-blueprint</feature>
> <feature>war</feature>
>  <feature>camel-core</feature>
> <feature>camel-servlet</feature>
> <feature>camel-blueprint</feature>
> <feature>camel-jackson</feature>
> <feature>jndi</feature>
> <feature>jdbc</feature>
> <feature>transaction</feature>
> <feature>jpa</feature>
> <feature>openjpa</feature>
> <feature>pax-jdbc-mariadb</feature>
>         <feature>pax-jdbc-config</feature>
>
>
> One thing I don’t know if is correct is the javax.persistence dependency in my POM:
>
> <dependency>
>             <groupId>org.eclipse.persistence</groupId>
>             <artifactId>javax.persistence</artifactId>
>             <version>2.0.5</version>
>             <scope>provided</scope>
>         </dependency>
>
> Any hints?
>
> Best regards,
> Alex soto
>
>
>

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

Re: OpenJPA with AriesJPA Java.peristence

Alex Soto
Thanks JB,

I was hoping to use whatever was defined in the Karaf’s enterprise feature, but if that doesn’t work ,then which version do I need?  I am afraid if I deviate from the versions selected by Kara’s Enterprise feature I will get into more version mismatch problems.   Also what do I put in my POM for javax.persistence dependency?


Best regards,
Alex soto



> On May 10, 2018, at 3:16 PM, Jean-Baptiste Onofré <[hidden email]> wrote:
>
> Hi,
>
> OpenJPA 2.x still uses JPA 1.x. By default, jpa feature will provide 2.x version.
>
> You should specify the jpa feature version.
>
> Regards
> JB
>
> On 05/10/2018 09:08 PM, Alex Soto wrote:
>> Hello,
>>
>> I am running Karaf 4.2.0, trying to setup a project with OpenJPA.  I am getting
>> error:
>>
>>
>> 14:44:07.799 ERROR [FelixDispatchQueue] FrameworkEvent ERROR
>> - org.apache.aries.jpa.container
>> java.lang.ClassCastException: org.apache.openjpa.persistence.PersistenceProviderImpl
>> cannot be cast to javax.persistence.spi.PersistenceProvider
>> at org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:84)
>> ~[?:?]
>> at org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:44)
>> ~[?:?]
>> 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.apache.aries.jpa.container.impl.PersistenceBundleTracker.trackProvider(PersistenceBundleTracker.java:103)
>> ~[?:?]
>> at org.apache.aries.jpa.container.impl.PersistenceBundleTracker.findPersistenceUnits(PersistenceBundleTracker.java:87)
>> ~[?:?]
>> at org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:66)
>> ~[?:?]
>> at org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:39)
>> ~[?:?]
>> at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:469)
>> ~[?:?]
>> at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:415)
>> ~[?:?]
>> at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
>> ~[?:?]
>> at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229) ~[?:?]
>> at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444)
>> ~[?:?]
>> at org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915)
>> ~[?:?]
>> at org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
>> ~[?:?]
>> at org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516)
>> ~[?:?]
>> at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579) ~[?:?]
>> at org.apache.felix.framework.Felix.startBundle(Felix.java:2174) ~[?:?]
>> at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1373) ~[?:?]
>> at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
>> ~[?:?]
>> at java.lang.Thread.run(Thread.java:748) [?:?]
>>
>>
>>
>> This looks like version mismatch.  I am loading the following packages in my
>> feature:
>>
>> <feature>aries-blueprint</feature>
>> <feature>war</feature>
>>  <feature>camel-core</feature>
>> <feature>camel-servlet</feature>
>> <feature>camel-blueprint</feature>
>> <feature>camel-jackson</feature>
>> <feature>jndi</feature>
>> <feature>jdbc</feature>
>> <feature>transaction</feature>
>> <feature>jpa</feature>
>> <feature>openjpa</feature>
>> <feature>pax-jdbc-mariadb</feature>
>>         <feature>pax-jdbc-config</feature>
>>
>>
>> One thing I don’t know if is correct is the javax.persistence dependency in my POM:
>>
>> <dependency>
>>             <groupId>org.eclipse.persistence</groupId>
>>             <artifactId>javax.persistence</artifactId>
>>             <version>2.0.5</version>
>>             <scope>provided</scope>
>>         </dependency>
>>
>> Any hints?
>>
>> Best regards,
>> Alex soto
>>
>>
>>
>
> --
> Jean-Baptiste Onofré
> [hidden email]
> http://blog.nanthrax.net
> Talend - http://www.talend.com

Reply | Threaded
Open this post in threaded view
|

Re: OpenJPA with AriesJPA Java.peristence

jbonofre
Karaf provides both jpa 1.x and  2.x feature.

You just have to  install the right one depending of the engine you are using:

feature:install jpa/1.x
feature:install  openjpa

Regards
JB

On 05/10/2018 09:23 PM, Alex Soto wrote:

> Thanks JB,
>
> I was hoping to use whatever was defined in the Karaf’s enterprise feature, but if that doesn’t work ,then which version do I need?  I am afraid if I deviate from the versions selected by Kara’s Enterprise feature I will get into more version mismatch problems.   Also what do I put in my POM for javax.persistence dependency?
>
>
> Best regards,
> Alex soto
>
>
>
>> On May 10, 2018, at 3:16 PM, Jean-Baptiste Onofré <[hidden email]> wrote:
>>
>> Hi,
>>
>> OpenJPA 2.x still uses JPA 1.x. By default, jpa feature will provide 2.x version.
>>
>> You should specify the jpa feature version.
>>
>> Regards
>> JB
>>
>> On 05/10/2018 09:08 PM, Alex Soto wrote:
>>> Hello,
>>>
>>> I am running Karaf 4.2.0, trying to setup a project with OpenJPA.  I am getting
>>> error:
>>>
>>>
>>> 14:44:07.799 ERROR [FelixDispatchQueue] FrameworkEvent ERROR
>>> - org.apache.aries.jpa.container
>>> java.lang.ClassCastException: org.apache.openjpa.persistence.PersistenceProviderImpl
>>> cannot be cast to javax.persistence.spi.PersistenceProvider
>>> at org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:84)
>>> ~[?:?]
>>> at org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:44)
>>> ~[?:?]
>>> 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.apache.aries.jpa.container.impl.PersistenceBundleTracker.trackProvider(PersistenceBundleTracker.java:103)
>>> ~[?:?]
>>> at org.apache.aries.jpa.container.impl.PersistenceBundleTracker.findPersistenceUnits(PersistenceBundleTracker.java:87)
>>> ~[?:?]
>>> at org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:66)
>>> ~[?:?]
>>> at org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:39)
>>> ~[?:?]
>>> at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:469)
>>> ~[?:?]
>>> at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:415)
>>> ~[?:?]
>>> at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
>>> ~[?:?]
>>> at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229) ~[?:?]
>>> at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444)
>>> ~[?:?]
>>> at org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915)
>>> ~[?:?]
>>> at org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
>>> ~[?:?]
>>> at org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516)
>>> ~[?:?]
>>> at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579) ~[?:?]
>>> at org.apache.felix.framework.Felix.startBundle(Felix.java:2174) ~[?:?]
>>> at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1373) ~[?:?]
>>> at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
>>> ~[?:?]
>>> at java.lang.Thread.run(Thread.java:748) [?:?]
>>>
>>>
>>>
>>> This looks like version mismatch.  I am loading the following packages in my
>>> feature:
>>>
>>> <feature>aries-blueprint</feature>
>>> <feature>war</feature>
>>>  <feature>camel-core</feature>
>>> <feature>camel-servlet</feature>
>>> <feature>camel-blueprint</feature>
>>> <feature>camel-jackson</feature>
>>> <feature>jndi</feature>
>>> <feature>jdbc</feature>
>>> <feature>transaction</feature>
>>> <feature>jpa</feature>
>>> <feature>openjpa</feature>
>>> <feature>pax-jdbc-mariadb</feature>
>>>         <feature>pax-jdbc-config</feature>
>>>
>>>
>>> One thing I don’t know if is correct is the javax.persistence dependency in my POM:
>>>
>>> <dependency>
>>>             <groupId>org.eclipse.persistence</groupId>
>>>             <artifactId>javax.persistence</artifactId>
>>>             <version>2.0.5</version>
>>>             <scope>provided</scope>
>>>         </dependency>
>>>
>>> Any hints?
>>>
>>> Best regards,
>>> Alex soto
>>>
>>>
>>>
>>
>> --
>> Jean-Baptiste Onofré
>> [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: OpenJPA with AriesJPA Java.peristence

Alex Soto
I am sorry I only see one version:

karaf@root()> feature:list | grep jpa
openjpa                                  │ 2.4.2            │          │ Started     │ enterprise-4.2.0                  │ Apache OpenJPA 2.4.x persistence engine support
camel-jpa                                │ 2.21.1           │          │ Uninstalled │ camel-2.21.1                      │
deltaspike-jpa                           │ 1.4.2            │          │ Uninstalled │ org.ops4j.pax.cdi-1.0.0.RC2       │ Apache Deltaspike jpa support
deltaspike-jpa                           │ 1.8.1            │          │ Uninstalled │ org.ops4j.pax.cdi-1.0.0           │ Apache Deltaspike jpa support
jpa                                      │ 2.6.1            │          │ Started     │ aries-jpa-2.6.1                   │ OSGi Persistence Container



Is there a repository I need to add?  

Best regards,
Alex soto



On May 10, 2018, at 3:25 PM, Jean-Baptiste Onofré <[hidden email]> wrote:

Karaf provides both jpa 1.x and  2.x feature.

You just have to  install the right one depending of the engine you are using:

feature:install jpa/1.x
feature:install  openjpa

Regards
JB

On 05/10/2018 09:23 PM, Alex Soto wrote:
Thanks JB,

I was hoping to use whatever was defined in the Karaf’s enterprise feature, but if that doesn’t work ,then which version do I need?  I am afraid if I deviate from the versions selected by Kara’s Enterprise feature I will get into more version mismatch problems.   Also what do I put in my POM for javax.persistence dependency?


Best regards,
Alex soto



On May 10, 2018, at 3:16 PM, Jean-Baptiste Onofré <[hidden email]> wrote:

Hi,

OpenJPA 2.x still uses JPA 1.x. By default, jpa feature will provide 2.x version.

You should specify the jpa feature version.

Regards
JB

On 05/10/2018 09:08 PM, Alex Soto wrote:
Hello,

I am running Karaf 4.2.0, trying to setup a project with OpenJPA.  I am getting
error:


14:44:07.799 ERROR [FelixDispatchQueue] FrameworkEvent ERROR
- org.apache.aries.jpa.container
java.lang.ClassCastException: org.apache.openjpa.persistence.PersistenceProviderImpl
cannot be cast to javax.persistence.spi.PersistenceProvider
at org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:84)
~[?:?]
at org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:44)
~[?:?]
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.apache.aries.jpa.container.impl.PersistenceBundleTracker.trackProvider(PersistenceBundleTracker.java:103)
~[?:?]
at org.apache.aries.jpa.container.impl.PersistenceBundleTracker.findPersistenceUnits(PersistenceBundleTracker.java:87)
~[?:?]
at org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:66)
~[?:?]
at org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:39)
~[?:?]
at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:469)
~[?:?]
at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:415)
~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
~[?:?]
at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229) ~[?:?]
at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444)
~[?:?]
at org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915)
~[?:?]
at org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
~[?:?]
at org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516)
~[?:?]
at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579) ~[?:?]
at org.apache.felix.framework.Felix.startBundle(Felix.java:2174) ~[?:?]
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1373) ~[?:?]
at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
~[?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]



This looks like version mismatch.  I am loading the following packages in my
feature:

<feature>aries-blueprint</feature>
<feature>war</feature>
<feature>camel-core</feature>
<feature>camel-servlet</feature>
<feature>camel-blueprint</feature>
<feature>camel-jackson</feature>
<feature>jndi</feature>
<feature>jdbc</feature>
<feature>transaction</feature>
<feature>jpa</feature>
<feature>openjpa</feature>
<feature>pax-jdbc-mariadb</feature>
       <feature>pax-jdbc-config</feature>


One thing I don’t know if is correct is the javax.persistence dependency in my POM:

<dependency>
           <groupId>org.eclipse.persistence</groupId>
           <artifactId>javax.persistence</artifactId>
           <version>2.0.5</version>
           <scope>provided</scope>
       </dependency>

Any hints?

Best regards,
Alex soto




--
Jean-Baptiste Onofré
[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: OpenJPA with AriesJPA Java.peristence

jbonofre
You have to register the enterprise-legacy features repository.

Regards
JB

On 05/10/2018 09:36 PM, Alex Soto wrote:

> I am sorry I only see one version:
>
> karaf@root()> feature:list | grep jpa
> openjpa                                  │ 2.4.2            │          │
> Started     │ enterprise-4.2.0                  │ Apache OpenJPA 2.4.x
> persistence engine support
> camel-jpa                                │ 2.21.1           │       
>   │ Uninstalled │ camel-2.21.1                      │
> deltaspike-jpa                           │ 1.4.2            │       
>   │ Uninstalled │ org.ops4j.pax.cdi-1.0.0.RC2       │ Apache Deltaspike jpa support
> deltaspike-jpa                           │ 1.8.1            │       
>   │ Uninstalled │ org.ops4j.pax.cdi-1.0.0           │ Apache Deltaspike jpa support
> jpa                                      │ 2.6.1            │          │
> Started     │ aries-jpa-2.6.1                   │ OSGi Persistence Container
>
>
>
> Is there a repository I need to add?  
>
> Best regards,
> Alex soto
>
>
>
>> On May 10, 2018, at 3:25 PM, Jean-Baptiste Onofré <[hidden email]
>> <mailto:[hidden email]>> wrote:
>>
>> Karaf provides both jpa 1.x and  2.x feature.
>>
>> You just have to  install the right one depending of the engine you are using:
>>
>> feature:install jpa/1.x
>> feature:install  openjpa
>>
>> Regards
>> JB
>>
>> On 05/10/2018 09:23 PM, Alex Soto wrote:
>>> Thanks JB,
>>>
>>> I was hoping to use whatever was defined in the Karaf’s enterprise feature,
>>> but if that doesn’t work ,then which version do I need?  I am afraid if I
>>> deviate from the versions selected by Kara’s Enterprise feature I will get
>>> into more version mismatch problems.   Also what do I put in my POM for
>>> javax.persistence dependency?
>>>
>>>
>>> Best regards,
>>> Alex soto
>>>
>>>
>>>
>>>> On May 10, 2018, at 3:16 PM, Jean-Baptiste Onofré <[hidden email]
>>>> <mailto:[hidden email]>> wrote:
>>>>
>>>> Hi,
>>>>
>>>> OpenJPA 2.x still uses JPA 1.x. By default, jpa feature will provide 2.x
>>>> version.
>>>>
>>>> You should specify the jpa feature version.
>>>>
>>>> Regards
>>>> JB
>>>>
>>>> On 05/10/2018 09:08 PM, Alex Soto wrote:
>>>>> Hello,
>>>>>
>>>>> I am running Karaf 4.2.0, trying to setup a project with OpenJPA.  I am getting
>>>>> error:
>>>>>
>>>>>
>>>>> 14:44:07.799 ERROR [FelixDispatchQueue] FrameworkEvent ERROR
>>>>> - org.apache.aries.jpa.container
>>>>> java.lang.ClassCastException:
>>>>> org.apache.openjpa.persistence.PersistenceProviderImpl
>>>>> cannot be cast to javax.persistence.spi.PersistenceProvider
>>>>> at
>>>>> org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:84)
>>>>> ~[?:?]
>>>>> at
>>>>> org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:44)
>>>>> ~[?:?]
>>>>> 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.apache.aries.jpa.container.impl.PersistenceBundleTracker.trackProvider(PersistenceBundleTracker.java:103)
>>>>> ~[?:?]
>>>>> at
>>>>> org.apache.aries.jpa.container.impl.PersistenceBundleTracker.findPersistenceUnits(PersistenceBundleTracker.java:87)
>>>>> ~[?:?]
>>>>> at
>>>>> org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:66)
>>>>> ~[?:?]
>>>>> at
>>>>> org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:39)
>>>>> ~[?:?]
>>>>> at
>>>>> org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:469)
>>>>> ~[?:?]
>>>>> at
>>>>> org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:415)
>>>>> ~[?:?]
>>>>> at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
>>>>> ~[?:?]
>>>>> at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229) ~[?:?]
>>>>> at
>>>>> org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444)
>>>>> ~[?:?]
>>>>> at
>>>>> org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915)
>>>>> ~[?:?]
>>>>> at
>>>>> org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
>>>>> ~[?:?]
>>>>> at
>>>>> org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516)
>>>>> ~[?:?]
>>>>> at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579) ~[?:?]
>>>>> at org.apache.felix.framework.Felix.startBundle(Felix.java:2174) ~[?:?]
>>>>> at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1373) ~[?:?]
>>>>> at
>>>>> org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
>>>>> ~[?:?]
>>>>> at java.lang.Thread.run(Thread.java:748) [?:?]
>>>>>
>>>>>
>>>>>
>>>>> This looks like version mismatch.  I am loading the following packages in my
>>>>> feature:
>>>>>
>>>>> <feature>aries-blueprint</feature>
>>>>> <feature>war</feature>
>>>>> <feature>camel-core</feature>
>>>>> <feature>camel-servlet</feature>
>>>>> <feature>camel-blueprint</feature>
>>>>> <feature>camel-jackson</feature>
>>>>> <feature>jndi</feature>
>>>>> <feature>jdbc</feature>
>>>>> <feature>transaction</feature>
>>>>> <feature>jpa</feature>
>>>>> <feature>openjpa</feature>
>>>>> <feature>pax-jdbc-mariadb</feature>
>>>>>        <feature>pax-jdbc-config</feature>
>>>>>
>>>>>
>>>>> One thing I don’t know if is correct is the javax.persistence dependency in
>>>>> my POM:
>>>>>
>>>>> <dependency>
>>>>>            <groupId>org.eclipse.persistence</groupId>
>>>>>            <artifactId>javax.persistence</artifactId>
>>>>>            <version>2.0.5</version>
>>>>>            <scope>provided</scope>
>>>>>        </dependency>
>>>>>
>>>>> Any hints?
>>>>>
>>>>> Best regards,
>>>>> Alex soto
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> Jean-Baptiste Onofré
>>>> [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: OpenJPA with AriesJPA Java.peristence

jbonofre
In reply to this post by Alex Soto
Anyway, let me check if OpenJPA 2.4.2 supports JPA 2.1 (it's what I thought).

Regards
JB

On 05/10/2018 09:36 PM, Alex Soto wrote:

> I am sorry I only see one version:
>
> karaf@root()> feature:list | grep jpa
> openjpa                                  │ 2.4.2            │          │
> Started     │ enterprise-4.2.0                  │ Apache OpenJPA 2.4.x
> persistence engine support
> camel-jpa                                │ 2.21.1           │       
>   │ Uninstalled │ camel-2.21.1                      │
> deltaspike-jpa                           │ 1.4.2            │       
>   │ Uninstalled │ org.ops4j.pax.cdi-1.0.0.RC2       │ Apache Deltaspike jpa support
> deltaspike-jpa                           │ 1.8.1            │       
>   │ Uninstalled │ org.ops4j.pax.cdi-1.0.0           │ Apache Deltaspike jpa support
> jpa                                      │ 2.6.1            │          │
> Started     │ aries-jpa-2.6.1                   │ OSGi Persistence Container
>
>
>
> Is there a repository I need to add?  
>
> Best regards,
> Alex soto
>
>
>
>> On May 10, 2018, at 3:25 PM, Jean-Baptiste Onofré <[hidden email]
>> <mailto:[hidden email]>> wrote:
>>
>> Karaf provides both jpa 1.x and  2.x feature.
>>
>> You just have to  install the right one depending of the engine you are using:
>>
>> feature:install jpa/1.x
>> feature:install  openjpa
>>
>> Regards
>> JB
>>
>> On 05/10/2018 09:23 PM, Alex Soto wrote:
>>> Thanks JB,
>>>
>>> I was hoping to use whatever was defined in the Karaf’s enterprise feature,
>>> but if that doesn’t work ,then which version do I need?  I am afraid if I
>>> deviate from the versions selected by Kara’s Enterprise feature I will get
>>> into more version mismatch problems.   Also what do I put in my POM for
>>> javax.persistence dependency?
>>>
>>>
>>> Best regards,
>>> Alex soto
>>>
>>>
>>>
>>>> On May 10, 2018, at 3:16 PM, Jean-Baptiste Onofré <[hidden email]
>>>> <mailto:[hidden email]>> wrote:
>>>>
>>>> Hi,
>>>>
>>>> OpenJPA 2.x still uses JPA 1.x. By default, jpa feature will provide 2.x
>>>> version.
>>>>
>>>> You should specify the jpa feature version.
>>>>
>>>> Regards
>>>> JB
>>>>
>>>> On 05/10/2018 09:08 PM, Alex Soto wrote:
>>>>> Hello,
>>>>>
>>>>> I am running Karaf 4.2.0, trying to setup a project with OpenJPA.  I am getting
>>>>> error:
>>>>>
>>>>>
>>>>> 14:44:07.799 ERROR [FelixDispatchQueue] FrameworkEvent ERROR
>>>>> - org.apache.aries.jpa.container
>>>>> java.lang.ClassCastException:
>>>>> org.apache.openjpa.persistence.PersistenceProviderImpl
>>>>> cannot be cast to javax.persistence.spi.PersistenceProvider
>>>>> at
>>>>> org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:84)
>>>>> ~[?:?]
>>>>> at
>>>>> org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:44)
>>>>> ~[?:?]
>>>>> 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.apache.aries.jpa.container.impl.PersistenceBundleTracker.trackProvider(PersistenceBundleTracker.java:103)
>>>>> ~[?:?]
>>>>> at
>>>>> org.apache.aries.jpa.container.impl.PersistenceBundleTracker.findPersistenceUnits(PersistenceBundleTracker.java:87)
>>>>> ~[?:?]
>>>>> at
>>>>> org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:66)
>>>>> ~[?:?]
>>>>> at
>>>>> org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:39)
>>>>> ~[?:?]
>>>>> at
>>>>> org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:469)
>>>>> ~[?:?]
>>>>> at
>>>>> org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:415)
>>>>> ~[?:?]
>>>>> at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
>>>>> ~[?:?]
>>>>> at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229) ~[?:?]
>>>>> at
>>>>> org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444)
>>>>> ~[?:?]
>>>>> at
>>>>> org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915)
>>>>> ~[?:?]
>>>>> at
>>>>> org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
>>>>> ~[?:?]
>>>>> at
>>>>> org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516)
>>>>> ~[?:?]
>>>>> at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579) ~[?:?]
>>>>> at org.apache.felix.framework.Felix.startBundle(Felix.java:2174) ~[?:?]
>>>>> at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1373) ~[?:?]
>>>>> at
>>>>> org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
>>>>> ~[?:?]
>>>>> at java.lang.Thread.run(Thread.java:748) [?:?]
>>>>>
>>>>>
>>>>>
>>>>> This looks like version mismatch.  I am loading the following packages in my
>>>>> feature:
>>>>>
>>>>> <feature>aries-blueprint</feature>
>>>>> <feature>war</feature>
>>>>> <feature>camel-core</feature>
>>>>> <feature>camel-servlet</feature>
>>>>> <feature>camel-blueprint</feature>
>>>>> <feature>camel-jackson</feature>
>>>>> <feature>jndi</feature>
>>>>> <feature>jdbc</feature>
>>>>> <feature>transaction</feature>
>>>>> <feature>jpa</feature>
>>>>> <feature>openjpa</feature>
>>>>> <feature>pax-jdbc-mariadb</feature>
>>>>>        <feature>pax-jdbc-config</feature>
>>>>>
>>>>>
>>>>> One thing I don’t know if is correct is the javax.persistence dependency in
>>>>> my POM:
>>>>>
>>>>> <dependency>
>>>>>            <groupId>org.eclipse.persistence</groupId>
>>>>>            <artifactId>javax.persistence</artifactId>
>>>>>            <version>2.0.5</version>
>>>>>            <scope>provided</scope>
>>>>>        </dependency>
>>>>>
>>>>> Any hints?
>>>>>
>>>>> Best regards,
>>>>> Alex soto
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> Jean-Baptiste Onofré
>>>> [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: OpenJPA with AriesJPA Java.peristence

Tim Ward-2
OpenJPA 2.4.x supports JPA 2.0 (not 2.1) you can get the API you need from Apache Aries, as well as the JPA container. This is also all used and tested with Aries Transaction Control, so you can look at the bundles used there.

Best Regards,

Tim

Sent from my iPhone

> On 10 May 2018, at 20:43, Jean-Baptiste Onofré <[hidden email]> wrote:
>
> Anyway, let me check if OpenJPA 2.4.2 supports JPA 2.1 (it's what I thought).
>
> Regards
> JB
>
>> On 05/10/2018 09:36 PM, Alex Soto wrote:
>> I am sorry I only see one version:
>>
>> karaf@root()> feature:list | grep jpa
>> openjpa                                  │ 2.4.2            │          │
>> Started     │ enterprise-4.2.0                  │ Apache OpenJPA 2.4.x
>> persistence engine support
>> camel-jpa                                │ 2.21.1           │      
>>   │ Uninstalled │ camel-2.21.1                      │
>> deltaspike-jpa                           │ 1.4.2            │      
>>   │ Uninstalled │ org.ops4j.pax.cdi-1.0.0.RC2       │ Apache Deltaspike jpa support
>> deltaspike-jpa                           │ 1.8.1            │      
>>   │ Uninstalled │ org.ops4j.pax.cdi-1.0.0           │ Apache Deltaspike jpa support
>> jpa                                      │ 2.6.1            │          │
>> Started     │ aries-jpa-2.6.1                   │ OSGi Persistence Container
>>
>>
>>
>> Is there a repository I need to add?  
>>
>> Best regards,
>> Alex soto
>>
>>
>>
>>> On May 10, 2018, at 3:25 PM, Jean-Baptiste Onofré <[hidden email]
>>> <mailto:[hidden email]>> wrote:
>>>
>>> Karaf provides both jpa 1.x and  2.x feature.
>>>
>>> You just have to  install the right one depending of the engine you are using:
>>>
>>> feature:install jpa/1.x
>>> feature:install  openjpa
>>>
>>> Regards
>>> JB
>>>
>>>> On 05/10/2018 09:23 PM, Alex Soto wrote:
>>>> Thanks JB,
>>>>
>>>> I was hoping to use whatever was defined in the Karaf’s enterprise feature,
>>>> but if that doesn’t work ,then which version do I need?  I am afraid if I
>>>> deviate from the versions selected by Kara’s Enterprise feature I will get
>>>> into more version mismatch problems.   Also what do I put in my POM for
>>>> javax.persistence dependency?
>>>>
>>>>
>>>> Best regards,
>>>> Alex soto
>>>>
>>>>
>>>>
>>>>> On May 10, 2018, at 3:16 PM, Jean-Baptiste Onofré <[hidden email]
>>>>> <mailto:[hidden email]>> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> OpenJPA 2.x still uses JPA 1.x. By default, jpa feature will provide 2.x
>>>>> version.
>>>>>
>>>>> You should specify the jpa feature version.
>>>>>
>>>>> Regards
>>>>> JB
>>>>>
>>>>>> On 05/10/2018 09:08 PM, Alex Soto wrote:
>>>>>> Hello,
>>>>>>
>>>>>> I am running Karaf 4.2.0, trying to setup a project with OpenJPA.  I am getting
>>>>>> error:
>>>>>>
>>>>>>
>>>>>> 14:44:07.799 ERROR [FelixDispatchQueue] FrameworkEvent ERROR
>>>>>> - org.apache.aries.jpa.container
>>>>>> java.lang.ClassCastException:
>>>>>> org.apache.openjpa.persistence.PersistenceProviderImpl
>>>>>> cannot be cast to javax.persistence.spi.PersistenceProvider
>>>>>> at
>>>>>> org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:84)
>>>>>> ~[?:?]
>>>>>> at
>>>>>> org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:44)
>>>>>> ~[?:?]
>>>>>> 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.apache.aries.jpa.container.impl.PersistenceBundleTracker.trackProvider(PersistenceBundleTracker.java:103)
>>>>>> ~[?:?]
>>>>>> at
>>>>>> org.apache.aries.jpa.container.impl.PersistenceBundleTracker.findPersistenceUnits(PersistenceBundleTracker.java:87)
>>>>>> ~[?:?]
>>>>>> at
>>>>>> org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:66)
>>>>>> ~[?:?]
>>>>>> at
>>>>>> org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:39)
>>>>>> ~[?:?]
>>>>>> at
>>>>>> org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:469)
>>>>>> ~[?:?]
>>>>>> at
>>>>>> org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:415)
>>>>>> ~[?:?]
>>>>>> at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
>>>>>> ~[?:?]
>>>>>> at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229) ~[?:?]
>>>>>> at
>>>>>> org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444)
>>>>>> ~[?:?]
>>>>>> at
>>>>>> org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915)
>>>>>> ~[?:?]
>>>>>> at
>>>>>> org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
>>>>>> ~[?:?]
>>>>>> at
>>>>>> org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516)
>>>>>> ~[?:?]
>>>>>> at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579) ~[?:?]
>>>>>> at org.apache.felix.framework.Felix.startBundle(Felix.java:2174) ~[?:?]
>>>>>> at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1373) ~[?:?]
>>>>>> at
>>>>>> org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
>>>>>> ~[?:?]
>>>>>> at java.lang.Thread.run(Thread.java:748) [?:?]
>>>>>>
>>>>>>
>>>>>>
>>>>>> This looks like version mismatch.  I am loading the following packages in my
>>>>>> feature:
>>>>>>
>>>>>> <feature>aries-blueprint</feature>
>>>>>> <feature>war</feature>
>>>>>> <feature>camel-core</feature>
>>>>>> <feature>camel-servlet</feature>
>>>>>> <feature>camel-blueprint</feature>
>>>>>> <feature>camel-jackson</feature>
>>>>>> <feature>jndi</feature>
>>>>>> <feature>jdbc</feature>
>>>>>> <feature>transaction</feature>
>>>>>> <feature>jpa</feature>
>>>>>> <feature>openjpa</feature>
>>>>>> <feature>pax-jdbc-mariadb</feature>
>>>>>>        <feature>pax-jdbc-config</feature>
>>>>>>
>>>>>>
>>>>>> One thing I don’t know if is correct is the javax.persistence dependency in
>>>>>> my POM:
>>>>>>
>>>>>> <dependency>
>>>>>>            <groupId>org.eclipse.persistence</groupId>
>>>>>>            <artifactId>javax.persistence</artifactId>
>>>>>>            <version>2.0.5</version>
>>>>>>            <scope>provided</scope>
>>>>>>        </dependency>
>>>>>>
>>>>>> Any hints?
>>>>>>
>>>>>> Best regards,
>>>>>> Alex soto
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> Jean-Baptiste Onofré
>>>>> [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: OpenJPA with AriesJPA Java.peristence

Alex Soto
I had accidentally replied directly to Tim.  Repeating here:

Let me see if I understand this correctly:

Karaf version 4.2.0 enterprise repository depends on version 2.6.1 of AriesJPA.
AriesJPA version 2.6.1 depends on  javax.persistence version 2.1.0.
Karaf’s enterprise repository defines a openjpa feature that depends on OpenJPA version 2.4.2.
OpenJPA version 2.4.2 depends on javax.persistence version 2.0.0.
 
Is this correct?
Is there is a bug in the Enterprise repository mixing incompatible versions of OpenJPA and AriesJPA?
Is the problem in OpenJPA not declaring the version it depends on?

Inspecting in Karaf’s console:

karaf@root()> list

 97 │ Active  │  80 │ 2.4.2               │ OpenJPA Aggregate Ja

karaf@root()> bundle:requirements 97

osgi.wiring.package; (&(osgi.wiring.package=javax.persistence)(version>=1.1.0)(!(version>=2.1.0))) resolved by:
   osgi.wiring.package; javax.persistence 2.0.0 from org.apache.geronimo.specs.geronimo-jpa_2.0_spec [66]


karaf@root()> feature:info jpa
Feature jpa 2.6.1
Description:
  OSGi Persistence Container
Details:
  JPA implementation provided by Apache Aries JPA 2.x. NB: this feature doesn't provide the JPA engine, you have to install one by yourself (OpenJPA for instance)
Feature has no configuration
Feature has no configuration files
Feature has no dependencies.
Feature contains followed bundles:
  mvn:org.eclipse.persistence/javax.persistence/2.1.0
  mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1
  mvn:org.osgi/org.osgi.service.jdbc/1.0.0
  mvn:org.apache.felix/org.apache.felix.coordinator/1.0.2 start-level=30
  mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/2.6.1 start-level=30
  mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/2.6.1 start-level=30
  mvn:org.apache.aries.jpa/org.apache.aries.jpa.support/2.6.1 start-level=30

Best regards,
Alex soto




On May 10, 2018, at 5:45 PM, Tim Ward <[hidden email]> wrote:

OpenJPA 2.4.x supports JPA 2.0 (not 2.1) you can get the API you need from Apache Aries, as well as the JPA container. This is also all used and tested with Aries Transaction Control, so you can look at the bundles used there.

Best Regards,

Tim

Sent from my iPhone

On 10 May 2018, at 20:43, Jean-Baptiste Onofré <[hidden email]> wrote:

Anyway, let me check if OpenJPA 2.4.2 supports JPA 2.1 (it's what I thought).

Regards
JB

On 05/10/2018 09:36 PM, Alex Soto wrote:
I am sorry I only see one version:

karaf@root()> feature:list | grep jpa
openjpa                                  │ 2.4.2            │          │
Started     │ enterprise-4.2.0                  │ Apache OpenJPA 2.4.x
persistence engine support
camel-jpa                                │ 2.21.1           │       
 │ Uninstalled │ camel-2.21.1                      │
deltaspike-jpa                           │ 1.4.2            │       
 │ Uninstalled │ org.ops4j.pax.cdi-1.0.0.RC2       │ Apache Deltaspike jpa support
deltaspike-jpa                           │ 1.8.1            │       
 │ Uninstalled │ org.ops4j.pax.cdi-1.0.0           │ Apache Deltaspike jpa support
jpa                                      │ 2.6.1            │          │
Started     │ aries-jpa-2.6.1                   │ OSGi Persistence Container



Is there a repository I need to add?  

Best regards,
Alex soto



On May 10, 2018, at 3:25 PM, Jean-Baptiste Onofré <[hidden email]
<[hidden email]>> wrote:

Karaf provides both jpa 1.x and  2.x feature.

You just have to  install the right one depending of the engine you are using:

feature:install jpa/1.x
feature:install  openjpa

Regards
JB

On 05/10/2018 09:23 PM, Alex Soto wrote:
Thanks JB,

I was hoping to use whatever was defined in the Karaf’s enterprise feature,
but if that doesn’t work ,then which version do I need?  I am afraid if I
deviate from the versions selected by Kara’s Enterprise feature I will get
into more version mismatch problems.   Also what do I put in my POM for
javax.persistence dependency?


Best regards,
Alex soto



On May 10, 2018, at 3:16 PM, Jean-Baptiste Onofré <[hidden email]
<[hidden email]>> wrote:

Hi,

OpenJPA 2.x still uses JPA 1.x. By default, jpa feature will provide 2.x
version.

You should specify the jpa feature version.

Regards
JB

On 05/10/2018 09:08 PM, Alex Soto wrote:
Hello,

I am running Karaf 4.2.0, trying to setup a project with OpenJPA.  I am getting
error:


14:44:07.799 ERROR [FelixDispatchQueue] FrameworkEvent ERROR
- org.apache.aries.jpa.container
java.lang.ClassCastException:
org.apache.openjpa.persistence.PersistenceProviderImpl
cannot be cast to javax.persistence.spi.PersistenceProvider
at
org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:84)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:44)
~[?:?]
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.apache.aries.jpa.container.impl.PersistenceBundleTracker.trackProvider(PersistenceBundleTracker.java:103)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTracker.findPersistenceUnits(PersistenceBundleTracker.java:87)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:66)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:39)
~[?:?]
at
org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:469)
~[?:?]
at
org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:415)
~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
~[?:?]
at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229) ~[?:?]
at
org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444)
~[?:?]
at
org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915)
~[?:?]
at
org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
~[?:?]
at
org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516)
~[?:?]
at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579) ~[?:?]
at org.apache.felix.framework.Felix.startBundle(Felix.java:2174) ~[?:?]
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1373) ~[?:?]
at
org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
~[?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]



This looks like version mismatch.  I am loading the following packages in my
feature:

<feature>aries-blueprint</feature>
<feature>war</feature>
<feature>camel-core</feature>
<feature>camel-servlet</feature>
<feature>camel-blueprint</feature>
<feature>camel-jackson</feature>
<feature>jndi</feature>
<feature>jdbc</feature>
<feature>transaction</feature>
<feature>jpa</feature>
<feature>openjpa</feature>
<feature>pax-jdbc-mariadb</feature>
      <feature>pax-jdbc-config</feature>


One thing I don’t know if is correct is the javax.persistence dependency in
my POM:

<dependency>
          <groupId>org.eclipse.persistence</groupId>
          <artifactId>javax.persistence</artifactId>
          <version>2.0.5</version>
          <scope>provided</scope>
      </dependency>

Any hints?

Best regards,
Alex soto




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


--
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: OpenJPA with AriesJPA Java.peristence

Tim Ward-2
Aries JPA can work with either JPA 2.0, or JPA 2.1, and is tested with EclipseLink, Hibernate and OpenJPA. 

It is highly recommended that you use the JavaJPA contract in any of your bundles using JPA so that you are isolated from the API version number changes in the future (most Java EE specifications make major version bumps quite regularly).

The real problem is that the AriesJPA feature shouldn’t exist as a standalone thing (it doesn’t make sense to deploy it on its own). It should come for free when you install the OpenJPA (or Hibernate, or EclipseLink) feature, using whichever API they have deployed.

Tim


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

I had accidentally replied directly to Tim.  Repeating here:

Let me see if I understand this correctly:

Karaf version 4.2.0 enterprise repository depends on version 2.6.1 of AriesJPA.
AriesJPA version 2.6.1 depends on  javax.persistence version 2.1.0.
Karaf’s enterprise repository defines a openjpa feature that depends on OpenJPA version 2.4.2.
OpenJPA version 2.4.2 depends on javax.persistence version 2.0.0.
 
Is this correct?
Is there is a bug in the Enterprise repository mixing incompatible versions of OpenJPA and AriesJPA?
Is the problem in OpenJPA not declaring the version it depends on?

Inspecting in Karaf’s console:

karaf@root()> list

 97 │ Active  │  80 │ 2.4.2               │ OpenJPA Aggregate Ja

karaf@root()> bundle:requirements 97

osgi.wiring.package; (&(osgi.wiring.package=javax.persistence)(version>=1.1.0)(!(version>=2.1.0))) resolved by:
   osgi.wiring.package; javax.persistence 2.0.0 from org.apache.geronimo.specs.geronimo-jpa_2.0_spec [66]


karaf@root()> feature:info jpa
Feature jpa 2.6.1
Description:
  OSGi Persistence Container
Details:
  JPA implementation provided by Apache Aries JPA 2.x. NB: this feature doesn't provide the JPA engine, you have to install one by yourself (OpenJPA for instance)
Feature has no configuration
Feature has no configuration files
Feature has no dependencies.
Feature contains followed bundles:
  mvn:org.eclipse.persistence/javax.persistence/2.1.0
  mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1
  mvn:org.osgi/org.osgi.service.jdbc/1.0.0
  mvn:org.apache.felix/org.apache.felix.coordinator/1.0.2 start-level=30
  mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/2.6.1 start-level=30
  mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/2.6.1 start-level=30
  mvn:org.apache.aries.jpa/org.apache.aries.jpa.support/2.6.1 start-level=30

Best regards,
Alex soto




On May 10, 2018, at 5:45 PM, Tim Ward <[hidden email]> wrote:

OpenJPA 2.4.x supports JPA 2.0 (not 2.1) you can get the API you need from Apache Aries, as well as the JPA container. This is also all used and tested with Aries Transaction Control, so you can look at the bundles used there.

Best Regards,

Tim

Sent from my iPhone

On 10 May 2018, at 20:43, Jean-Baptiste Onofré <[hidden email]> wrote:

Anyway, let me check if OpenJPA 2.4.2 supports JPA 2.1 (it's what I thought).

Regards
JB

On 05/10/2018 09:36 PM, Alex Soto wrote:
I am sorry I only see one version:

karaf@root()> feature:list | grep jpa
openjpa                                  │ 2.4.2            │          │
Started     │ enterprise-4.2.0                  │ Apache OpenJPA 2.4.x
persistence engine support
camel-jpa                                │ 2.21.1           │       
 │ Uninstalled │ camel-2.21.1                      │
deltaspike-jpa                           │ 1.4.2            │       
 │ Uninstalled │ org.ops4j.pax.cdi-1.0.0.RC2       │ Apache Deltaspike jpa support
deltaspike-jpa                           │ 1.8.1            │       
 │ Uninstalled │ org.ops4j.pax.cdi-1.0.0           │ Apache Deltaspike jpa support
jpa                                      │ 2.6.1            │          │
Started     │ aries-jpa-2.6.1                   │ OSGi Persistence Container



Is there a repository I need to add?  

Best regards,
Alex soto



On May 10, 2018, at 3:25 PM, Jean-Baptiste Onofré <[hidden email]
<[hidden email]>> wrote:

Karaf provides both jpa 1.x and  2.x feature.

You just have to  install the right one depending of the engine you are using:

feature:install jpa/1.x
feature:install  openjpa

Regards
JB

On 05/10/2018 09:23 PM, Alex Soto wrote:
Thanks JB,

I was hoping to use whatever was defined in the Karaf’s enterprise feature,
but if that doesn’t work ,then which version do I need?  I am afraid if I
deviate from the versions selected by Kara’s Enterprise feature I will get
into more version mismatch problems.   Also what do I put in my POM for
javax.persistence dependency?


Best regards,
Alex soto



On May 10, 2018, at 3:16 PM, Jean-Baptiste Onofré <[hidden email]
<[hidden email]>> wrote:

Hi,

OpenJPA 2.x still uses JPA 1.x. By default, jpa feature will provide 2.x
version.

You should specify the jpa feature version.

Regards
JB

On 05/10/2018 09:08 PM, Alex Soto wrote:
Hello,

I am running Karaf 4.2.0, trying to setup a project with OpenJPA.  I am getting
error:


14:44:07.799 ERROR [FelixDispatchQueue] FrameworkEvent ERROR
- org.apache.aries.jpa.container
java.lang.ClassCastException:
org.apache.openjpa.persistence.PersistenceProviderImpl
cannot be cast to javax.persistence.spi.PersistenceProvider
at
org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:84)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:44)
~[?:?]
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.apache.aries.jpa.container.impl.PersistenceBundleTracker.trackProvider(PersistenceBundleTracker.java:103)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTracker.findPersistenceUnits(PersistenceBundleTracker.java:87)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:66)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:39)
~[?:?]
at
org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:469)
~[?:?]
at
org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:415)
~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
~[?:?]
at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229) ~[?:?]
at
org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444)
~[?:?]
at
org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915)
~[?:?]
at
org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
~[?:?]
at
org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516)
~[?:?]
at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579) ~[?:?]
at org.apache.felix.framework.Felix.startBundle(Felix.java:2174) ~[?:?]
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1373) ~[?:?]
at
org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
~[?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]



This looks like version mismatch.  I am loading the following packages in my
feature:

<feature>aries-blueprint</feature>
<feature>war</feature>
<feature>camel-core</feature>
<feature>camel-servlet</feature>
<feature>camel-blueprint</feature>
<feature>camel-jackson</feature>
<feature>jndi</feature>
<feature>jdbc</feature>
<feature>transaction</feature>
<feature>jpa</feature>
<feature>openjpa</feature>
<feature>pax-jdbc-mariadb</feature>
      <feature>pax-jdbc-config</feature>


One thing I don’t know if is correct is the javax.persistence dependency in
my POM:

<dependency>
          <groupId>org.eclipse.persistence</groupId>
          <artifactId>javax.persistence</artifactId>
          <version>2.0.5</version>
          <scope>provided</scope>
      </dependency>

Any hints?

Best regards,
Alex soto




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


--
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: OpenJPA with AriesJPA Java.peristence

Alex Soto
Thanks for the help Tim.

On May 11, 2018, at 10:24 AM, Tim Ward <[hidden email]> wrote:

Aries JPA can work with either JPA 2.0, or JPA 2.1, and is tested with EclipseLink, Hibernate and OpenJPA. 

I am looking at these integration tests, but the test itself does not uses the feature, as defined in the feature.xml file.  It loads a different version of javax.persistence for the OpenJPA integration test. So unless you are an AriesJPA developer, you would not know about this.  How would anybody figure this out? 

@Configuration
    public Option[] configuration() {
        return new Option[] {
            baseOptions(), //
            ariesJpa20(), //
            jta11Bundles(), // Openjpa currently does not work with jta 1.2. See https://issues.apache.org/jira/browse/OPENJPA-2607
            openJpa(), //
            derbyDSF(), //
            testBundle()
        };

Then the example does not use OpenJPA, but Hibernate, so there is no information on how to make it work with OpenJPA out of the box.  
One option here would be to have multiple specific features: jpa-hibernate, jpa-openjpa, etc.


It is highly recommended that you use the JavaJPA contract in any of your bundles using JPA so that you are isolated from the API version number changes in the future (most Java EE specifications make major version bumps quite regularly).


I have this in my bundle’s osgi.bnd file:

-contract: JavaJPA

Is that all that is needed?  It does not indicate version.

The real problem is that the AriesJPA feature shouldn’t exist as a standalone thing (it doesn’t make sense to deploy it on its own). It should come for free when you install the OpenJPA (or Hibernate, or EclipseLink) feature, using whichever API they have deployed.

Exactly, this is harder than it should be.  When I install a feature, I expect the feature to bring in all that is needed, not having to chase down all these dependencies.
Is there an intention to take this approach any time soon?





Tim


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

I had accidentally replied directly to Tim.  Repeating here:

Let me see if I understand this correctly:

Karaf version 4.2.0 enterprise repository depends on version 2.6.1 of AriesJPA.
AriesJPA version 2.6.1 depends on  javax.persistence version 2.1.0.
Karaf’s enterprise repository defines a openjpa feature that depends on OpenJPA version 2.4.2.
OpenJPA version 2.4.2 depends on javax.persistence version 2.0.0.
 
Is this correct?
Is there is a bug in the Enterprise repository mixing incompatible versions of OpenJPA and AriesJPA?
Is the problem in OpenJPA not declaring the version it depends on?

Inspecting in Karaf’s console:

karaf@root()> list

 97 │ Active  │  80 │ 2.4.2               │ OpenJPA Aggregate Ja

karaf@root()> bundle:requirements 97

osgi.wiring.package; (&(osgi.wiring.package=javax.persistence)(version>=1.1.0)(!(version>=2.1.0))) resolved by:
   osgi.wiring.package; javax.persistence 2.0.0 from org.apache.geronimo.specs.geronimo-jpa_2.0_spec [66]


karaf@root()> feature:info jpa
Feature jpa 2.6.1
Description:
  OSGi Persistence Container
Details:
  JPA implementation provided by Apache Aries JPA 2.x. NB: this feature doesn't provide the JPA engine, you have to install one by yourself (OpenJPA for instance)
Feature has no configuration
Feature has no configuration files
Feature has no dependencies.
Feature contains followed bundles:
  mvn:org.eclipse.persistence/javax.persistence/2.1.0
  mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1
  mvn:org.osgi/org.osgi.service.jdbc/1.0.0
  mvn:org.apache.felix/org.apache.felix.coordinator/1.0.2 start-level=30
  mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/2.6.1 start-level=30
  mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/2.6.1 start-level=30
  mvn:org.apache.aries.jpa/org.apache.aries.jpa.support/2.6.1 start-level=30

Best regards,
Alex soto




On May 10, 2018, at 5:45 PM, Tim Ward <[hidden email]> wrote:

OpenJPA 2.4.x supports JPA 2.0 (not 2.1) you can get the API you need from Apache Aries, as well as the JPA container. This is also all used and tested with Aries Transaction Control, so you can look at the bundles used there.

Best Regards,

Tim

Sent from my iPhone

On 10 May 2018, at 20:43, Jean-Baptiste Onofré <[hidden email]> wrote:

Anyway, let me check if OpenJPA 2.4.2 supports JPA 2.1 (it's what I thought).

Regards
JB

On 05/10/2018 09:36 PM, Alex Soto wrote:
I am sorry I only see one version:

karaf@root()> feature:list | grep jpa
openjpa                                  │ 2.4.2            │          │
Started     │ enterprise-4.2.0                  │ Apache OpenJPA 2.4.x
persistence engine support
camel-jpa                                │ 2.21.1           │       
 │ Uninstalled │ camel-2.21.1                      │
deltaspike-jpa                           │ 1.4.2            │       
 │ Uninstalled │ org.ops4j.pax.cdi-1.0.0.RC2       │ Apache Deltaspike jpa support
deltaspike-jpa                           │ 1.8.1            │       
 │ Uninstalled │ org.ops4j.pax.cdi-1.0.0           │ Apache Deltaspike jpa support
jpa                                      │ 2.6.1            │          │
Started     │ aries-jpa-2.6.1                   │ OSGi Persistence Container



Is there a repository I need to add?  

Best regards,
Alex soto



On May 10, 2018, at 3:25 PM, Jean-Baptiste Onofré <[hidden email]
<[hidden email]>> wrote:

Karaf provides both jpa 1.x and  2.x feature.

You just have to  install the right one depending of the engine you are using:

feature:install jpa/1.x
feature:install  openjpa

Regards
JB

On 05/10/2018 09:23 PM, Alex Soto wrote:
Thanks JB,

I was hoping to use whatever was defined in the Karaf’s enterprise feature,
but if that doesn’t work ,then which version do I need?  I am afraid if I
deviate from the versions selected by Kara’s Enterprise feature I will get
into more version mismatch problems.   Also what do I put in my POM for
javax.persistence dependency?


Best regards,
Alex soto



On May 10, 2018, at 3:16 PM, Jean-Baptiste Onofré <[hidden email]
<[hidden email]>> wrote:

Hi,

OpenJPA 2.x still uses JPA 1.x. By default, jpa feature will provide 2.x
version.

You should specify the jpa feature version.

Regards
JB

On 05/10/2018 09:08 PM, Alex Soto wrote:
Hello,

I am running Karaf 4.2.0, trying to setup a project with OpenJPA.  I am getting
error:


14:44:07.799 ERROR [FelixDispatchQueue] FrameworkEvent ERROR
- org.apache.aries.jpa.container
java.lang.ClassCastException:
org.apache.openjpa.persistence.PersistenceProviderImpl
cannot be cast to javax.persistence.spi.PersistenceProvider
at
org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:84)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:44)
~[?:?]
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.apache.aries.jpa.container.impl.PersistenceBundleTracker.trackProvider(PersistenceBundleTracker.java:103)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTracker.findPersistenceUnits(PersistenceBundleTracker.java:87)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:66)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:39)
~[?:?]
at
org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:469)
~[?:?]
at
org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:415)
~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
~[?:?]
at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229) ~[?:?]
at
org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444)
~[?:?]
at
org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915)
~[?:?]
at
org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
~[?:?]
at
org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516)
~[?:?]
at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579) ~[?:?]
at org.apache.felix.framework.Felix.startBundle(Felix.java:2174) ~[?:?]
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1373) ~[?:?]
at
org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
~[?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]



This looks like version mismatch.  I am loading the following packages in my
feature:

<feature>aries-blueprint</feature>
<feature>war</feature>
<feature>camel-core</feature>
<feature>camel-servlet</feature>
<feature>camel-blueprint</feature>
<feature>camel-jackson</feature>
<feature>jndi</feature>
<feature>jdbc</feature>
<feature>transaction</feature>
<feature>jpa</feature>
<feature>openjpa</feature>
<feature>pax-jdbc-mariadb</feature>
      <feature>pax-jdbc-config</feature>


One thing I don’t know if is correct is the javax.persistence dependency in
my POM:

<dependency>
          <groupId>org.eclipse.persistence</groupId>
          <artifactId>javax.persistence</artifactId>
          <version>2.0.5</version>
          <scope>provided</scope>
      </dependency>

Any hints?

Best regards,
Alex soto




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


--
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: OpenJPA with AriesJPA Java.peristence

Tim Ward-2


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

Thanks for the help Tim.

On May 11, 2018, at 10:24 AM, Tim Ward <[hidden email]> wrote:

Aries JPA can work with either JPA 2.0, or JPA 2.1, and is tested with EclipseLink, Hibernate and OpenJPA. 

I am looking at these integration tests, but the test itself does not uses the feature, as defined in the feature.xml file.  It loads a different version of javax.persistence for the OpenJPA integration test. So unless you are an AriesJPA developer, you would not know about this.  How would anybody figure this out? 

@Configuration
    public Option[] configuration() {
        return new Option[] {
            baseOptions(), //
            ariesJpa20(), //
            jta11Bundles(), // Openjpa currently does not work with jta 1.2. See https://issues.apache.org/jira/browse/OPENJPA-2607
            openJpa(), //
            derbyDSF(), //
            testBundle()
        };

Then the example does not use OpenJPA, but Hibernate, so there is no information on how to make it work with OpenJPA out of the box.  
One option here would be to have multiple specific features: jpa-hibernate, jpa-openjpa, etc.

Yes, that’s pretty much what is needed, but Karaf would be the place to create and maintain those features.



It is highly recommended that you use the JavaJPA contract in any of your bundles using JPA so that you are isolated from the API version number changes in the future (most Java EE specifications make major version bumps quite regularly).


I have this in my bundle’s osgi.bnd file:

-contract: JavaJPA

Is that all that is needed?  It does not indicate version.

That is most of what is needed - you also need to be compiling against a library which offers the contract (for example the spec bundles provided by Aries). If you do that you will end up with Import-Package statements for javax.persistence (et al) with no version, but also a Require-Capability: osgi.contract;filter:=(&(osgi.contract=JavaJPA)(version=XXX)) where the XXX is determined from the Provide-Capability of the bundle you compiled against.


The real problem is that the AriesJPA feature shouldn’t exist as a standalone thing (it doesn’t make sense to deploy it on its own). It should come for free when you install the OpenJPA (or Hibernate, or EclipseLink) feature, using whichever API they have deployed.

Exactly, this is harder than it should be.  When I install a feature, I expect the feature to bring in all that is needed, not having to chase down all these dependencies.
Is there an intention to take this approach any time soon?

I’m afraid that would be a decision for the Karaf maintainers rather than me. I’m only chipping in because I’m an Aries PMC member who deals quite a bit with the JPA and Tx Control components.

Best Regards,

Tim Ward






Tim


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

I had accidentally replied directly to Tim.  Repeating here:

Let me see if I understand this correctly:

Karaf version 4.2.0 enterprise repository depends on version 2.6.1 of AriesJPA.
AriesJPA version 2.6.1 depends on  javax.persistence version 2.1.0.
Karaf’s enterprise repository defines a openjpa feature that depends on OpenJPA version 2.4.2.
OpenJPA version 2.4.2 depends on javax.persistence version 2.0.0.
 
Is this correct?
Is there is a bug in the Enterprise repository mixing incompatible versions of OpenJPA and AriesJPA?
Is the problem in OpenJPA not declaring the version it depends on?

Inspecting in Karaf’s console:

karaf@root()> list

 97 │ Active  │  80 │ 2.4.2               │ OpenJPA Aggregate Ja

karaf@root()> bundle:requirements 97

osgi.wiring.package; (&(osgi.wiring.package=javax.persistence)(version>=1.1.0)(!(version>=2.1.0))) resolved by:
   osgi.wiring.package; javax.persistence 2.0.0 from org.apache.geronimo.specs.geronimo-jpa_2.0_spec [66]


karaf@root()> feature:info jpa
Feature jpa 2.6.1
Description:
  OSGi Persistence Container
Details:
  JPA implementation provided by Apache Aries JPA 2.x. NB: this feature doesn't provide the JPA engine, you have to install one by yourself (OpenJPA for instance)
Feature has no configuration
Feature has no configuration files
Feature has no dependencies.
Feature contains followed bundles:
  mvn:org.eclipse.persistence/javax.persistence/2.1.0
  mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1
  mvn:org.osgi/org.osgi.service.jdbc/1.0.0
  mvn:org.apache.felix/org.apache.felix.coordinator/1.0.2 start-level=30
  mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/2.6.1 start-level=30
  mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/2.6.1 start-level=30
  mvn:org.apache.aries.jpa/org.apache.aries.jpa.support/2.6.1 start-level=30

Best regards,
Alex soto




On May 10, 2018, at 5:45 PM, Tim Ward <[hidden email]> wrote:

OpenJPA 2.4.x supports JPA 2.0 (not 2.1) you can get the API you need from Apache Aries, as well as the JPA container. This is also all used and tested with Aries Transaction Control, so you can look at the bundles used there.

Best Regards,

Tim

Sent from my iPhone

On 10 May 2018, at 20:43, Jean-Baptiste Onofré <[hidden email]> wrote:

Anyway, let me check if OpenJPA 2.4.2 supports JPA 2.1 (it's what I thought).

Regards
JB

On 05/10/2018 09:36 PM, Alex Soto wrote:
I am sorry I only see one version:

karaf@root()> feature:list | grep jpa
openjpa                                  │ 2.4.2            │          │
Started     │ enterprise-4.2.0                  │ Apache OpenJPA 2.4.x
persistence engine support
camel-jpa                                │ 2.21.1           │       
 │ Uninstalled │ camel-2.21.1                      │
deltaspike-jpa                           │ 1.4.2            │       
 │ Uninstalled │ org.ops4j.pax.cdi-1.0.0.RC2       │ Apache Deltaspike jpa support
deltaspike-jpa                           │ 1.8.1            │       
 │ Uninstalled │ org.ops4j.pax.cdi-1.0.0           │ Apache Deltaspike jpa support
jpa                                      │ 2.6.1            │          │
Started     │ aries-jpa-2.6.1                   │ OSGi Persistence Container



Is there a repository I need to add?  

Best regards,
Alex soto



On May 10, 2018, at 3:25 PM, Jean-Baptiste Onofré <[hidden email]
<[hidden email]>> wrote:

Karaf provides both jpa 1.x and  2.x feature.

You just have to  install the right one depending of the engine you are using:

feature:install jpa/1.x
feature:install  openjpa

Regards
JB

On 05/10/2018 09:23 PM, Alex Soto wrote:
Thanks JB,

I was hoping to use whatever was defined in the Karaf’s enterprise feature,
but if that doesn’t work ,then which version do I need?  I am afraid if I
deviate from the versions selected by Kara’s Enterprise feature I will get
into more version mismatch problems.   Also what do I put in my POM for
javax.persistence dependency?


Best regards,
Alex soto



On May 10, 2018, at 3:16 PM, Jean-Baptiste Onofré <[hidden email]
<[hidden email]>> wrote:

Hi,

OpenJPA 2.x still uses JPA 1.x. By default, jpa feature will provide 2.x
version.

You should specify the jpa feature version.

Regards
JB

On 05/10/2018 09:08 PM, Alex Soto wrote:
Hello,

I am running Karaf 4.2.0, trying to setup a project with OpenJPA.  I am getting
error:


14:44:07.799 ERROR [FelixDispatchQueue] FrameworkEvent ERROR
- org.apache.aries.jpa.container
java.lang.ClassCastException:
org.apache.openjpa.persistence.PersistenceProviderImpl
cannot be cast to javax.persistence.spi.PersistenceProvider
at
org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:84)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:44)
~[?:?]
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.apache.aries.jpa.container.impl.PersistenceBundleTracker.trackProvider(PersistenceBundleTracker.java:103)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTracker.findPersistenceUnits(PersistenceBundleTracker.java:87)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:66)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:39)
~[?:?]
at
org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:469)
~[?:?]
at
org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:415)
~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
~[?:?]
at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229) ~[?:?]
at
org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444)
~[?:?]
at
org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915)
~[?:?]
at
org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
~[?:?]
at
org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516)
~[?:?]
at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579) ~[?:?]
at org.apache.felix.framework.Felix.startBundle(Felix.java:2174) ~[?:?]
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1373) ~[?:?]
at
org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
~[?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]



This looks like version mismatch.  I am loading the following packages in my
feature:

<feature>aries-blueprint</feature>
<feature>war</feature>
<feature>camel-core</feature>
<feature>camel-servlet</feature>
<feature>camel-blueprint</feature>
<feature>camel-jackson</feature>
<feature>jndi</feature>
<feature>jdbc</feature>
<feature>transaction</feature>
<feature>jpa</feature>
<feature>openjpa</feature>
<feature>pax-jdbc-mariadb</feature>
      <feature>pax-jdbc-config</feature>


One thing I don’t know if is correct is the javax.persistence dependency in
my POM:

<dependency>
          <groupId>org.eclipse.persistence</groupId>
          <artifactId>javax.persistence</artifactId>
          <version>2.0.5</version>
          <scope>provided</scope>
      </dependency>

Any hints?

Best regards,
Alex soto




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


--
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: OpenJPA with AriesJPA Java.peristence

Alex Soto
Ok, I made some progress (I guess) I am no longer getting the original error:  java.lang.ClassCastException: org.apache.openjpa.persistence.PersistenceProviderImpl cannot be cast to javax.persistence.spi.PersistenceProvider


I added my own version of the jpa feature, in which I substitute the line

        <bundle dependency="true">mvn:org.eclipse.persistence/javax.persistence/2.1.0</bundle>


With:
        <bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>

Which results in:

<feature name="aries-jpa2”>
     <capability>
            osgi.service;effective:=active;objectClass=javax.persistence.spi.PersistenceProvider
        </capability>
        
<bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-jpa_2.0_spec/1.1</bundle>
        <bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
        <bundle dependency="true">mvn:org.osgi/org.osgi.service.jdbc/1.0.0</bundle>
        <bundle dependency="true" start-level="30">mvn:org.apache.felix/org.apache.felix.coordinator/1.0.2</bundle>
        <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/${aries.jpa.version}</bundle>
        <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/${aries.jpa.version}</bundle>
        <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.support/${aries.jpa.version}</bundle>
        <conditional>
            <condition>aries-blueprint</condition>
            <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.blueprint/${aries.jpa.version}</bundle>
        </conditional>
</feature>



Now, in my own feature, I have:

<feature>aries-blueprint</feature>
  <feature>jndi</feature>
<feature>jdbc</feature>
<feature>transaction</feature>
<feature>aries-jpa2</feature>
<feature>openjpa</feature>
<feature>pax-jdbc-mariadb</feature>
        <feature>pax-jdbc-config</feature>

Among others.  Now my bundle fails to start:

Status: GracePeriod
Declarative Services
Blueprint
5/11/18 2:14 PM
Missing dependencies: 
(&(osgi.unit.name=responderPersistenUnit)(objectClass=javax.persistence.EntityManager)) 

There are no errors in the log, just this unresolved dependency.
Any idea about why my persistent unit is not being registered?

Best regards,
Alex soto




On May 11, 2018, at 11:09 AM, Tim Ward <[hidden email]> wrote:



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

Thanks for the help Tim.

On May 11, 2018, at 10:24 AM, Tim Ward <[hidden email]> wrote:

Aries JPA can work with either JPA 2.0, or JPA 2.1, and is tested with EclipseLink, Hibernate and OpenJPA. 

I am looking at these integration tests, but the test itself does not uses the feature, as defined in the feature.xml file.  It loads a different version of javax.persistence for the OpenJPA integration test. So unless you are an AriesJPA developer, you would not know about this.  How would anybody figure this out? 

@Configuration
    public Option[] configuration() {
        return new Option[] {
            baseOptions(), //
            ariesJpa20(), //
            jta11Bundles(), // Openjpa currently does not work with jta 1.2. See https://issues.apache.org/jira/browse/OPENJPA-2607
            openJpa(), //
            derbyDSF(), //
            testBundle()
        };

Then the example does not use OpenJPA, but Hibernate, so there is no information on how to make it work with OpenJPA out of the box.  
One option here would be to have multiple specific features: jpa-hibernate, jpa-openjpa, etc.

Yes, that’s pretty much what is needed, but Karaf would be the place to create and maintain those features.



It is highly recommended that you use the JavaJPA contract in any of your bundles using JPA so that you are isolated from the API version number changes in the future (most Java EE specifications make major version bumps quite regularly).


I have this in my bundle’s osgi.bnd file:

-contract: JavaJPA

Is that all that is needed?  It does not indicate version.

That is most of what is needed - you also need to be compiling against a library which offers the contract (for example the spec bundles provided by Aries). If you do that you will end up with Import-Package statements for javax.persistence (et al) with no version, but also a Require-Capability: osgi.contract;filter:=(&(osgi.contract=JavaJPA)(version=XXX)) where the XXX is determined from the Provide-Capability of the bundle you compiled against.


The real problem is that the AriesJPA feature shouldn’t exist as a standalone thing (it doesn’t make sense to deploy it on its own). It should come for free when you install the OpenJPA (or Hibernate, or EclipseLink) feature, using whichever API they have deployed.

Exactly, this is harder than it should be.  When I install a feature, I expect the feature to bring in all that is needed, not having to chase down all these dependencies.
Is there an intention to take this approach any time soon?

I’m afraid that would be a decision for the Karaf maintainers rather than me. I’m only chipping in because I’m an Aries PMC member who deals quite a bit with the JPA and Tx Control components.

Best Regards,

Tim Ward






Tim


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

I had accidentally replied directly to Tim.  Repeating here:

Let me see if I understand this correctly:

Karaf version 4.2.0 enterprise repository depends on version 2.6.1 of AriesJPA.
AriesJPA version 2.6.1 depends on  javax.persistence version 2.1.0.
Karaf’s enterprise repository defines a openjpa feature that depends on OpenJPA version 2.4.2.
OpenJPA version 2.4.2 depends on javax.persistence version 2.0.0.
 
Is this correct?
Is there is a bug in the Enterprise repository mixing incompatible versions of OpenJPA and AriesJPA?
Is the problem in OpenJPA not declaring the version it depends on?

Inspecting in Karaf’s console:

karaf@root()> list

 97 │ Active  │  80 │ 2.4.2               │ OpenJPA Aggregate Ja

karaf@root()> bundle:requirements 97

osgi.wiring.package; (&(osgi.wiring.package=javax.persistence)(version>=1.1.0)(!(version>=2.1.0))) resolved by:
   osgi.wiring.package; javax.persistence 2.0.0 from org.apache.geronimo.specs.geronimo-jpa_2.0_spec [66]


karaf@root()> feature:info jpa
Feature jpa 2.6.1
Description:
  OSGi Persistence Container
Details:
  JPA implementation provided by Apache Aries JPA 2.x. NB: this feature doesn't provide the JPA engine, you have to install one by yourself (OpenJPA for instance)
Feature has no configuration
Feature has no configuration files
Feature has no dependencies.
Feature contains followed bundles:
  mvn:org.eclipse.persistence/javax.persistence/2.1.0
  mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1
  mvn:org.osgi/org.osgi.service.jdbc/1.0.0
  mvn:org.apache.felix/org.apache.felix.coordinator/1.0.2 start-level=30
  mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/2.6.1 start-level=30
  mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/2.6.1 start-level=30
  mvn:org.apache.aries.jpa/org.apache.aries.jpa.support/2.6.1 start-level=30

Best regards,
Alex soto




On May 10, 2018, at 5:45 PM, Tim Ward <[hidden email]> wrote:

OpenJPA 2.4.x supports JPA 2.0 (not 2.1) you can get the API you need from Apache Aries, as well as the JPA container. This is also all used and tested with Aries Transaction Control, so you can look at the bundles used there.

Best Regards,

Tim

Sent from my iPhone

On 10 May 2018, at 20:43, Jean-Baptiste Onofré <[hidden email]> wrote:

Anyway, let me check if OpenJPA 2.4.2 supports JPA 2.1 (it's what I thought).

Regards
JB

On 05/10/2018 09:36 PM, Alex Soto wrote:
I am sorry I only see one version:

karaf@root()> feature:list | grep jpa
openjpa                                  │ 2.4.2            │          │
Started     │ enterprise-4.2.0                  │ Apache OpenJPA 2.4.x
persistence engine support
camel-jpa                                │ 2.21.1           │       
 │ Uninstalled │ camel-2.21.1                      │
deltaspike-jpa                           │ 1.4.2            │       
 │ Uninstalled │ org.ops4j.pax.cdi-1.0.0.RC2       │ Apache Deltaspike jpa support
deltaspike-jpa                           │ 1.8.1            │       
 │ Uninstalled │ org.ops4j.pax.cdi-1.0.0           │ Apache Deltaspike jpa support
jpa                                      │ 2.6.1            │          │
Started     │ aries-jpa-2.6.1                   │ OSGi Persistence Container



Is there a repository I need to add?  

Best regards,
Alex soto



On May 10, 2018, at 3:25 PM, Jean-Baptiste Onofré <[hidden email]
<[hidden email]>> wrote:

Karaf provides both jpa 1.x and  2.x feature.

You just have to  install the right one depending of the engine you are using:

feature:install jpa/1.x
feature:install  openjpa

Regards
JB

On 05/10/2018 09:23 PM, Alex Soto wrote:
Thanks JB,

I was hoping to use whatever was defined in the Karaf’s enterprise feature,
but if that doesn’t work ,then which version do I need?  I am afraid if I
deviate from the versions selected by Kara’s Enterprise feature I will get
into more version mismatch problems.   Also what do I put in my POM for
javax.persistence dependency?


Best regards,
Alex soto



On May 10, 2018, at 3:16 PM, Jean-Baptiste Onofré <[hidden email]
<[hidden email]>> wrote:

Hi,

OpenJPA 2.x still uses JPA 1.x. By default, jpa feature will provide 2.x
version.

You should specify the jpa feature version.

Regards
JB

On 05/10/2018 09:08 PM, Alex Soto wrote:
Hello,

I am running Karaf 4.2.0, trying to setup a project with OpenJPA.  I am getting
error:


14:44:07.799 ERROR [FelixDispatchQueue] FrameworkEvent ERROR
- org.apache.aries.jpa.container
java.lang.ClassCastException:
org.apache.openjpa.persistence.PersistenceProviderImpl
cannot be cast to javax.persistence.spi.PersistenceProvider
at
org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:84)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:44)
~[?:?]
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.apache.aries.jpa.container.impl.PersistenceBundleTracker.trackProvider(PersistenceBundleTracker.java:103)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTracker.findPersistenceUnits(PersistenceBundleTracker.java:87)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:66)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:39)
~[?:?]
at
org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:469)
~[?:?]
at
org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:415)
~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
~[?:?]
at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229) ~[?:?]
at
org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444)
~[?:?]
at
org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915)
~[?:?]
at
org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
~[?:?]
at
org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516)
~[?:?]
at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579) ~[?:?]
at org.apache.felix.framework.Felix.startBundle(Felix.java:2174) ~[?:?]
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1373) ~[?:?]
at
org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
~[?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]



This looks like version mismatch.  I am loading the following packages in my
feature:

<feature>aries-blueprint</feature>
<feature>war</feature>
<feature>camel-core</feature>
<feature>camel-servlet</feature>
<feature>camel-blueprint</feature>
<feature>camel-jackson</feature>
<feature>jndi</feature>
<feature>jdbc</feature>
<feature>transaction</feature>
<feature>jpa</feature>
<feature>openjpa</feature>
<feature>pax-jdbc-mariadb</feature>
      <feature>pax-jdbc-config</feature>


One thing I don’t know if is correct is the javax.persistence dependency in
my POM:

<dependency>
          <groupId>org.eclipse.persistence</groupId>
          <artifactId>javax.persistence</artifactId>
          <version>2.0.5</version>
          <scope>provided</scope>
      </dependency>

Any hints?

Best regards,
Alex soto




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


-- 
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: OpenJPA with AriesJPA Java.peristence

Alex Soto
What is strange is that (based on the logs) it seems as if the persistence unit is being discovered: 

14:50:44.050 INFO [features-3-thread-1] Found persistence unit responderPersistenUnit in bundle org.enquery.encryptedquery.responder-data-jpa-entity-manager with provider org.apache.openjpa.persistence.PersistenceProviderImpl.
14:50:44.052 INFO [features-3-thread-1] Found provider for responderPersistenUnit org.apache.openjpa.persistence.PersistenceProviderImpl
14:50:44.142 INFO [features-3-thread-1] Adding transformer org.apache.openjpa.persistence.PersistenceProviderImpl$ClassTransformerImpl


But the  javax.persistence.EntityManager service is not being registered, and there is no errors.


On May 11, 2018, at 2:19 PM, Alex Soto <[hidden email]> wrote:

Ok, I made some progress (I guess) I am no longer getting the original error:  java.lang.ClassCastException: org.apache.openjpa.persistence.PersistenceProviderImpl cannot be cast to javax.persistence.spi.PersistenceProvider


I added my own version of the jpa feature, in which I substitute the line

        <bundle dependency="true">mvn:org.eclipse.persistence/javax.persistence/2.1.0</bundle>


With:
        <bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>

Which results in:

<feature name="aries-jpa2”>
     <capability>
            osgi.service;effective:=active;objectClass=javax.persistence.spi.PersistenceProvider
        </capability>
        
<bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-jpa_2.0_spec/1.1</bundle>
        <bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
        <bundle dependency="true">mvn:org.osgi/org.osgi.service.jdbc/1.0.0</bundle>
        <bundle dependency="true" start-level="30">mvn:org.apache.felix/org.apache.felix.coordinator/1.0.2</bundle>
        <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/${aries.jpa.version}</bundle>
        <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/${aries.jpa.version}</bundle>
        <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.support/${aries.jpa.version}</bundle>
        <conditional>
            <condition>aries-blueprint</condition>
            <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.blueprint/${aries.jpa.version}</bundle>
        </conditional>
</feature>



Now, in my own feature, I have:

<feature>aries-blueprint</feature>
  <feature>jndi</feature>
<feature>jdbc</feature>
<feature>transaction</feature>
<feature>aries-jpa2</feature>
<feature>openjpa</feature>
<feature>pax-jdbc-mariadb</feature>
        <feature>pax-jdbc-config</feature>

Among others.  Now my bundle fails to start:

Status: GracePeriod
Declarative Services
Blueprint
5/11/18 2:14 PM
Missing dependencies: 
(&(osgi.unit.name=responderPersistenUnit)(objectClass=javax.persistence.EntityManager)) 

There are no errors in the log, just this unresolved dependency.
Any idea about why my persistent unit is not being registered?

Best regards,
Alex soto




On May 11, 2018, at 11:09 AM, Tim Ward <[hidden email]> wrote:



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

Thanks for the help Tim.

On May 11, 2018, at 10:24 AM, Tim Ward <[hidden email]> wrote:

Aries JPA can work with either JPA 2.0, or JPA 2.1, and is tested with EclipseLink, Hibernate and OpenJPA. 

I am looking at these integration tests, but the test itself does not uses the feature, as defined in the feature.xml file.  It loads a different version of javax.persistence for the OpenJPA integration test. So unless you are an AriesJPA developer, you would not know about this.  How would anybody figure this out? 

@Configuration
    public Option[] configuration() {
        return new Option[] {
            baseOptions(), //
            ariesJpa20(), //
            jta11Bundles(), // Openjpa currently does not work with jta 1.2. See https://issues.apache.org/jira/browse/OPENJPA-2607
            openJpa(), //
            derbyDSF(), //
            testBundle()
        };

Then the example does not use OpenJPA, but Hibernate, so there is no information on how to make it work with OpenJPA out of the box.  
One option here would be to have multiple specific features: jpa-hibernate, jpa-openjpa, etc.

Yes, that’s pretty much what is needed, but Karaf would be the place to create and maintain those features.



It is highly recommended that you use the JavaJPA contract in any of your bundles using JPA so that you are isolated from the API version number changes in the future (most Java EE specifications make major version bumps quite regularly).


I have this in my bundle’s osgi.bnd file:

-contract: JavaJPA

Is that all that is needed?  It does not indicate version.

That is most of what is needed - you also need to be compiling against a library which offers the contract (for example the spec bundles provided by Aries). If you do that you will end up with Import-Package statements for javax.persistence (et al) with no version, but also a Require-Capability: osgi.contract;filter:=(&(osgi.contract=JavaJPA)(version=XXX)) where the XXX is determined from the Provide-Capability of the bundle you compiled against.


The real problem is that the AriesJPA feature shouldn’t exist as a standalone thing (it doesn’t make sense to deploy it on its own). It should come for free when you install the OpenJPA (or Hibernate, or EclipseLink) feature, using whichever API they have deployed.

Exactly, this is harder than it should be.  When I install a feature, I expect the feature to bring in all that is needed, not having to chase down all these dependencies.
Is there an intention to take this approach any time soon?

I’m afraid that would be a decision for the Karaf maintainers rather than me. I’m only chipping in because I’m an Aries PMC member who deals quite a bit with the JPA and Tx Control components.

Best Regards,

Tim Ward






Tim


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

I had accidentally replied directly to Tim.  Repeating here:

Let me see if I understand this correctly:

Karaf version 4.2.0 enterprise repository depends on version 2.6.1 of AriesJPA.
AriesJPA version 2.6.1 depends on  javax.persistence version 2.1.0.
Karaf’s enterprise repository defines a openjpa feature that depends on OpenJPA version 2.4.2.
OpenJPA version 2.4.2 depends on javax.persistence version 2.0.0.
 
Is this correct?
Is there is a bug in the Enterprise repository mixing incompatible versions of OpenJPA and AriesJPA?
Is the problem in OpenJPA not declaring the version it depends on?

Inspecting in Karaf’s console:

karaf@root()> list

 97 │ Active  │  80 │ 2.4.2               │ OpenJPA Aggregate Ja

karaf@root()> bundle:requirements 97

osgi.wiring.package; (&(osgi.wiring.package=javax.persistence)(version>=1.1.0)(!(version>=2.1.0))) resolved by:
   osgi.wiring.package; javax.persistence 2.0.0 from org.apache.geronimo.specs.geronimo-jpa_2.0_spec [66]


karaf@root()> feature:info jpa
Feature jpa 2.6.1
Description:
  OSGi Persistence Container
Details:
  JPA implementation provided by Apache Aries JPA 2.x. NB: this feature doesn't provide the JPA engine, you have to install one by yourself (OpenJPA for instance)
Feature has no configuration
Feature has no configuration files
Feature has no dependencies.
Feature contains followed bundles:
  mvn:org.eclipse.persistence/javax.persistence/2.1.0
  mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1
  mvn:org.osgi/org.osgi.service.jdbc/1.0.0
  mvn:org.apache.felix/org.apache.felix.coordinator/1.0.2 start-level=30
  mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/2.6.1 start-level=30
  mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/2.6.1 start-level=30
  mvn:org.apache.aries.jpa/org.apache.aries.jpa.support/2.6.1 start-level=30

Best regards,
Alex soto




On May 10, 2018, at 5:45 PM, Tim Ward <[hidden email]> wrote:

OpenJPA 2.4.x supports JPA 2.0 (not 2.1) you can get the API you need from Apache Aries, as well as the JPA container. This is also all used and tested with Aries Transaction Control, so you can look at the bundles used there.

Best Regards,

Tim

Sent from my iPhone

On 10 May 2018, at 20:43, Jean-Baptiste Onofré <[hidden email]> wrote:

Anyway, let me check if OpenJPA 2.4.2 supports JPA 2.1 (it's what I thought).

Regards
JB

On 05/10/2018 09:36 PM, Alex Soto wrote:
I am sorry I only see one version:

karaf@root()> feature:list | grep jpa
openjpa                                  │ 2.4.2            │          │
Started     │ enterprise-4.2.0                  │ Apache OpenJPA 2.4.x
persistence engine support
camel-jpa                                │ 2.21.1           │       
 │ Uninstalled │ camel-2.21.1                      │
deltaspike-jpa                           │ 1.4.2            │       
 │ Uninstalled │ org.ops4j.pax.cdi-1.0.0.RC2       │ Apache Deltaspike jpa support
deltaspike-jpa                           │ 1.8.1            │       
 │ Uninstalled │ org.ops4j.pax.cdi-1.0.0           │ Apache Deltaspike jpa support
jpa                                      │ 2.6.1            │          │
Started     │ aries-jpa-2.6.1                   │ OSGi Persistence Container



Is there a repository I need to add?  

Best regards,
Alex soto



On May 10, 2018, at 3:25 PM, Jean-Baptiste Onofré <[hidden email]
<[hidden email]>> wrote:

Karaf provides both jpa 1.x and  2.x feature.

You just have to  install the right one depending of the engine you are using:

feature:install jpa/1.x
feature:install  openjpa

Regards
JB

On 05/10/2018 09:23 PM, Alex Soto wrote:
Thanks JB,

I was hoping to use whatever was defined in the Karaf’s enterprise feature,
but if that doesn’t work ,then which version do I need?  I am afraid if I
deviate from the versions selected by Kara’s Enterprise feature I will get
into more version mismatch problems.   Also what do I put in my POM for
javax.persistence dependency?


Best regards,
Alex soto



On May 10, 2018, at 3:16 PM, Jean-Baptiste Onofré <[hidden email]
<[hidden email]>> wrote:

Hi,

OpenJPA 2.x still uses JPA 1.x. By default, jpa feature will provide 2.x
version.

You should specify the jpa feature version.

Regards
JB

On 05/10/2018 09:08 PM, Alex Soto wrote:
Hello,

I am running Karaf 4.2.0, trying to setup a project with OpenJPA.  I am getting
error:


14:44:07.799 ERROR [FelixDispatchQueue] FrameworkEvent ERROR
- org.apache.aries.jpa.container
java.lang.ClassCastException:
org.apache.openjpa.persistence.PersistenceProviderImpl
cannot be cast to javax.persistence.spi.PersistenceProvider
at
org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:84)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:44)
~[?:?]
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.apache.aries.jpa.container.impl.PersistenceBundleTracker.trackProvider(PersistenceBundleTracker.java:103)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTracker.findPersistenceUnits(PersistenceBundleTracker.java:87)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:66)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:39)
~[?:?]
at
org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:469)
~[?:?]
at
org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:415)
~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
~[?:?]
at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229) ~[?:?]
at
org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444)
~[?:?]
at
org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915)
~[?:?]
at
org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
~[?:?]
at
org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516)
~[?:?]
at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579) ~[?:?]
at org.apache.felix.framework.Felix.startBundle(Felix.java:2174) ~[?:?]
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1373) ~[?:?]
at
org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
~[?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]



This looks like version mismatch.  I am loading the following packages in my
feature:

<feature>aries-blueprint</feature>
<feature>war</feature>
<feature>camel-core</feature>
<feature>camel-servlet</feature>
<feature>camel-blueprint</feature>
<feature>camel-jackson</feature>
<feature>jndi</feature>
<feature>jdbc</feature>
<feature>transaction</feature>
<feature>jpa</feature>
<feature>openjpa</feature>
<feature>pax-jdbc-mariadb</feature>
      <feature>pax-jdbc-config</feature>


One thing I don’t know if is correct is the javax.persistence dependency in
my POM:

<dependency>
          <groupId>org.eclipse.persistence</groupId>
          <artifactId>javax.persistence</artifactId>
          <version>2.0.5</version>
          <scope>provided</scope>
      </dependency>

Any hints?

Best regards,
Alex soto




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


-- 
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: OpenJPA with AriesJPA Java.peristence

Tim Ward-2
Hi Alex,

So the logs you’ve sent indicate that your persistence bundle is being found, and that it’s being matched with OpenJPA. These are both good things. 

The next step in the process is to locate and set up the connections to the database. Depending on how you’re setting up your persistence.xml this can happen automatically, but more normally it requires configuration and/or use of the EntityManagerFactoryBuilder service. 

Things to check are that:

• you do see and EntityManagerFactoryBuilder service
• you’re deploying a valid database driver supporting the JDBC service
• your database url and driver class match the driver you’re deploying 
• you’re using the correct pid/unit.name

I hope this helps.

Tim

Sent from my iPhone

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

What is strange is that (based on the logs) it seems as if the persistence unit is being discovered: 

14:50:44.050 INFO [features-3-thread-1] Found persistence unit responderPersistenUnit in bundle org.enquery.encryptedquery.responder-data-jpa-entity-manager with provider org.apache.openjpa.persistence.PersistenceProviderImpl.
14:50:44.052 INFO [features-3-thread-1] Found provider for responderPersistenUnit org.apache.openjpa.persistence.PersistenceProviderImpl
14:50:44.142 INFO [features-3-thread-1] Adding transformer org.apache.openjpa.persistence.PersistenceProviderImpl$ClassTransformerImpl


But the  javax.persistence.EntityManager service is not being registered, and there is no errors.


On May 11, 2018, at 2:19 PM, Alex Soto <[hidden email]> wrote:

Ok, I made some progress (I guess) I am no longer getting the original error:  java.lang.ClassCastException: org.apache.openjpa.persistence.PersistenceProviderImpl cannot be cast to javax.persistence.spi.PersistenceProvider


I added my own version of the jpa feature, in which I substitute the line

        <bundle dependency="true">mvn:org.eclipse.persistence/javax.persistence/2.1.0</bundle>


With:
        <bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>

Which results in:

<feature name="aries-jpa2”>
     <capability>
            osgi.service;effective:=active;objectClass=javax.persistence.spi.PersistenceProvider
        </capability>
        
<bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-jpa_2.0_spec/1.1</bundle>
        <bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
        <bundle dependency="true">mvn:org.osgi/org.osgi.service.jdbc/1.0.0</bundle>
        <bundle dependency="true" start-level="30">mvn:org.apache.felix/org.apache.felix.coordinator/1.0.2</bundle>
        <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/${aries.jpa.version}</bundle>
        <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/${aries.jpa.version}</bundle>
        <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.support/${aries.jpa.version}</bundle>
        <conditional>
            <condition>aries-blueprint</condition>
            <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.blueprint/${aries.jpa.version}</bundle>
        </conditional>
</feature>



Now, in my own feature, I have:

<feature>aries-blueprint</feature>
  <feature>jndi</feature>
<feature>jdbc</feature>
<feature>transaction</feature>
<feature>aries-jpa2</feature>
<feature>openjpa</feature>
<feature>pax-jdbc-mariadb</feature>
        <feature>pax-jdbc-config</feature>

Among others.  Now my bundle fails to start:

Status: GracePeriod
Declarative Services
Blueprint
5/11/18 2:14 PM
Missing dependencies: 
(&(osgi.unit.name=responderPersistenUnit)(objectClass=javax.persistence.EntityManager)) 

There are no errors in the log, just this unresolved dependency.
Any idea about why my persistent unit is not being registered?

Best regards,
Alex soto




On May 11, 2018, at 11:09 AM, Tim Ward <[hidden email]> wrote:



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

Thanks for the help Tim.

On May 11, 2018, at 10:24 AM, Tim Ward <[hidden email]> wrote:

Aries JPA can work with either JPA 2.0, or JPA 2.1, and is tested with EclipseLink, Hibernate and OpenJPA. 

I am looking at these integration tests, but the test itself does not uses the feature, as defined in the feature.xml file.  It loads a different version of javax.persistence for the OpenJPA integration test. So unless you are an AriesJPA developer, you would not know about this.  How would anybody figure this out? 

@Configuration
    public Option[] configuration() {
        return new Option[] {
            baseOptions(), //
            ariesJpa20(), //
            jta11Bundles(), // Openjpa currently does not work with jta 1.2. See https://issues.apache.org/jira/browse/OPENJPA-2607
            openJpa(), //
            derbyDSF(), //
            testBundle()
        };

Then the example does not use OpenJPA, but Hibernate, so there is no information on how to make it work with OpenJPA out of the box.  
One option here would be to have multiple specific features: jpa-hibernate, jpa-openjpa, etc.

Yes, that’s pretty much what is needed, but Karaf would be the place to create and maintain those features.



It is highly recommended that you use the JavaJPA contract in any of your bundles using JPA so that you are isolated from the API version number changes in the future (most Java EE specifications make major version bumps quite regularly).


I have this in my bundle’s osgi.bnd file:

-contract: JavaJPA

Is that all that is needed?  It does not indicate version.

That is most of what is needed - you also need to be compiling against a library which offers the contract (for example the spec bundles provided by Aries). If you do that you will end up with Import-Package statements for javax.persistence (et al) with no version, but also a Require-Capability: osgi.contract;filter:=(&(osgi.contract=JavaJPA)(version=XXX)) where the XXX is determined from the Provide-Capability of the bundle you compiled against.


The real problem is that the AriesJPA feature shouldn’t exist as a standalone thing (it doesn’t make sense to deploy it on its own). It should come for free when you install the OpenJPA (or Hibernate, or EclipseLink) feature, using whichever API they have deployed.

Exactly, this is harder than it should be.  When I install a feature, I expect the feature to bring in all that is needed, not having to chase down all these dependencies.
Is there an intention to take this approach any time soon?

I’m afraid that would be a decision for the Karaf maintainers rather than me. I’m only chipping in because I’m an Aries PMC member who deals quite a bit with the JPA and Tx Control components.

Best Regards,

Tim Ward






Tim


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

I had accidentally replied directly to Tim.  Repeating here:

Let me see if I understand this correctly:

Karaf version 4.2.0 enterprise repository depends on version 2.6.1 of AriesJPA.
AriesJPA version 2.6.1 depends on  javax.persistence version 2.1.0.
Karaf’s enterprise repository defines a openjpa feature that depends on OpenJPA version 2.4.2.
OpenJPA version 2.4.2 depends on javax.persistence version 2.0.0.
 
Is this correct?
Is there is a bug in the Enterprise repository mixing incompatible versions of OpenJPA and AriesJPA?
Is the problem in OpenJPA not declaring the version it depends on?

Inspecting in Karaf’s console:

karaf@root()> list

 97 │ Active  │  80 │ 2.4.2               │ OpenJPA Aggregate Ja

karaf@root()> bundle:requirements 97

osgi.wiring.package; (&(osgi.wiring.package=javax.persistence)(version>=1.1.0)(!(version>=2.1.0))) resolved by:
   osgi.wiring.package; javax.persistence 2.0.0 from org.apache.geronimo.specs.geronimo-jpa_2.0_spec [66]


karaf@root()> feature:info jpa
Feature jpa 2.6.1
Description:
  OSGi Persistence Container
Details:
  JPA implementation provided by Apache Aries JPA 2.x. NB: this feature doesn't provide the JPA engine, you have to install one by yourself (OpenJPA for instance)
Feature has no configuration
Feature has no configuration files
Feature has no dependencies.
Feature contains followed bundles:
  mvn:org.eclipse.persistence/javax.persistence/2.1.0
  mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1
  mvn:org.osgi/org.osgi.service.jdbc/1.0.0
  mvn:org.apache.felix/org.apache.felix.coordinator/1.0.2 start-level=30
  mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/2.6.1 start-level=30
  mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/2.6.1 start-level=30
  mvn:org.apache.aries.jpa/org.apache.aries.jpa.support/2.6.1 start-level=30

Best regards,
Alex soto




On May 10, 2018, at 5:45 PM, Tim Ward <[hidden email]> wrote:

OpenJPA 2.4.x supports JPA 2.0 (not 2.1) you can get the API you need from Apache Aries, as well as the JPA container. This is also all used and tested with Aries Transaction Control, so you can look at the bundles used there.

Best Regards,

Tim

Sent from my iPhone

On 10 May 2018, at 20:43, Jean-Baptiste Onofré <[hidden email]> wrote:

Anyway, let me check if OpenJPA 2.4.2 supports JPA 2.1 (it's what I thought).

Regards
JB

On 05/10/2018 09:36 PM, Alex Soto wrote:
I am sorry I only see one version:

karaf@root()> feature:list | grep jpa
openjpa                                  │ 2.4.2            │          │
Started     │ enterprise-4.2.0                  │ Apache OpenJPA 2.4.x
persistence engine support
camel-jpa                                │ 2.21.1           │       
 │ Uninstalled │ camel-2.21.1                      │
deltaspike-jpa                           │ 1.4.2            │       
 │ Uninstalled │ org.ops4j.pax.cdi-1.0.0.RC2       │ Apache Deltaspike jpa support
deltaspike-jpa                           │ 1.8.1            │       
 │ Uninstalled │ org.ops4j.pax.cdi-1.0.0           │ Apache Deltaspike jpa support
jpa                                      │ 2.6.1            │          │
Started     │ aries-jpa-2.6.1                   │ OSGi Persistence Container



Is there a repository I need to add?  

Best regards,
Alex soto



On May 10, 2018, at 3:25 PM, Jean-Baptiste Onofré <[hidden email]
<[hidden email]>> wrote:

Karaf provides both jpa 1.x and  2.x feature.

You just have to  install the right one depending of the engine you are using:

feature:install jpa/1.x
feature:install  openjpa

Regards
JB

On 05/10/2018 09:23 PM, Alex Soto wrote:
Thanks JB,

I was hoping to use whatever was defined in the Karaf’s enterprise feature,
but if that doesn’t work ,then which version do I need?  I am afraid if I
deviate from the versions selected by Kara’s Enterprise feature I will get
into more version mismatch problems.   Also what do I put in my POM for
javax.persistence dependency?


Best regards,
Alex soto



On May 10, 2018, at 3:16 PM, Jean-Baptiste Onofré <[hidden email]
<[hidden email]>> wrote:

Hi,

OpenJPA 2.x still uses JPA 1.x. By default, jpa feature will provide 2.x
version.

You should specify the jpa feature version.

Regards
JB

On 05/10/2018 09:08 PM, Alex Soto wrote:
Hello,

I am running Karaf 4.2.0, trying to setup a project with OpenJPA.  I am getting
error:


14:44:07.799 ERROR [FelixDispatchQueue] FrameworkEvent ERROR
- org.apache.aries.jpa.container
java.lang.ClassCastException:
org.apache.openjpa.persistence.PersistenceProviderImpl
cannot be cast to javax.persistence.spi.PersistenceProvider
at
org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:84)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:44)
~[?:?]
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.apache.aries.jpa.container.impl.PersistenceBundleTracker.trackProvider(PersistenceBundleTracker.java:103)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTracker.findPersistenceUnits(PersistenceBundleTracker.java:87)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:66)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:39)
~[?:?]
at
org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:469)
~[?:?]
at
org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:415)
~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
~[?:?]
at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229) ~[?:?]
at
org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444)
~[?:?]
at
org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915)
~[?:?]
at
org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
~[?:?]
at
org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516)
~[?:?]
at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579) ~[?:?]
at org.apache.felix.framework.Felix.startBundle(Felix.java:2174) ~[?:?]
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1373) ~[?:?]
at
org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
~[?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]



This looks like version mismatch.  I am loading the following packages in my
feature:

<feature>aries-blueprint</feature>
<feature>war</feature>
<feature>camel-core</feature>
<feature>camel-servlet</feature>
<feature>camel-blueprint</feature>
<feature>camel-jackson</feature>
<feature>jndi</feature>
<feature>jdbc</feature>
<feature>transaction</feature>
<feature>jpa</feature>
<feature>openjpa</feature>
<feature>pax-jdbc-mariadb</feature>
      <feature>pax-jdbc-config</feature>


One thing I don’t know if is correct is the javax.persistence dependency in
my POM:

<dependency>
          <groupId>org.eclipse.persistence</groupId>
          <artifactId>javax.persistence</artifactId>
          <version>2.0.5</version>
          <scope>provided</scope>
      </dependency>

Any hints?

Best regards,
Alex soto




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


-- 
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: OpenJPA with AriesJPA Java.peristence

Alex Soto
Thank you Tim, I appreciate the help.
Yes, an EntityManagerFactoryBuilder is registered as a service by my bundle:

karaf@root()> service:list org.osgi.service.jpa.EntityManagerFactoryBuilder
[org.osgi.service.jpa.EntityManagerFactoryBuilder]
--------------------------------------------------
 osgi.unit.name = responderPersistenUnit
 osgi.unit.provider = org.apache.openjpa.persistence.PersistenceProviderImpl
 osgi.unit.version = 1.0.0.SNAPSHOT
 service.bundleid = 138
 service.id = 198
 service.scope = singleton

DataSource is also registered:

karaf@root()> service:list javax.sql.DataSource
[javax.sql.DataSource]
----------------------
 dataSourceName = responder
 felix.fileinstall.filename = file:xxxxx/org.ops4j.datasource-responder.cfg
 osgi.jdbc.driver.name = mariadb
 osgi.jndi.service.name = responder

karaf@root()> ds-list 
Name      │ Product │ Version         │ URL                                                                                         │ Status
──────────┼─────────┼─────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────┼───────
responder │ MySQL   │ 10.2.13-MariaDB │ jdbc:<a href="mariadb://xxxx:3306/responder?characterEncoding=UTF-" class="">mariadb://xxxx:3306/responder?characterEncoding=UTF-8&useServerPrepStmts=true │ OK


Jndi shows:

karaf@root()> jndi:names 
JNDI Name              │ Class Name
───────────────────────┼───────────────────────────────────────────────
osgi:service/responder │ org.mariadb.jdbc.MySQLDataSource
osgi:service/jndi      │ org.apache.karaf.jndi.internal.JndiServiceImpl

My Persistence Unit is defined as:

<persistence-unit name="responderPersistenUnit" transaction-type="JTA">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/responder)</jta-data-source>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<class>org.enquery.encryptedquery.responder.data.User</class>
<properties>
<property name="openjpa.Log" value="DefaultLevel=DEBUG, Tool=INFO" />
</properties>
</persistence-unit>


I am thinking if the “jta-data-source” property is wrong?


Best regards,
Alex soto




On May 11, 2018, at 3:48 PM, Tim Ward <[hidden email]> wrote:

Hi Alex,

So the logs you’ve sent indicate that your persistence bundle is being found, and that it’s being matched with OpenJPA. These are both good things. 

The next step in the process is to locate and set up the connections to the database. Depending on how you’re setting up your persistence.xml this can happen automatically, but more normally it requires configuration and/or use of the EntityManagerFactoryBuilder service. 

Things to check are that:

• you do see and EntityManagerFactoryBuilder service
• you’re deploying a valid database driver supporting the JDBC service
• your database url and driver class match the driver you’re deploying 
• you’re using the correct pid/unit.name

I hope this helps.

Tim

Sent from my iPhone

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

What is strange is that (based on the logs) it seems as if the persistence unit is being discovered: 

14:50:44.050 INFO [features-3-thread-1] Found persistence unit responderPersistenUnit in bundle org.enquery.encryptedquery.responder-data-jpa-entity-manager with provider org.apache.openjpa.persistence.PersistenceProviderImpl.
14:50:44.052 INFO [features-3-thread-1] Found provider for responderPersistenUnit org.apache.openjpa.persistence.PersistenceProviderImpl
14:50:44.142 INFO [features-3-thread-1] Adding transformer org.apache.openjpa.persistence.PersistenceProviderImpl$ClassTransformerImpl


But the  javax.persistence.EntityManager service is not being registered, and there is no errors.


On May 11, 2018, at 2:19 PM, Alex Soto <[hidden email]> wrote:

Ok, I made some progress (I guess) I am no longer getting the original error:  java.lang.ClassCastException: org.apache.openjpa.persistence.PersistenceProviderImpl cannot be cast to javax.persistence.spi.PersistenceProvider


I added my own version of the jpa feature, in which I substitute the line

        <bundle dependency="true">mvn:org.eclipse.persistence/javax.persistence/2.1.0</bundle>


With:
        <bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>

Which results in:

<feature name="aries-jpa2”>
     <capability>
            osgi.service;effective:=active;objectClass=javax.persistence.spi.PersistenceProvider
        </capability>
        
<bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-jpa_2.0_spec/1.1</bundle>
        <bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
        <bundle dependency="true">mvn:org.osgi/org.osgi.service.jdbc/1.0.0</bundle>
        <bundle dependency="true" start-level="30">mvn:org.apache.felix/org.apache.felix.coordinator/1.0.2</bundle>
        <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/${aries.jpa.version}</bundle>
        <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/${aries.jpa.version}</bundle>
        <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.support/${aries.jpa.version}</bundle>
        <conditional>
            <condition>aries-blueprint</condition>
            <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.blueprint/${aries.jpa.version}</bundle>
        </conditional>
</feature>



Now, in my own feature, I have:

<feature>aries-blueprint</feature>
  <feature>jndi</feature>
<feature>jdbc</feature>
<feature>transaction</feature>
<feature>aries-jpa2</feature>
<feature>openjpa</feature>
<feature>pax-jdbc-mariadb</feature>
        <feature>pax-jdbc-config</feature>

Among others.  Now my bundle fails to start:

Status: GracePeriod
Declarative Services
Blueprint
5/11/18 2:14 PM
Missing dependencies: 
(&(osgi.unit.name=responderPersistenUnit)(objectClass=javax.persistence.EntityManager)) 

There are no errors in the log, just this unresolved dependency.
Any idea about why my persistent unit is not being registered?

Best regards,
Alex soto




On May 11, 2018, at 11:09 AM, Tim Ward <[hidden email]> wrote:



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

Thanks for the help Tim.

On May 11, 2018, at 10:24 AM, Tim Ward <[hidden email]> wrote:

Aries JPA can work with either JPA 2.0, or JPA 2.1, and is tested with EclipseLink, Hibernate and OpenJPA. 

I am looking at these integration tests, but the test itself does not uses the feature, as defined in the feature.xml file.  It loads a different version of javax.persistence for the OpenJPA integration test. So unless you are an AriesJPA developer, you would not know about this.  How would anybody figure this out? 

@Configuration
    public Option[] configuration() {
        return new Option[] {
            baseOptions(), //
            ariesJpa20(), //
            jta11Bundles(), // Openjpa currently does not work with jta 1.2. See https://issues.apache.org/jira/browse/OPENJPA-2607
            openJpa(), //
            derbyDSF(), //
            testBundle()
        };

Then the example does not use OpenJPA, but Hibernate, so there is no information on how to make it work with OpenJPA out of the box.  
One option here would be to have multiple specific features: jpa-hibernate, jpa-openjpa, etc.

Yes, that’s pretty much what is needed, but Karaf would be the place to create and maintain those features.



It is highly recommended that you use the JavaJPA contract in any of your bundles using JPA so that you are isolated from the API version number changes in the future (most Java EE specifications make major version bumps quite regularly).


I have this in my bundle’s osgi.bnd file:

-contract: JavaJPA

Is that all that is needed?  It does not indicate version.

That is most of what is needed - you also need to be compiling against a library which offers the contract (for example the spec bundles provided by Aries). If you do that you will end up with Import-Package statements for javax.persistence (et al) with no version, but also a Require-Capability: osgi.contract;filter:=(&(osgi.contract=JavaJPA)(version=XXX)) where the XXX is determined from the Provide-Capability of the bundle you compiled against.


The real problem is that the AriesJPA feature shouldn’t exist as a standalone thing (it doesn’t make sense to deploy it on its own). It should come for free when you install the OpenJPA (or Hibernate, or EclipseLink) feature, using whichever API they have deployed.

Exactly, this is harder than it should be.  When I install a feature, I expect the feature to bring in all that is needed, not having to chase down all these dependencies.
Is there an intention to take this approach any time soon?

I’m afraid that would be a decision for the Karaf maintainers rather than me. I’m only chipping in because I’m an Aries PMC member who deals quite a bit with the JPA and Tx Control components.

Best Regards,

Tim Ward






Tim


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

I had accidentally replied directly to Tim.  Repeating here:

Let me see if I understand this correctly:

Karaf version 4.2.0 enterprise repository depends on version 2.6.1 of AriesJPA.
AriesJPA version 2.6.1 depends on  javax.persistence version 2.1.0.
Karaf’s enterprise repository defines a openjpa feature that depends on OpenJPA version 2.4.2.
OpenJPA version 2.4.2 depends on javax.persistence version 2.0.0.
 
Is this correct?
Is there is a bug in the Enterprise repository mixing incompatible versions of OpenJPA and AriesJPA?
Is the problem in OpenJPA not declaring the version it depends on?

Inspecting in Karaf’s console:

karaf@root()> list

 97 │ Active  │  80 │ 2.4.2               │ OpenJPA Aggregate Ja

karaf@root()> bundle:requirements 97

osgi.wiring.package; (&(osgi.wiring.package=javax.persistence)(version>=1.1.0)(!(version>=2.1.0))) resolved by:
   osgi.wiring.package; javax.persistence 2.0.0 from org.apache.geronimo.specs.geronimo-jpa_2.0_spec [66]


karaf@root()> feature:info jpa
Feature jpa 2.6.1
Description:
  OSGi Persistence Container
Details:
  JPA implementation provided by Apache Aries JPA 2.x. NB: this feature doesn't provide the JPA engine, you have to install one by yourself (OpenJPA for instance)
Feature has no configuration
Feature has no configuration files
Feature has no dependencies.
Feature contains followed bundles:
  mvn:org.eclipse.persistence/javax.persistence/2.1.0
  mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1
  mvn:org.osgi/org.osgi.service.jdbc/1.0.0
  mvn:org.apache.felix/org.apache.felix.coordinator/1.0.2 start-level=30
  mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/2.6.1 start-level=30
  mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/2.6.1 start-level=30
  mvn:org.apache.aries.jpa/org.apache.aries.jpa.support/2.6.1 start-level=30

Best regards,
Alex soto




On May 10, 2018, at 5:45 PM, Tim Ward <[hidden email]> wrote:

OpenJPA 2.4.x supports JPA 2.0 (not 2.1) you can get the API you need from Apache Aries, as well as the JPA container. This is also all used and tested with Aries Transaction Control, so you can look at the bundles used there.

Best Regards,

Tim

Sent from my iPhone

On 10 May 2018, at 20:43, Jean-Baptiste Onofré <[hidden email]> wrote:

Anyway, let me check if OpenJPA 2.4.2 supports JPA 2.1 (it's what I thought).

Regards
JB

On 05/10/2018 09:36 PM, Alex Soto wrote:
I am sorry I only see one version:

karaf@root()> feature:list | grep jpa
openjpa                                  │ 2.4.2            │          │
Started     │ enterprise-4.2.0                  │ Apache OpenJPA 2.4.x
persistence engine support
camel-jpa                                │ 2.21.1           │       
 │ Uninstalled │ camel-2.21.1                      │
deltaspike-jpa                           │ 1.4.2            │       
 │ Uninstalled │ org.ops4j.pax.cdi-1.0.0.RC2       │ Apache Deltaspike jpa support
deltaspike-jpa                           │ 1.8.1            │       
 │ Uninstalled │ org.ops4j.pax.cdi-1.0.0           │ Apache Deltaspike jpa support
jpa                                      │ 2.6.1            │          │
Started     │ aries-jpa-2.6.1                   │ OSGi Persistence Container



Is there a repository I need to add?  

Best regards,
Alex soto



On May 10, 2018, at 3:25 PM, Jean-Baptiste Onofré <[hidden email]
<[hidden email]>> wrote:

Karaf provides both jpa 1.x and  2.x feature.

You just have to  install the right one depending of the engine you are using:

feature:install jpa/1.x
feature:install  openjpa

Regards
JB

On 05/10/2018 09:23 PM, Alex Soto wrote:
Thanks JB,

I was hoping to use whatever was defined in the Karaf’s enterprise feature,
but if that doesn’t work ,then which version do I need?  I am afraid if I
deviate from the versions selected by Kara’s Enterprise feature I will get
into more version mismatch problems.   Also what do I put in my POM for
javax.persistence dependency?


Best regards,
Alex soto



On May 10, 2018, at 3:16 PM, Jean-Baptiste Onofré <[hidden email]
<[hidden email]>> wrote:

Hi,

OpenJPA 2.x still uses JPA 1.x. By default, jpa feature will provide 2.x
version.

You should specify the jpa feature version.

Regards
JB

On 05/10/2018 09:08 PM, Alex Soto wrote:
Hello,

I am running Karaf 4.2.0, trying to setup a project with OpenJPA.  I am getting
error:


14:44:07.799 ERROR [FelixDispatchQueue] FrameworkEvent ERROR
- org.apache.aries.jpa.container
java.lang.ClassCastException:
org.apache.openjpa.persistence.PersistenceProviderImpl
cannot be cast to javax.persistence.spi.PersistenceProvider
at
org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:84)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:44)
~[?:?]
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.apache.aries.jpa.container.impl.PersistenceBundleTracker.trackProvider(PersistenceBundleTracker.java:103)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTracker.findPersistenceUnits(PersistenceBundleTracker.java:87)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:66)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:39)
~[?:?]
at
org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:469)
~[?:?]
at
org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:415)
~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
~[?:?]
at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229) ~[?:?]
at
org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444)
~[?:?]
at
org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915)
~[?:?]
at
org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
~[?:?]
at
org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516)
~[?:?]
at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579) ~[?:?]
at org.apache.felix.framework.Felix.startBundle(Felix.java:2174) ~[?:?]
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1373) ~[?:?]
at
org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
~[?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]



This looks like version mismatch.  I am loading the following packages in my
feature:

<feature>aries-blueprint</feature>
<feature>war</feature>
<feature>camel-core</feature>
<feature>camel-servlet</feature>
<feature>camel-blueprint</feature>
<feature>camel-jackson</feature>
<feature>jndi</feature>
<feature>jdbc</feature>
<feature>transaction</feature>
<feature>jpa</feature>
<feature>openjpa</feature>
<feature>pax-jdbc-mariadb</feature>
      <feature>pax-jdbc-config</feature>


One thing I don’t know if is correct is the javax.persistence dependency in
my POM:

<dependency>
          <groupId>org.eclipse.persistence</groupId>
          <artifactId>javax.persistence</artifactId>
          <version>2.0.5</version>
          <scope>provided</scope>
      </dependency>

Any hints?

Best regards,
Alex soto




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


-- 
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: OpenJPA with AriesJPA Java.peristence

Tim Ward-2
Yes, it looks like your jta-datasource-name is wrong. The name is set to responder, not jdbc/responder, so I’m pretty sure that the filter in your JNDI name won’t match. 

Tim

Sent from my iPhone

On 11 May 2018, at 21:07, Alex Soto <[hidden email]> wrote:

Thank you Tim, I appreciate the help.
Yes, an EntityManagerFactoryBuilder is registered as a service by my bundle:

karaf@root()> service:list org.osgi.service.jpa.EntityManagerFactoryBuilder
[org.osgi.service.jpa.EntityManagerFactoryBuilder]
--------------------------------------------------
 osgi.unit.name = responderPersistenUnit
 osgi.unit.provider = org.apache.openjpa.persistence.PersistenceProviderImpl
 osgi.unit.version = 1.0.0.SNAPSHOT
 service.bundleid = 138
 service.id = 198
 service.scope = singleton

DataSource is also registered:

karaf@root()> service:list javax.sql.DataSource
[javax.sql.DataSource]
----------------------
 dataSourceName = responder
 felix.fileinstall.filename = file:xxxxx/org.ops4j.datasource-responder.cfg
 osgi.jdbc.driver.name = mariadb
 osgi.jndi.service.name = responder

karaf@root()> ds-list 
Name      │ Product │ Version         │ URL                                                                                         │ Status
──────────┼─────────┼─────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────┼───────
responder │ MySQL   │ 10.2.13-MariaDB │ jdbc:<a href="mariadb://xxxx:3306/responder?characterEncoding=UTF-" class="">mariadb://xxxx:3306/responder?characterEncoding=UTF-8&useServerPrepStmts=true │ OK


Jndi shows:

karaf@root()> jndi:names 
JNDI Name              │ Class Name
───────────────────────┼───────────────────────────────────────────────
osgi:service/responder │ org.mariadb.jdbc.MySQLDataSource
osgi:service/jndi      │ org.apache.karaf.jndi.internal.JndiServiceImpl

My Persistence Unit is defined as:

<persistence-unit name="responderPersistenUnit" transaction-type="JTA">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/responder)</jta-data-source>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<class>org.enquery.encryptedquery.responder.data.User</class>
<properties>
<property name="openjpa.Log" value="DefaultLevel=DEBUG, Tool=INFO" />
</properties>
</persistence-unit>


I am thinking if the “jta-data-source” property is wrong?


Best regards,
Alex soto




On May 11, 2018, at 3:48 PM, Tim Ward <[hidden email]> wrote:

Hi Alex,

So the logs you’ve sent indicate that your persistence bundle is being found, and that it’s being matched with OpenJPA. These are both good things. 

The next step in the process is to locate and set up the connections to the database. Depending on how you’re setting up your persistence.xml this can happen automatically, but more normally it requires configuration and/or use of the EntityManagerFactoryBuilder service. 

Things to check are that:

• you do see and EntityManagerFactoryBuilder service
• you’re deploying a valid database driver supporting the JDBC service
• your database url and driver class match the driver you’re deploying 
• you’re using the correct pid/unit.name

I hope this helps.

Tim

Sent from my iPhone

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

What is strange is that (based on the logs) it seems as if the persistence unit is being discovered: 

14:50:44.050 INFO [features-3-thread-1] Found persistence unit responderPersistenUnit in bundle org.enquery.encryptedquery.responder-data-jpa-entity-manager with provider org.apache.openjpa.persistence.PersistenceProviderImpl.
14:50:44.052 INFO [features-3-thread-1] Found provider for responderPersistenUnit org.apache.openjpa.persistence.PersistenceProviderImpl
14:50:44.142 INFO [features-3-thread-1] Adding transformer org.apache.openjpa.persistence.PersistenceProviderImpl$ClassTransformerImpl


But the  javax.persistence.EntityManager service is not being registered, and there is no errors.


On May 11, 2018, at 2:19 PM, Alex Soto <[hidden email]> wrote:

Ok, I made some progress (I guess) I am no longer getting the original error:  java.lang.ClassCastException: org.apache.openjpa.persistence.PersistenceProviderImpl cannot be cast to javax.persistence.spi.PersistenceProvider


I added my own version of the jpa feature, in which I substitute the line

        <bundle dependency="true">mvn:org.eclipse.persistence/javax.persistence/2.1.0</bundle>


With:
        <bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>

Which results in:

<feature name="aries-jpa2”>
     <capability>
            osgi.service;effective:=active;objectClass=javax.persistence.spi.PersistenceProvider
        </capability>
        
<bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-jpa_2.0_spec/1.1</bundle>
        <bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
        <bundle dependency="true">mvn:org.osgi/org.osgi.service.jdbc/1.0.0</bundle>
        <bundle dependency="true" start-level="30">mvn:org.apache.felix/org.apache.felix.coordinator/1.0.2</bundle>
        <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/${aries.jpa.version}</bundle>
        <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/${aries.jpa.version}</bundle>
        <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.support/${aries.jpa.version}</bundle>
        <conditional>
            <condition>aries-blueprint</condition>
            <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.blueprint/${aries.jpa.version}</bundle>
        </conditional>
</feature>



Now, in my own feature, I have:

<feature>aries-blueprint</feature>
  <feature>jndi</feature>
<feature>jdbc</feature>
<feature>transaction</feature>
<feature>aries-jpa2</feature>
<feature>openjpa</feature>
<feature>pax-jdbc-mariadb</feature>
        <feature>pax-jdbc-config</feature>

Among others.  Now my bundle fails to start:

Status: GracePeriod
Declarative Services
Blueprint
5/11/18 2:14 PM
Missing dependencies: 
(&(osgi.unit.name=responderPersistenUnit)(objectClass=javax.persistence.EntityManager)) 

There are no errors in the log, just this unresolved dependency.
Any idea about why my persistent unit is not being registered?

Best regards,
Alex soto




On May 11, 2018, at 11:09 AM, Tim Ward <[hidden email]> wrote:



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

Thanks for the help Tim.

On May 11, 2018, at 10:24 AM, Tim Ward <[hidden email]> wrote:

Aries JPA can work with either JPA 2.0, or JPA 2.1, and is tested with EclipseLink, Hibernate and OpenJPA. 

I am looking at these integration tests, but the test itself does not uses the feature, as defined in the feature.xml file.  It loads a different version of javax.persistence for the OpenJPA integration test. So unless you are an AriesJPA developer, you would not know about this.  How would anybody figure this out? 

@Configuration
    public Option[] configuration() {
        return new Option[] {
            baseOptions(), //
            ariesJpa20(), //
            jta11Bundles(), // Openjpa currently does not work with jta 1.2. See https://issues.apache.org/jira/browse/OPENJPA-2607
            openJpa(), //
            derbyDSF(), //
            testBundle()
        };

Then the example does not use OpenJPA, but Hibernate, so there is no information on how to make it work with OpenJPA out of the box.  
One option here would be to have multiple specific features: jpa-hibernate, jpa-openjpa, etc.

Yes, that’s pretty much what is needed, but Karaf would be the place to create and maintain those features.



It is highly recommended that you use the JavaJPA contract in any of your bundles using JPA so that you are isolated from the API version number changes in the future (most Java EE specifications make major version bumps quite regularly).


I have this in my bundle’s osgi.bnd file:

-contract: JavaJPA

Is that all that is needed?  It does not indicate version.

That is most of what is needed - you also need to be compiling against a library which offers the contract (for example the spec bundles provided by Aries). If you do that you will end up with Import-Package statements for javax.persistence (et al) with no version, but also a Require-Capability: osgi.contract;filter:=(&(osgi.contract=JavaJPA)(version=XXX)) where the XXX is determined from the Provide-Capability of the bundle you compiled against.


The real problem is that the AriesJPA feature shouldn’t exist as a standalone thing (it doesn’t make sense to deploy it on its own). It should come for free when you install the OpenJPA (or Hibernate, or EclipseLink) feature, using whichever API they have deployed.

Exactly, this is harder than it should be.  When I install a feature, I expect the feature to bring in all that is needed, not having to chase down all these dependencies.
Is there an intention to take this approach any time soon?

I’m afraid that would be a decision for the Karaf maintainers rather than me. I’m only chipping in because I’m an Aries PMC member who deals quite a bit with the JPA and Tx Control components.

Best Regards,

Tim Ward






Tim


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

I had accidentally replied directly to Tim.  Repeating here:

Let me see if I understand this correctly:

Karaf version 4.2.0 enterprise repository depends on version 2.6.1 of AriesJPA.
AriesJPA version 2.6.1 depends on  javax.persistence version 2.1.0.
Karaf’s enterprise repository defines a openjpa feature that depends on OpenJPA version 2.4.2.
OpenJPA version 2.4.2 depends on javax.persistence version 2.0.0.
 
Is this correct?
Is there is a bug in the Enterprise repository mixing incompatible versions of OpenJPA and AriesJPA?
Is the problem in OpenJPA not declaring the version it depends on?

Inspecting in Karaf’s console:

karaf@root()> list

 97 │ Active  │  80 │ 2.4.2               │ OpenJPA Aggregate Ja

karaf@root()> bundle:requirements 97

osgi.wiring.package; (&(osgi.wiring.package=javax.persistence)(version>=1.1.0)(!(version>=2.1.0))) resolved by:
   osgi.wiring.package; javax.persistence 2.0.0 from org.apache.geronimo.specs.geronimo-jpa_2.0_spec [66]


karaf@root()> feature:info jpa
Feature jpa 2.6.1
Description:
  OSGi Persistence Container
Details:
  JPA implementation provided by Apache Aries JPA 2.x. NB: this feature doesn't provide the JPA engine, you have to install one by yourself (OpenJPA for instance)
Feature has no configuration
Feature has no configuration files
Feature has no dependencies.
Feature contains followed bundles:
  mvn:org.eclipse.persistence/javax.persistence/2.1.0
  mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1
  mvn:org.osgi/org.osgi.service.jdbc/1.0.0
  mvn:org.apache.felix/org.apache.felix.coordinator/1.0.2 start-level=30
  mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/2.6.1 start-level=30
  mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/2.6.1 start-level=30
  mvn:org.apache.aries.jpa/org.apache.aries.jpa.support/2.6.1 start-level=30

Best regards,
Alex soto




On May 10, 2018, at 5:45 PM, Tim Ward <[hidden email]> wrote:

OpenJPA 2.4.x supports JPA 2.0 (not 2.1) you can get the API you need from Apache Aries, as well as the JPA container. This is also all used and tested with Aries Transaction Control, so you can look at the bundles used there.

Best Regards,

Tim

Sent from my iPhone

On 10 May 2018, at 20:43, Jean-Baptiste Onofré <[hidden email]> wrote:

Anyway, let me check if OpenJPA 2.4.2 supports JPA 2.1 (it's what I thought).

Regards
JB

On 05/10/2018 09:36 PM, Alex Soto wrote:
I am sorry I only see one version:

karaf@root()> feature:list | grep jpa
openjpa                                  │ 2.4.2            │          │
Started     │ enterprise-4.2.0                  │ Apache OpenJPA 2.4.x
persistence engine support
camel-jpa                                │ 2.21.1           │       
 │ Uninstalled │ camel-2.21.1                      │
deltaspike-jpa                           │ 1.4.2            │       
 │ Uninstalled │ org.ops4j.pax.cdi-1.0.0.RC2       │ Apache Deltaspike jpa support
deltaspike-jpa                           │ 1.8.1            │       
 │ Uninstalled │ org.ops4j.pax.cdi-1.0.0           │ Apache Deltaspike jpa support
jpa                                      │ 2.6.1            │          │
Started     │ aries-jpa-2.6.1                   │ OSGi Persistence Container



Is there a repository I need to add?  

Best regards,
Alex soto



On May 10, 2018, at 3:25 PM, Jean-Baptiste Onofré <[hidden email]
<[hidden email]>> wrote:

Karaf provides both jpa 1.x and  2.x feature.

You just have to  install the right one depending of the engine you are using:

feature:install jpa/1.x
feature:install  openjpa

Regards
JB

On 05/10/2018 09:23 PM, Alex Soto wrote:
Thanks JB,

I was hoping to use whatever was defined in the Karaf’s enterprise feature,
but if that doesn’t work ,then which version do I need?  I am afraid if I
deviate from the versions selected by Kara’s Enterprise feature I will get
into more version mismatch problems.   Also what do I put in my POM for
javax.persistence dependency?


Best regards,
Alex soto



On May 10, 2018, at 3:16 PM, Jean-Baptiste Onofré <[hidden email]
<[hidden email]>> wrote:

Hi,

OpenJPA 2.x still uses JPA 1.x. By default, jpa feature will provide 2.x
version.

You should specify the jpa feature version.

Regards
JB

On 05/10/2018 09:08 PM, Alex Soto wrote:
Hello,

I am running Karaf 4.2.0, trying to setup a project with OpenJPA.  I am getting
error:


14:44:07.799 ERROR [FelixDispatchQueue] FrameworkEvent ERROR
- org.apache.aries.jpa.container
java.lang.ClassCastException:
org.apache.openjpa.persistence.PersistenceProviderImpl
cannot be cast to javax.persistence.spi.PersistenceProvider
at
org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:84)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:44)
~[?:?]
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.apache.aries.jpa.container.impl.PersistenceBundleTracker.trackProvider(PersistenceBundleTracker.java:103)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTracker.findPersistenceUnits(PersistenceBundleTracker.java:87)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:66)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:39)
~[?:?]
at
org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:469)
~[?:?]
at
org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:415)
~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
~[?:?]
at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229) ~[?:?]
at
org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444)
~[?:?]
at
org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915)
~[?:?]
at
org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
~[?:?]
at
org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516)
~[?:?]
at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579) ~[?:?]
at org.apache.felix.framework.Felix.startBundle(Felix.java:2174) ~[?:?]
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1373) ~[?:?]
at
org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
~[?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]



This looks like version mismatch.  I am loading the following packages in my
feature:

<feature>aries-blueprint</feature>
<feature>war</feature>
<feature>camel-core</feature>
<feature>camel-servlet</feature>
<feature>camel-blueprint</feature>
<feature>camel-jackson</feature>
<feature>jndi</feature>
<feature>jdbc</feature>
<feature>transaction</feature>
<feature>jpa</feature>
<feature>openjpa</feature>
<feature>pax-jdbc-mariadb</feature>
      <feature>pax-jdbc-config</feature>


One thing I don’t know if is correct is the javax.persistence dependency in
my POM:

<dependency>
          <groupId>org.eclipse.persistence</groupId>
          <artifactId>javax.persistence</artifactId>
          <version>2.0.5</version>
          <scope>provided</scope>
      </dependency>

Any hints?

Best regards,
Alex soto




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


-- 
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: OpenJPA with AriesJPA Java.peristence

Alex Soto
That was it, I just tested without  the "jdbc/“ prefix and it came up!
Thanks for all the help.  Hopefully this thread can help somebody else in the future.

Best regards,
Alex soto




On May 11, 2018, at 4:30 PM, Tim Ward <[hidden email]> wrote:

Yes, it looks like your jta-datasource-name is wrong. The name is set to responder, not jdbc/responder, so I’m pretty sure that the filter in your JNDI name won’t match. 

Tim

Sent from my iPhone

On 11 May 2018, at 21:07, Alex Soto <[hidden email]> wrote:

Thank you Tim, I appreciate the help.
Yes, an EntityManagerFactoryBuilder is registered as a service by my bundle:

karaf@root()> service:list org.osgi.service.jpa.EntityManagerFactoryBuilder
[org.osgi.service.jpa.EntityManagerFactoryBuilder]
--------------------------------------------------
 osgi.unit.name = responderPersistenUnit
 osgi.unit.provider = org.apache.openjpa.persistence.PersistenceProviderImpl
 osgi.unit.version = 1.0.0.SNAPSHOT
 service.bundleid = 138
 service.id = 198
 service.scope = singleton

DataSource is also registered:

karaf@root()> service:list javax.sql.DataSource
[javax.sql.DataSource]
----------------------
 dataSourceName = responder
 felix.fileinstall.filename = file:xxxxx/org.ops4j.datasource-responder.cfg
 osgi.jdbc.driver.name = mariadb
 osgi.jndi.service.name = responder

karaf@root()> ds-list 
Name      │ Product │ Version         │ URL                                                                                         │ Status
──────────┼─────────┼─────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────┼───────
responder │ MySQL   │ 10.2.13-MariaDB │ jdbc:<a href="mariadb://xxxx:3306/responder?characterEncoding=UTF-" class="">mariadb://xxxx:3306/responder?characterEncoding=UTF-8&useServerPrepStmts=true │ OK


Jndi shows:

karaf@root()> jndi:names 
JNDI Name              │ Class Name
───────────────────────┼───────────────────────────────────────────────
osgi:service/responder │ org.mariadb.jdbc.MySQLDataSource
osgi:service/jndi      │ org.apache.karaf.jndi.internal.JndiServiceImpl

My Persistence Unit is defined as:

<persistence-unit name="responderPersistenUnit" transaction-type="JTA">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/responder)</jta-data-source>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<class>org.enquery.encryptedquery.responder.data.User</class>
<properties>
<property name="openjpa.Log" value="DefaultLevel=DEBUG, Tool=INFO" />
</properties>
</persistence-unit>


I am thinking if the “jta-data-source” property is wrong?


Best regards,
Alex soto




On May 11, 2018, at 3:48 PM, Tim Ward <[hidden email]> wrote:

Hi Alex,

So the logs you’ve sent indicate that your persistence bundle is being found, and that it’s being matched with OpenJPA. These are both good things. 

The next step in the process is to locate and set up the connections to the database. Depending on how you’re setting up your persistence.xml this can happen automatically, but more normally it requires configuration and/or use of the EntityManagerFactoryBuilder service. 

Things to check are that:

• you do see and EntityManagerFactoryBuilder service
• you’re deploying a valid database driver supporting the JDBC service
• your database url and driver class match the driver you’re deploying 
• you’re using the correct pid/unit.name

I hope this helps.

Tim

Sent from my iPhone

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

What is strange is that (based on the logs) it seems as if the persistence unit is being discovered: 

14:50:44.050 INFO [features-3-thread-1] Found persistence unit responderPersistenUnit in bundle org.enquery.encryptedquery.responder-data-jpa-entity-manager with provider org.apache.openjpa.persistence.PersistenceProviderImpl.
14:50:44.052 INFO [features-3-thread-1] Found provider for responderPersistenUnit org.apache.openjpa.persistence.PersistenceProviderImpl
14:50:44.142 INFO [features-3-thread-1] Adding transformer org.apache.openjpa.persistence.PersistenceProviderImpl$ClassTransformerImpl


But the  javax.persistence.EntityManager service is not being registered, and there is no errors.


On May 11, 2018, at 2:19 PM, Alex Soto <[hidden email]> wrote:

Ok, I made some progress (I guess) I am no longer getting the original error:  java.lang.ClassCastException: org.apache.openjpa.persistence.PersistenceProviderImpl cannot be cast to javax.persistence.spi.PersistenceProvider


I added my own version of the jpa feature, in which I substitute the line

        <bundle dependency="true">mvn:org.eclipse.persistence/javax.persistence/2.1.0</bundle>


With:
        <bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>

Which results in:

<feature name="aries-jpa2”>
     <capability>
            osgi.service;effective:=active;objectClass=javax.persistence.spi.PersistenceProvider
        </capability>
        
<bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-jpa_2.0_spec/1.1</bundle>
        <bundle dependency="true">mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
        <bundle dependency="true">mvn:org.osgi/org.osgi.service.jdbc/1.0.0</bundle>
        <bundle dependency="true" start-level="30">mvn:org.apache.felix/org.apache.felix.coordinator/1.0.2</bundle>
        <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/${aries.jpa.version}</bundle>
        <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/${aries.jpa.version}</bundle>
        <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.support/${aries.jpa.version}</bundle>
        <conditional>
            <condition>aries-blueprint</condition>
            <bundle start-level="30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.blueprint/${aries.jpa.version}</bundle>
        </conditional>
</feature>



Now, in my own feature, I have:

<feature>aries-blueprint</feature>
  <feature>jndi</feature>
<feature>jdbc</feature>
<feature>transaction</feature>
<feature>aries-jpa2</feature>
<feature>openjpa</feature>
<feature>pax-jdbc-mariadb</feature>
        <feature>pax-jdbc-config</feature>

Among others.  Now my bundle fails to start:

Status: GracePeriod
Declarative Services
Blueprint
5/11/18 2:14 PM
Missing dependencies: 
(&(osgi.unit.name=responderPersistenUnit)(objectClass=javax.persistence.EntityManager)) 

There are no errors in the log, just this unresolved dependency.
Any idea about why my persistent unit is not being registered?

Best regards,
Alex soto




On May 11, 2018, at 11:09 AM, Tim Ward <[hidden email]> wrote:



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

Thanks for the help Tim.

On May 11, 2018, at 10:24 AM, Tim Ward <[hidden email]> wrote:

Aries JPA can work with either JPA 2.0, or JPA 2.1, and is tested with EclipseLink, Hibernate and OpenJPA. 

I am looking at these integration tests, but the test itself does not uses the feature, as defined in the feature.xml file.  It loads a different version of javax.persistence for the OpenJPA integration test. So unless you are an AriesJPA developer, you would not know about this.  How would anybody figure this out? 

@Configuration
    public Option[] configuration() {
        return new Option[] {
            baseOptions(), //
            ariesJpa20(), //
            jta11Bundles(), // Openjpa currently does not work with jta 1.2. See https://issues.apache.org/jira/browse/OPENJPA-2607
            openJpa(), //
            derbyDSF(), //
            testBundle()
        };

Then the example does not use OpenJPA, but Hibernate, so there is no information on how to make it work with OpenJPA out of the box.  
One option here would be to have multiple specific features: jpa-hibernate, jpa-openjpa, etc.

Yes, that’s pretty much what is needed, but Karaf would be the place to create and maintain those features.



It is highly recommended that you use the JavaJPA contract in any of your bundles using JPA so that you are isolated from the API version number changes in the future (most Java EE specifications make major version bumps quite regularly).


I have this in my bundle’s osgi.bnd file:

-contract: JavaJPA

Is that all that is needed?  It does not indicate version.

That is most of what is needed - you also need to be compiling against a library which offers the contract (for example the spec bundles provided by Aries). If you do that you will end up with Import-Package statements for javax.persistence (et al) with no version, but also a Require-Capability: osgi.contract;filter:=(&(osgi.contract=JavaJPA)(version=XXX)) where the XXX is determined from the Provide-Capability of the bundle you compiled against.


The real problem is that the AriesJPA feature shouldn’t exist as a standalone thing (it doesn’t make sense to deploy it on its own). It should come for free when you install the OpenJPA (or Hibernate, or EclipseLink) feature, using whichever API they have deployed.

Exactly, this is harder than it should be.  When I install a feature, I expect the feature to bring in all that is needed, not having to chase down all these dependencies.
Is there an intention to take this approach any time soon?

I’m afraid that would be a decision for the Karaf maintainers rather than me. I’m only chipping in because I’m an Aries PMC member who deals quite a bit with the JPA and Tx Control components.

Best Regards,

Tim Ward






Tim


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

I had accidentally replied directly to Tim.  Repeating here:

Let me see if I understand this correctly:

Karaf version 4.2.0 enterprise repository depends on version 2.6.1 of AriesJPA.
AriesJPA version 2.6.1 depends on  javax.persistence version 2.1.0.
Karaf’s enterprise repository defines a openjpa feature that depends on OpenJPA version 2.4.2.
OpenJPA version 2.4.2 depends on javax.persistence version 2.0.0.
 
Is this correct?
Is there is a bug in the Enterprise repository mixing incompatible versions of OpenJPA and AriesJPA?
Is the problem in OpenJPA not declaring the version it depends on?

Inspecting in Karaf’s console:

karaf@root()> list

 97 │ Active  │  80 │ 2.4.2               │ OpenJPA Aggregate Ja

karaf@root()> bundle:requirements 97

osgi.wiring.package; (&(osgi.wiring.package=javax.persistence)(version>=1.1.0)(!(version>=2.1.0))) resolved by:
   osgi.wiring.package; javax.persistence 2.0.0 from org.apache.geronimo.specs.geronimo-jpa_2.0_spec [66]


karaf@root()> feature:info jpa
Feature jpa 2.6.1
Description:
  OSGi Persistence Container
Details:
  JPA implementation provided by Apache Aries JPA 2.x. NB: this feature doesn't provide the JPA engine, you have to install one by yourself (OpenJPA for instance)
Feature has no configuration
Feature has no configuration files
Feature has no dependencies.
Feature contains followed bundles:
  mvn:org.eclipse.persistence/javax.persistence/2.1.0
  mvn:org.apache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1
  mvn:org.osgi/org.osgi.service.jdbc/1.0.0
  mvn:org.apache.felix/org.apache.felix.coordinator/1.0.2 start-level=30
  mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/2.6.1 start-level=30
  mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/2.6.1 start-level=30
  mvn:org.apache.aries.jpa/org.apache.aries.jpa.support/2.6.1 start-level=30

Best regards,
Alex soto




On May 10, 2018, at 5:45 PM, Tim Ward <[hidden email]> wrote:

OpenJPA 2.4.x supports JPA 2.0 (not 2.1) you can get the API you need from Apache Aries, as well as the JPA container. This is also all used and tested with Aries Transaction Control, so you can look at the bundles used there.

Best Regards,

Tim

Sent from my iPhone

On 10 May 2018, at 20:43, Jean-Baptiste Onofré <[hidden email]> wrote:

Anyway, let me check if OpenJPA 2.4.2 supports JPA 2.1 (it's what I thought).

Regards
JB

On 05/10/2018 09:36 PM, Alex Soto wrote:
I am sorry I only see one version:

karaf@root()> feature:list | grep jpa
openjpa                                  │ 2.4.2            │          │
Started     │ enterprise-4.2.0                  │ Apache OpenJPA 2.4.x
persistence engine support
camel-jpa                                │ 2.21.1           │       
 │ Uninstalled │ camel-2.21.1                      │
deltaspike-jpa                           │ 1.4.2            │       
 │ Uninstalled │ org.ops4j.pax.cdi-1.0.0.RC2       │ Apache Deltaspike jpa support
deltaspike-jpa                           │ 1.8.1            │       
 │ Uninstalled │ org.ops4j.pax.cdi-1.0.0           │ Apache Deltaspike jpa support
jpa                                      │ 2.6.1            │          │
Started     │ aries-jpa-2.6.1                   │ OSGi Persistence Container



Is there a repository I need to add?  

Best regards,
Alex soto



On May 10, 2018, at 3:25 PM, Jean-Baptiste Onofré <[hidden email]
<[hidden email]>> wrote:

Karaf provides both jpa 1.x and  2.x feature.

You just have to  install the right one depending of the engine you are using:

feature:install jpa/1.x
feature:install  openjpa

Regards
JB

On 05/10/2018 09:23 PM, Alex Soto wrote:
Thanks JB,

I was hoping to use whatever was defined in the Karaf’s enterprise feature,
but if that doesn’t work ,then which version do I need?  I am afraid if I
deviate from the versions selected by Kara’s Enterprise feature I will get
into more version mismatch problems.   Also what do I put in my POM for
javax.persistence dependency?


Best regards,
Alex soto



On May 10, 2018, at 3:16 PM, Jean-Baptiste Onofré <[hidden email]
<[hidden email]>> wrote:

Hi,

OpenJPA 2.x still uses JPA 1.x. By default, jpa feature will provide 2.x
version.

You should specify the jpa feature version.

Regards
JB

On 05/10/2018 09:08 PM, Alex Soto wrote:
Hello,

I am running Karaf 4.2.0, trying to setup a project with OpenJPA.  I am getting
error:


14:44:07.799 ERROR [FelixDispatchQueue] FrameworkEvent ERROR
- org.apache.aries.jpa.container
java.lang.ClassCastException:
org.apache.openjpa.persistence.PersistenceProviderImpl
cannot be cast to javax.persistence.spi.PersistenceProvider
at
org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:84)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:44)
~[?:?]
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.apache.aries.jpa.container.impl.PersistenceBundleTracker.trackProvider(PersistenceBundleTracker.java:103)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTracker.findPersistenceUnits(PersistenceBundleTracker.java:87)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:66)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTracker.addingBundle(PersistenceBundleTracker.java:39)
~[?:?]
at
org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:469)
~[?:?]
at
org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:415)
~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
~[?:?]
at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229) ~[?:?]
at
org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444)
~[?:?]
at
org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915)
~[?:?]
at
org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
~[?:?]
at
org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516)
~[?:?]
at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579) ~[?:?]
at org.apache.felix.framework.Felix.startBundle(Felix.java:2174) ~[?:?]
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1373) ~[?:?]
at
org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
~[?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]



This looks like version mismatch.  I am loading the following packages in my
feature:

<feature>aries-blueprint</feature>
<feature>war</feature>
<feature>camel-core</feature>
<feature>camel-servlet</feature>
<feature>camel-blueprint</feature>
<feature>camel-jackson</feature>
<feature>jndi</feature>
<feature>jdbc</feature>
<feature>transaction</feature>
<feature>jpa</feature>
<feature>openjpa</feature>
<feature>pax-jdbc-mariadb</feature>
      <feature>pax-jdbc-config</feature>


One thing I don’t know if is correct is the javax.persistence dependency in
my POM:

<dependency>
          <groupId>org.eclipse.persistence</groupId>
          <artifactId>javax.persistence</artifactId>
          <version>2.0.5</version>
          <scope>provided</scope>
      </dependency>

Any hints?

Best regards,
Alex soto




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


-- 
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