karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Ward <tim.w...@paremus.com>
Subject Re: OpenJPA with AriesJPA Java.peristence
Date Thu, 10 May 2018 21:45:06 GMT
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é <jb@nanthrax.net> 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é <jb@nanthrax.net
>>> <mailto:jb@nanthrax.net>> 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é <jb@nanthrax.net
>>>>> <mailto:jb@nanthrax.net>> 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é
>>>>> jbonofre@apache.org <mailto:jbonofre@apache.org>
>>>>> http://blog.nanthrax.net
>>>>> Talend - http://www.talend.com
>>>> 
>>> 
>>> -- 
>>> Jean-Baptiste Onofré
>>> jbonofre@apache.org <mailto:jbonofre@apache.org>
>>> http://blog.nanthrax.net
>>> Talend - http://www.talend.com
>> 
> 
> -- 
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com

Mime
View raw message