From user-return-18529-archive-asf-public=cust-asf.ponee.io@karaf.apache.org Fri May 11 16:53:33 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 0F00E180647 for ; Fri, 11 May 2018 16:53:31 +0200 (CEST) Received: (qmail 37511 invoked by uid 500); 11 May 2018 14:53:31 -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 37499 invoked by uid 99); 11 May 2018 14:53:30 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 May 2018 14:53:30 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 729A01807FD for ; Fri, 11 May 2018 14:53:30 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.981 X-Spam-Level: * X-Spam-Status: No, score=1.981 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, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=envieta-com.20150623.gappssmtp.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id fqZBEY74xP3R for ; Fri, 11 May 2018 14:53:25 +0000 (UTC) Received: from mail-qt0-f195.google.com (mail-qt0-f195.google.com [209.85.216.195]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 82E985FB54 for ; Fri, 11 May 2018 14:53:25 +0000 (UTC) Received: by mail-qt0-f195.google.com with SMTP id f5-v6so7400833qth.2 for ; Fri, 11 May 2018 07:53:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=envieta-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=YoHRcoMI4Zq9pti0G9BNUiicmH7FxJbABAe2WUtzJ3g=; b=DPir3cltQqPjDL/pKDt6Y3mq6xxDkfAlstuFZxBo0XuxLxx3iBOuRdLjii2EZ+vVaK y73WwKoAebgf5yZ2UEzhBDuFJok13M9+6iIFOumGcMLsRbCsUerAod8Gmhm1C2oVjTzD +JI/Jr+ntzJdNwqcmiXP9xpL6m5WB45lIyYd66vx3xDI48/chY8AQuanSNbp5k9ZTRro jDWhC1PxuN/bwVc8dtMu/fCZv9usUxttOjxRxCicSnQAwC/YkBIfAHLPgJMd4XdFm/Lu hYAF/hYRMYV/CvuMM0hdCh5Tg2kAfKEaKt6oSPMgfFJNjsXySemMSSs6jxBJKjjSaOy7 WA4A== 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=YoHRcoMI4Zq9pti0G9BNUiicmH7FxJbABAe2WUtzJ3g=; b=QcmCYO8CI39+p22BprCtyS0geEkjwtrIdFF8NpjDx0dvgzNI7nvupifVt8O5jxzoNV 1KQR6QvWcead4nXif0dZvJuEFjCHAFd+ngVqrtFcrn9X8qPiFh2IckUJAGOpu2JjFl+M dqp7wNgpNBIZIO5e5c4k75lOfCzPqKrJX/XJbqZWiyw/LRdF5fSOLOEMrSB4I3UgVIPq Vgu5Fn+L1AWUXUiy7OUJaMGtSwe+OnpQnhzEqrfkQsTJVJ3qvPX908lX448BFa5sXFJv m0dRJUKw4oNkBfwr1VljN6vZdsgeGKgMyvP73fKlboXzOv3rSLnSO+O+5nPIUrdGYbIo vGMA== X-Gm-Message-State: ALKqPweG6b6vN5S0JEgnz6rWp1Y3+XW3mRwvZ+WdT7SrlI3DKsaE4ohn 5oADwAu8EkohDlZvJ0L41MdMXw== X-Google-Smtp-Source: AB8JxZoHSw7KsxVwDhxQROM81xJCPZk6YbM9TXvqySXl2ADZHM/gCRxAXczhdzMFk8qbA/41rd8dPA== X-Received: by 2002:a0c:b4a2:: with SMTP id c34-v6mr5501434qve.70.1526050405064; Fri, 11 May 2018 07:53:25 -0700 (PDT) Received: from [10.0.0.239] (pool-71-121-235-201.bltmmd.fios.verizon.net. [71.121.235.201]) by smtp.gmail.com with ESMTPSA id z15-v6sm2386301qti.93.2018.05.11.07.53.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 May 2018 07:53:24 -0700 (PDT) From: Alex Soto Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_B3CE7D69-CA95-4C24-A646-3C3FBFFF0DE3" 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 10:53:23 -0400 In-Reply-To: Cc: user@karaf.apache.org To: Tim Ward 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=_B3CE7D69-CA95-4C24-A646-3C3FBFFF0DE3 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Thanks for the help Tim. > On May 11, 2018, at 10:24 AM, Tim Ward wrote: >=20 > Aries JPA can work with either JPA 2.0, or JPA 2.1, and is tested with = EclipseLink, Hibernate and OpenJPA.=20 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?=20 @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. =20 One option here would be to have multiple specific features: = jpa-hibernate, jpa-openjpa, etc. >=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). >=20 I have this in my bundle=E2=80=99s 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=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. 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? >=20 > Tim >=20 >=20 >> 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 >=20 --Apple-Mail=_B3CE7D69-CA95-4C24-A646-3C3FBFFF0DE3 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
Thanks for the help Tim.

On May 11, 2018, at 10:24 AM, Tim Ward <tim.ward@paremus.com> 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=E2=80=99s 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=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.

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 <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=_B3CE7D69-CA95-4C24-A646-3C3FBFFF0DE3--