karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Baptiste Onofré ...@nanthrax.net>
Subject Re: OpenJPA with AriesJPA Java.peristence
Date Thu, 10 May 2018 19:25:31 GMT
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> 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
>> 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