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é jbono...@apache.org http://blog.nanthrax.net Talend - http://www.talend.com