From user-return-18528-archive-asf-public=cust-asf.ponee.io@karaf.apache.org Fri May 11 16:24:23 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 9793F180647 for ; Fri, 11 May 2018 16:24:22 +0200 (CEST) Received: (qmail 52084 invoked by uid 500); 11 May 2018 14:24:21 -0000 Mailing-List: contact user-help@karaf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@karaf.apache.org Delivered-To: mailing list user@karaf.apache.org Received: (qmail 52074 invoked by uid 99); 11 May 2018 14:24:21 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 May 2018 14:24:21 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 07E3DC84B3 for ; Fri, 11 May 2018 14:24:21 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.97 X-Spam-Level: * X-Spam-Status: No, score=1.97 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001, T_DKIMWL_WL_MED=-0.01, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=paremus-com.20150623.gappssmtp.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id wZGfcrm8OMhf for ; Fri, 11 May 2018 14:24:19 +0000 (UTC) Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id A70665FAE6 for ; Fri, 11 May 2018 14:24:18 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id a137-v6so3105479wme.1 for ; Fri, 11 May 2018 07:24:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paremus-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=ZyE70C35VlurXtvOrAzXpAGSw529GlLEXTihausQzPw=; b=eKyUbXVTdpPkWuyVXMIUmwyzrDgmOdiRmF1CGU0xsaj4jxHLmIo5P+86f8IkSFesaV n1QdMUOxt9oMa+B48J9Wo54Q+Em3ysUp4c9hO+Q0C1o8bz7sWbVTDNJ173Qt4ny/1flr tglsWEu+4lwPKtB+ucpbgOF6NamB4fuPYFQVf4sLAAhW0r9ogPvKgeNFwSuU4d6oGrnA A+lIu6bQX8znlNuh3z1j7hRTAn5jk0/nfEddVn2MABJZk7TiNqs+m5Qm6cANVxuGRzAV U18PlM5vn68aZvYLjCZ1LvAIHOc6+7UY/7GLGD0YEyDNU27D/ht2fnGepQz0SYAj3Q2c 6BWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=ZyE70C35VlurXtvOrAzXpAGSw529GlLEXTihausQzPw=; b=ECyQQK+xxenseAS6fmYVV7TSVP4TmAzM1kzKwCUOTrOTP/RAGx+956CR+qBDDoTkZ+ cZ76dEtoMH75TFW3EFXvJQ6fc/YjHVnmYWASs0/REr3P1We18KE77Wjxxz03zKRwSXBG vNYyR0XrDtf4W5wCTxGDSgv9zvEQdhLBzn/VgbtX9CQOffm+t+Rnd+XufTo6f+iZpI7A K2w2ymeXHbyT1pXIeLDdiBR3bLHaRLBqQACZ71rNrucakslRqQ1XY8+YIFq4+QOxLDh4 71JNRFksfvE7e/r7WTQq6ISc9RJtn82s6kKV1S1RhUV7qnWtAdExSqHL9c+O5G1taoIq Orqg== X-Gm-Message-State: ALKqPwdwId121TsfdBlw0q7SEoAYzdHCluU9TWmpmmFV3Gv+wyxwqLuq aveNVtr4HpMh1wC+5Pdcf23boz5s7bw= X-Google-Smtp-Source: AB8JxZpj8IRya3ZHxAGkuG48lScLTHmDjt2awkibNLdf6qwDXOweUL1Tsh0DSf6RpI0ZP2i/ZLq5pQ== X-Received: by 2002:a1c:35c7:: with SMTP id c190-v6mr1928076wma.147.1526048657508; Fri, 11 May 2018 07:24:17 -0700 (PDT) Received: from [192.168.1.34] (136.138.6.51.dyn.plus.net. [51.6.138.136]) by smtp.gmail.com with ESMTPSA id g7-v6sm3972456wrb.60.2018.05.11.07.24.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 May 2018 07:24:16 -0700 (PDT) From: Tim Ward Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_05A3F73A-9CFA-4431-B651-5A84F3490E1C" Mime-Version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\)) Subject: Re: OpenJPA with AriesJPA Java.peristence Date: Fri, 11 May 2018 15:24:13 +0100 In-Reply-To: <7EA193CB-29B5-4E6B-B858-3DC17D28A772@envieta.com> Cc: user@karaf.apache.org To: Alex Soto References: <196454C5-ACF2-4390-A4BB-A78DF60BFFA3@envieta.com> <51478dd0-d446-8674-d81a-eae5fe98b03c@nanthrax.net> <2EBDC520-D9F2-4780-A4D6-B52061FADFFC@envieta.com> <3b7aef05-8198-77f1-b590-09ac313faf91@nanthrax.net> <8F5C26F3-D4E5-4965-8C9F-A57C56C64DC1@envieta.com> <4BEF3C8E-A5EF-4F03-A065-378E067BE616@paremus.com> <7EA193CB-29B5-4E6B-B858-3DC17D28A772@envieta.com> X-Mailer: Apple Mail (2.3445.6.18) --Apple-Mail=_05A3F73A-9CFA-4431-B651-5A84F3490E1C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Aries JPA can work with either JPA 2.0, or JPA 2.1, and is tested with = EclipseLink, Hibernate and OpenJPA.=20 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=E2=80=99t exist as = a standalone thing (it doesn=E2=80=99t 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 wrote: >=20 > I had accidentally replied directly to Tim. Repeating here: >=20 > Let me see if I understand this correctly: >=20 > 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=E2=80=99s 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. > =20 > 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? >=20 > Inspecting in Karaf=E2=80=99s console: >=20 > karaf@root()> list >=20 > 97 =E2=94=82 Active =E2=94=82 80 =E2=94=82 2.4.2 =E2=94= =82 OpenJPA Aggregate Ja >=20 > karaf@root()> bundle:requirements 97 >=20 > osgi.wiring.package; = (&(osgi.wiring.package=3Djavax.persistence)(version>=3D1.1.0)(!(version>=3D= 2.1.0))) resolved by: > osgi.wiring.package; javax.persistence 2.0.0 from = org.apache.geronimo.specs.geronimo-jpa_2.0_spec [66] >=20 >=20 > 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=3D30 > mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/2.6.1 = start-level=3D30 > mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/2.6.1 = start-level=3D30 > mvn:org.apache.aries.jpa/org.apache.aries.jpa.support/2.6.1 = start-level=3D30 >=20 > Best regards, > Alex soto >=20 >=20 >=20 >=20 >> On May 10, 2018, at 5:45 PM, Tim Ward > wrote: >>=20 >> 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. >>=20 >> Best Regards, >>=20 >> Tim >>=20 >> Sent from my iPhone >>=20 >>> On 10 May 2018, at 20:43, Jean-Baptiste Onofr=C3=A9 > wrote: >>>=20 >>> Anyway, let me check if OpenJPA 2.4.2 supports JPA 2.1 (it's what I = thought). >>>=20 >>> Regards >>> JB >>>=20 >>>> On 05/10/2018 09:36 PM, Alex Soto wrote: >>>> I am sorry I only see one version: >>>>=20 >>>> karaf@root()> feature:list | grep jpa >>>> openjpa =E2=94=82 2.4.2 = =E2=94=82 =E2=94=82 >>>> Started =E2=94=82 enterprise-4.2.0 =E2=94=82 = Apache OpenJPA 2.4.x >>>> persistence engine support >>>> camel-jpa =E2=94=82 2.21.1 = =E2=94=82 =20 >>>> =E2=94=82 Uninstalled =E2=94=82 camel-2.21.1 = =E2=94=82 >>>> deltaspike-jpa =E2=94=82 1.4.2 = =E2=94=82 =20 >>>> =E2=94=82 Uninstalled =E2=94=82 org.ops4j.pax.cdi-1.0.0.RC2 = =E2=94=82 Apache Deltaspike jpa support >>>> deltaspike-jpa =E2=94=82 1.8.1 = =E2=94=82 =20 >>>> =E2=94=82 Uninstalled =E2=94=82 org.ops4j.pax.cdi-1.0.0 = =E2=94=82 Apache Deltaspike jpa support >>>> jpa =E2=94=82 2.6.1 = =E2=94=82 =E2=94=82 >>>> Started =E2=94=82 aries-jpa-2.6.1 =E2=94=82 = OSGi Persistence Container >>>>=20 >>>>=20 >>>>=20 >>>> Is there a repository I need to add? =20 >>>>=20 >>>> Best regards, >>>> Alex soto >>>>=20 >>>>=20 >>>>=20 >>>>> On May 10, 2018, at 3:25 PM, Jean-Baptiste Onofr=C3=A9 = >>>>> >> wrote: >>>>>=20 >>>>> Karaf provides both jpa 1.x and 2.x feature. >>>>>=20 >>>>> You just have to install the right one depending of the engine = you are using: >>>>>=20 >>>>> feature:install jpa/1.x >>>>> feature:install openjpa >>>>>=20 >>>>> Regards >>>>> JB >>>>>=20 >>>>>> On 05/10/2018 09:23 PM, Alex Soto wrote: >>>>>> Thanks JB, >>>>>>=20 >>>>>> I was hoping to use whatever was defined in the Karaf=E2=80=99s = enterprise feature, >>>>>> but if that doesn=E2=80=99t work ,then which version do I need? = I am afraid if I >>>>>> deviate from the versions selected by Kara=E2=80=99s Enterprise = feature I will get >>>>>> into more version mismatch problems. Also what do I put in my = POM for >>>>>> javax.persistence dependency? >>>>>>=20 >>>>>>=20 >>>>>> Best regards, >>>>>> Alex soto >>>>>>=20 >>>>>>=20 >>>>>>=20 >>>>>>> On May 10, 2018, at 3:16 PM, Jean-Baptiste Onofr=C3=A9 = >>>>>>> >> wrote: >>>>>>>=20 >>>>>>> Hi, >>>>>>>=20 >>>>>>> OpenJPA 2.x still uses JPA 1.x. By default, jpa feature will = provide 2.x >>>>>>> version. >>>>>>>=20 >>>>>>> You should specify the jpa feature version. >>>>>>>=20 >>>>>>> Regards >>>>>>> JB >>>>>>>=20 >>>>>>>> On 05/10/2018 09:08 PM, Alex Soto wrote: >>>>>>>> Hello, >>>>>>>>=20 >>>>>>>> I am running Karaf 4.2.0, trying to setup a project with = OpenJPA. I am getting >>>>>>>> error: >>>>>>>>=20 >>>>>>>>=20 >>>>>>>> 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.addingServi= ce(PersistenceProviderTracker.java:84) >>>>>>>> ~[?:?] >>>>>>>> at >>>>>>>> = org.apache.aries.jpa.container.impl.PersistenceProviderTracker.addingServi= ce(PersistenceProviderTracker.java:44) >>>>>>>> ~[?:?] >>>>>>>> at >>>>>>>> = org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTrack= er.java:941) >>>>>>>> ~[?:?] >>>>>>>> at >>>>>>>> = org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTrack= er.java:870) >>>>>>>> ~[?:?] >>>>>>>> at = org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256= ) >>>>>>>> ~[?:?] >>>>>>>> at = org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:18= 3) >>>>>>>> ~[?:?] >>>>>>>> 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.findPersisten= ceUnits(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.ja= va:444) >>>>>>>> ~[?:?] >>>>>>>> at >>>>>>>> = org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(Ev= entDispatcher.java:915) >>>>>>>> ~[?:?] >>>>>>>> at >>>>>>>> = org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispa= tcher.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(FrameworkStartLevel= Impl.java:308) >>>>>>>> ~[?:?] >>>>>>>> at java.lang.Thread.run(Thread.java:748) [?:?] >>>>>>>>=20 >>>>>>>>=20 >>>>>>>>=20 >>>>>>>> This looks like version mismatch. I am loading the following = packages in my >>>>>>>> feature: >>>>>>>>=20 >>>>>>>> aries-blueprint >>>>>>>> war >>>>>>>> camel-core >>>>>>>> camel-servlet >>>>>>>> camel-blueprint >>>>>>>> camel-jackson >>>>>>>> jndi >>>>>>>> jdbc >>>>>>>> transaction >>>>>>>> jpa >>>>>>>> openjpa >>>>>>>> pax-jdbc-mariadb >>>>>>>> pax-jdbc-config >>>>>>>>=20 >>>>>>>>=20 >>>>>>>> One thing I don=E2=80=99t know if is correct is the = javax.persistence dependency in >>>>>>>> my POM: >>>>>>>>=20 >>>>>>>> >>>>>>>> org.eclipse.persistence >>>>>>>> javax.persistence >>>>>>>> 2.0.5 >>>>>>>> provided >>>>>>>> >>>>>>>>=20 >>>>>>>> Any hints? >>>>>>>>=20 >>>>>>>> Best regards, >>>>>>>> Alex soto >>>>>>>>=20 >>>>>>>>=20 >>>>>>>>=20 >>>>>>>=20 >>>>>>> --=20 >>>>>>> Jean-Baptiste Onofr=C3=A9 >>>>>>> jbonofre@apache.org = > >>>>>>> http://blog.nanthrax.net >>>>>>> Talend - http://www.talend.com >>>>>>=20 >>>>>=20 >>>>> --=20 >>>>> Jean-Baptiste Onofr=C3=A9 >>>>> jbonofre@apache.org = > >>>>> http://blog.nanthrax.net >>>>> Talend - http://www.talend.com >>>>=20 >>>=20 >>> --=20 >>> Jean-Baptiste Onofr=C3=A9 >>> jbonofre@apache.org >>> http://blog.nanthrax.net >>> Talend - http://www.talend.com >=20 --Apple-Mail=_05A3F73A-9CFA-4431-B651-5A84F3490E1C Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 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=E2=80=99t exist as a standalone thing (it = doesn=E2=80=99t 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 <alex.soto@envieta.com> 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=E2=80=99s 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=E2=80=99s console:

karaf@root()> list

 97 =E2=94=82 = Active  =E2=94=82  80 =E2=94=82 2.4.2   =             =E2=94=82 OpenJPA = Aggregate Ja

karaf@root()> bundle:requirements 97

osgi.wiring.package; = (&(osgi.wiring.package=3Djavax.persistence)(version>=3D1.1.0)(!(ver= sion>=3D2.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=3D30
  mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/2= .6.1 start-level=3D30
  mvn:org.apache.aries.jpa/org.apache.aries.jpa.conta= iner/2.6.1 start-level=3D30
  mvn:org.apache.aries.jpa/org.apache.aries.jpa.suppo= rt/2.6.1 start-level=3D30

Best = regards,
Alex soto




On May 10, 2018, at 5:45 PM, Tim Ward <tim.ward@paremus.com> 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=C3=A9 <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 =             &n= bsp;           &nbs= p;        =E2=94=82 2.4.2 =            =E2=94=82=          =E2=94=82
Started     =E2=94=82 enterprise-4.2.0 =             &n= bsp;    =E2=94=82 Apache OpenJPA 2.4.x
persistence engine support
camel-jpa =             &n= bsp;           &nbs= p;      =E2=94=82 2.21.1 =           =E2=94=82 =       
 =E2=94=82 = Uninstalled =E2=94=82 camel-2.21.1 =             &n= bsp;        =E2=94=82
deltaspike-jpa =             &n= bsp;           &nbs= p; =E2=94=82 1.4.2 =            =E2=94=82=       
 =E2=94=82 = Uninstalled =E2=94=82 org.ops4j.pax.cdi-1.0.0.RC2 =       =E2=94=82 Apache Deltaspike jpa = support
deltaspike-jpa =             &n= bsp;           &nbs= p; =E2=94=82 1.8.1 =            =E2=94=82=       
 =E2=94=82 = Uninstalled =E2=94=82 org.ops4j.pax.cdi-1.0.0 =           =E2=94=82 = Apache Deltaspike jpa support
jpa =             &n= bsp;           &nbs= p;            = =E2=94=82 2.6.1 =            =E2=94=82=          =E2=94=82
Started     =E2=94=82 aries-jpa-2.6.1 =             &n= bsp;     =E2=94=82 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=C3=A9 <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=E2=80=99s enterprise feature,
but if that = doesn=E2=80=99t work ,then which version do I need?  I am afraid if = I
deviate from the versions selected by Kara=E2=80=99s = 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=C3=A9 <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(S= erviceTracker.java:941)
~[?:?]
at
org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(S= erviceTracker.java:870)
~[?:?]
at = org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256= )
~[?:?]
at = org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:18= 3)
~[?:?]
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.tr= ackProvider(PersistenceBundleTracker.java:103)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTracker.fi= ndPersistenceUnits(PersistenceBundleTracker.java:87)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTracker.ad= dingBundle(PersistenceBundleTracker.java:66)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTracker.ad= dingBundle(PersistenceBundleTracker.java:39)
~[?:?]
at
org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(Bu= ndleTracker.java:469)
~[?:?]
at
org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(Bu= ndleTracker.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(Bundl= eTracker.java:444)
~[?:?]
at
org.apache.felix.framework.EventDispatcher.invokeBundleListener= Callback(EventDispatcher.java:915)
~[?:?]
at
org.apache.felix.framework.EventDispatcher.fireEventImmediately= (EventDispatcher.java:834)
~[?:?]
at
org.apache.felix.framework.EventDispatcher.fireBundleEvent(Even= tDispatcher.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(Framewor= kStartLevelImpl.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</fea= ture>


One thing I don=E2=80= =99t 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>p= rovided</scope>
=       </dependency>

Any hints?

Best regards,
Alex soto




--
Jean-Baptiste = Onofr=C3=A9
jbonofre@apache.org <mailto:jbonofre@apache.org>
http://blog.nanthrax.net
Talend - http://www.talend.com


-- =
Jean-Baptiste Onofr=C3=A9
jbonofre@apache.org = <mailto:jbonofre@apache.org>
http://blog.nanthrax.net
Talend - http://www.talend.com


-- =
Jean-Baptiste Onofr=C3=A9
jbonofre@apache.org
http://blog.nanthrax.net
Talend - = http://www.talend.com


= --Apple-Mail=_05A3F73A-9CFA-4431-B651-5A84F3490E1C--