From user-return-18538-archive-asf-public=cust-asf.ponee.io@karaf.apache.org Fri May 11 22:31:12 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 4B00E18067B for ; Fri, 11 May 2018 22:31:10 +0200 (CEST) Received: (qmail 50996 invoked by uid 500); 11 May 2018 20:31:09 -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 50979 invoked by uid 99); 11 May 2018 20:31:09 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 May 2018 20:31:09 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 8BBA31A24F0 for ; Fri, 11 May 2018 20:31:08 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-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, MIME_QP_LONG_LINE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=paremus-com.20150623.gappssmtp.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id l27hCCjbtg0o for ; Fri, 11 May 2018 20:31:01 +0000 (UTC) Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 72C015F36B for ; Fri, 11 May 2018 20:31:00 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id m129-v6so5272139wmb.3 for ; Fri, 11 May 2018 13:31:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paremus-com.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=l++NBYMS5OwtkTe7qEp3jdW2gcsujJka+nvx/KCFx+8=; b=w07aZQNhbbbmXLHxn3nvIbmqdYe3E8+NctJF3O54SbuEGAJZiJRRBA1N+5vrlEyMC9 pCxrp5SXnOosOk3xVvao+ca7DkcfOGcHczQKKyRjA1loA6XTafciVQQ/iWRzuu9tNCMp x+1xQSeDLZM4exf+RwuCUAdadxC/Of3WkCCr8c5j5ic3YW0WynOz00M4gwbY2R/M0Y6Y +EmR50h+HEXLbaHJE0CRgmvYMN41gYyzo37RSP8wrOMTS14Mwqx6Hi713ZXxT/EIItzf RW9tSorT0TCJeNI+4siXN984ASTEwbsVwTXOIKUrLzgFEoEOGs2nH3mbO0a+vk8e1s9H pPWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=l++NBYMS5OwtkTe7qEp3jdW2gcsujJka+nvx/KCFx+8=; b=g5StjiYwgMBEjJB285VodlghBfSshfMy8la+HNITkSmxINfR0RJdcTPnNkW4NPFLE/ JUtQm8Bxk9SYsdIWiOQTRVAlas+VEb1a++CINmy71RuXHJ5zcLUgSopOodyLNWYuKpTI UoAoUyVSNYd2EO0p/OcwlUNbcFxbUoSybYxI8/ZvG3fD0NG2nDuQMtIaYVoN8gePqUon hLcHOD1n51jC+dPO+LyTbfn7ldv07AtZplHXkaWJpgvtPYcYhFQUP09qX0WuTcKdG8GP XyASsqTLXug9P84RSmKg37AMekn7izRla1mnA7CsMXE25o7RYqaCA85FMiDcxCOfAh3B z+hw== X-Gm-Message-State: ALKqPwcezjDKw0fldhU5Ec4GieiZXWRtCFZYsFIjcDqaW2UqohN7oZWt BJhXHxKNVOurAg90UdaTPulUog== X-Google-Smtp-Source: AB8JxZqU+IQPRR4bTEji4pdT2I/fDgEvCLQabJsMQfUAlqtDS1Nil5FwYt65LqFOPwsuk6aYrlTSnA== X-Received: by 2002:a1c:71c4:: with SMTP id d65-v6mr2618098wmi.157.1526070659872; Fri, 11 May 2018 13:30:59 -0700 (PDT) Received: from [192.168.1.35] (136.138.6.51.dyn.plus.net. [51.6.138.136]) by smtp.gmail.com with ESMTPSA id b105-v6sm5211496wrd.64.2018.05.11.13.30.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 May 2018 13:30:59 -0700 (PDT) Content-Type: multipart/alternative; boundary=Apple-Mail-5CAAFC45-52D6-41B1-BD55-72B7E55293CF Mime-Version: 1.0 (1.0) Subject: Re: OpenJPA with AriesJPA Java.peristence From: Tim Ward X-Mailer: iPhone Mail (15E302) In-Reply-To: Date: Fri, 11 May 2018 21:30:57 +0100 Cc: user@karaf.apache.org Content-Transfer-Encoding: 7bit Message-Id: 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> <1AD6AC5F-F6B1-45C9-BCDC-4997BB7F1EC6@paremus.com> To: Alex Soto --Apple-Mail-5CAAFC45-52D6-41B1-BD55-72B7E55293CF Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Yes, it looks like your jta-datasource-name is wrong. The name is set to res= ponder, not jdbc/responder, so I=E2=80=99m pretty sure that the filter in yo= ur JNDI name won=E2=80=99t match.=20 Tim Sent from my iPhone > On 11 May 2018, at 21:07, Alex Soto wrote: >=20 > Thank you Tim, I appreciate the help. > Yes, an EntityManagerFactoryBuilder is registered as a service by my bundl= e: >=20 > karaf@root()> service:list org.osgi.service.jpa.EntityManagerFactoryBuilde= r > [org.osgi.service.jpa.EntityManagerFactoryBuilder] > -------------------------------------------------- > osgi.unit.name =3D responderPersistenUnit > osgi.unit.provider =3D org.apache.openjpa.persistence.PersistenceProvider= Impl > osgi.unit.version =3D 1.0.0.SNAPSHOT > service.bundleid =3D 138 > service.id =3D 198 > service.scope =3D singleton >=20 > DataSource is also registered: >=20 > karaf@root()> service:list javax.sql.DataSource > [javax.sql.DataSource] > ---------------------- > dataSourceName =3D responder > felix.fileinstall.filename =3D file:xxxxx/org.ops4j.datasource-responder.= cfg > osgi.jdbc.driver.name =3D mariadb > osgi.jndi.service.name =3D responder >=20 > karaf@root()> ds-list=20 > Name =E2=94=82 Product =E2=94=82 Version =E2=94=82 URL = = =E2=94=82 Status > =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80 > responder =E2=94=82 MySQL =E2=94=82 10.2.13-MariaDB =E2=94=82 jdbc:maria= db://xxxx:3306/responder?characterEncoding=3DUTF-8&useServerPrepStmts=3Dtrue= =E2=94=82 OK >=20 >=20 > Jndi shows: >=20 > karaf@root()> jndi:names=20 > JNDI Name =E2=94=82 Class Name > =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80 > osgi:service/responder =E2=94=82 org.mariadb.jdbc.MySQLDataSource > osgi:service/jndi =E2=94=82 org.apache.karaf.jndi.internal.JndiServic= eImpl >=20 > My Persistence Unit is defined as: >=20 > > org.apache.openjpa.persistence.PersistenceProvide= rImpl > osgi:service/javax.sql.DataSource/(osgi.jn= di.service.name=3Djdbc/responder) > true > org.enquery.encryptedquery.responder.data.User > > > > >=20 >=20 > I am thinking if the =E2=80=9Cjta-data-source=E2=80=9D property is wrong? >=20 >=20 > Best regards, > Alex soto >=20 >=20 >=20 >=20 >> On May 11, 2018, at 3:48 PM, Tim Ward wrote: >>=20 >> Hi Alex, >>=20 >> So the logs you=E2=80=99ve sent indicate that your persistence bundle is b= eing found, and that it=E2=80=99s being matched with OpenJPA. These are both= good things.=20 >>=20 >> The next step in the process is to locate and set up the connections to t= he database. Depending on how you=E2=80=99re setting up your persistence.xml= this can happen automatically, but more normally it requires configuration a= nd/or use of the EntityManagerFactoryBuilder service.=20 >>=20 >> Things to check are that: >>=20 >> =E2=80=A2 you do see and EntityManagerFactoryBuilder service >> =E2=80=A2 you=E2=80=99re deploying a valid database driver supporting the= JDBC service >> =E2=80=A2 your database url and driver class match the driver you=E2=80=99= re deploying=20 >> =E2=80=A2 you=E2=80=99re using the correct pid/unit.name >>=20 >> I hope this helps. >>=20 >> Tim >>=20 >> Sent from my iPhone >>=20 >>> On 11 May 2018, at 19:58, Alex Soto wrote: >>>=20 >>> What is strange is that (based on the logs) it seems as if the persisten= ce unit is being discovered:=20 >>>=20 >>> 14:50:44.050 INFO [features-3-thread-1] Found persistence unit responder= PersistenUnit in bundle org.enquery.encryptedquery.responder-data-jpa-entity= -manager with provider org.apache.openjpa.persistence.PersistenceProviderImp= l. >>> 14:50:44.052 INFO [features-3-thread-1] Found provider for responderPers= istenUnit org.apache.openjpa.persistence.PersistenceProviderImpl >>> 14:50:44.142 INFO [features-3-thread-1] Adding transformer org.apache.op= enjpa.persistence.PersistenceProviderImpl$ClassTransformerImpl >>>=20 >>>=20 >>> But the javax.persistence.EntityManager service is not being registered= , and there is no errors. >>>=20 >>>=20 >>>> On May 11, 2018, at 2:19 PM, Alex Soto wrote: >>>>=20 >>>> Ok, I made some progress (I guess) I am no longer getting the original e= rror: java.lang.ClassCastException: org.apache.openjpa.persistence.Persiste= nceProviderImpl cannot be cast to javax.persistence.spi.PersistenceProvider >>>>=20 >>>>=20 >>>> I added my own version of the jpa feature, in which I substitute the li= ne >>>>=20 >>>> mvn:org.eclipse.persistence/javax.p= ersistence/2.1.0 >>>>=20 >>>>=20 >>>> With: >>>> mvn:org.apache.geronimo.specs/geron= imo-jta_1.1_spec/1.1.1 >>>>=20 >>>> Which results in: >>>>=20 >>>> >>>> >>>> osgi.service;effective:=3Dactive;objectClass=3Djavax.persis= tence.spi.PersistenceProvider >>>> >>>> =20 >>>> mvn:org.apache.geronimo.specs/g= eronimo-jpa_2.0_spec/1.1 >>>> mvn:org.apache.geronimo.specs/geron= imo-jta_1.1_spec/1.1.1 >>>> mvn:org.osgi/org.osgi.service.jdbc/= 1.0.0 >>>> mvn:org.apache.f= elix/org.apache.felix.coordinator/1.0.2 >>>> mvn:org.apache.aries.jpa/org.apache.= aries.jpa.api/${aries.jpa.version} >>>> mvn:org.apache.aries.jpa/org.apache.= aries.jpa.container/${aries.jpa.version} >>>> mvn:org.apache.aries.jpa/org.apache.= aries.jpa.support/${aries.jpa.version} >>>> >>>> aries-blueprint >>>> mvn:org.apache.aries.jpa/org.apa= che.aries.jpa.blueprint/${aries.jpa.version} >>>> >>>> >>>>=20 >>>>=20 >>>>=20 >>>> Now, in my own feature, I have: >>>>=20 >>>> aries-blueprint >>>> jndi >>>> jdbc >>>> transaction >>>> aries-jpa2 >>>> openjpa >>>> pax-jdbc-mariadb >>>> pax-jdbc-config >>>>=20 >>>> Among others. Now my bundle fails to start: >>>>=20 >>>> Status: GracePeriod >>>> Declarative Services >>>> Blueprint >>>> 5/11/18 2:14 PM >>>> Missing dependencies:=20 >>>> (&(osgi.unit.name=3DresponderPersistenUnit)(objectClass=3Djavax.persist= ence.EntityManager))=20 >>>>=20 >>>> There are no errors in the log, just this unresolved dependency. >>>> Any idea about why my persistent unit is not being registered? >>>>=20 >>>> Best regards, >>>> Alex soto >>>>=20 >>>>=20 >>>>=20 >>>>=20 >>>>>> On May 11, 2018, at 11:09 AM, Tim Ward wrote: >>>>>>=20 >>>>>>=20 >>>>>>=20 >>>>>>> On 11 May 2018, at 15:53, Alex Soto wrote: >>>>>>>=20 >>>>>>> Thanks for the help Tim. >>>>>>>=20 >>>>>>=20 >>>>>>> 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 wi= th EclipseLink, Hibernate and OpenJPA.=20 >>>>>>=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 yo= u are an AriesJPA developer, you would not know about this. How would anybo= dy figure this out?=20 >>>>>>=20 >>>>>> @Configuration >>>>>> public Option[] configuration() { >>>>>> return new Option[] { >>>>>> baseOptions(), // >>>>>> ariesJpa20(), // >>>>>> jta11Bundles(), // Openjpa currently does not work with j= ta 1.2. See https://issues.apache.org/jira/browse/OPENJPA-2607 >>>>>> openJpa(), // >>>>>> derbyDSF(), // >>>>>> testBundle() >>>>>> }; >>>>>>=20 >>>>>> Then the example does not use OpenJPA, but Hibernate, so there is no i= nformation on how to make it work with OpenJPA out of the box. =20 >>>>>> One option here would be to have multiple specific features: jpa-hibe= rnate, jpa-openjpa, etc. >>>>>=20 >>>>> Yes, that=E2=80=99s pretty much what is needed, but Karaf would be the= place to create and maintain those features. >>>>>=20 >>>>>>=20 >>>>>>>=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 >>>>>>=20 >>>>>> I have this in my bundle=E2=80=99s osgi.bnd file: >>>>>>=20 >>>>>> -contract: JavaJPA >>>>>>=20 >>>>>> Is that all that is needed? It does not indicate version. >>>>>=20 >>>>> That is most of what is needed - you also need to be compiling against= a library which offers the contract (for example the spec bundles provided b= y Aries). If you do that you will end up with Import-Package statements for j= avax.persistence (et al) with no version, but also a Require-Capability: osg= i.contract;filter:=3D(&(osgi.contract=3DJavaJPA)(version=3DXXX)) where the X= XX is determined from the Provide-Capability of the bundle you compiled agai= nst. >>>>>=20 >>>>>>=20 >>>>>>> The real problem is that the AriesJPA feature shouldn=E2=80=99t exis= t as a standalone thing (it doesn=E2=80=99t make sense to deploy it on its o= wn). It should come for free when you install the OpenJPA (or Hibernate, or E= clipseLink) feature, using whichever API they have deployed. >>>>>>=20 >>>>>> 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 do= wn all these dependencies. >>>>>> Is there an intention to take this approach any time soon? >>>>>=20 >>>>> I=E2=80=99m afraid that would be a decision for the Karaf maintainers r= ather than me. I=E2=80=99m only chipping in because I=E2=80=99m an Aries PMC= member who deals quite a bit with the JPA and Tx Control components. >>>>>=20 >>>>> Best Regards, >>>>>=20 >>>>> Tim Ward >>>>>=20 >>>>>>=20 >>>>>>=20 >>>>>>=20 >>>>>>=20 >>>>>>>=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 o= f AriesJPA. >>>>>>>> AriesJPA version 2.6.1 depends on javax.persistence version 2.1.0.= >>>>>>>> Karaf=E2=80=99s enterprise repository defines a openjpa feature tha= t 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 v= ersions 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)(ve= rsion>=3D1.1.0)(!(version>=3D2.1.0))) resolved by: >>>>>>>> osgi.wiring.package; javax.persistence 2.0.0 from org.apache.ger= onimo.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 fea= ture doesn't provide the JPA engine, you have to install one by yourself (Op= enJPA 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-lev= el=3D30 >>>>>>>> mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/2.6.1 start-lev= el=3D30 >>>>>>>> mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/2.6.1 sta= rt-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 n= eed from Apache Aries, as well as the JPA container. This is also all used a= nd tested with Aries Transaction Control, so you can look at the bundles use= d 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=99= s 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 Enterpris= e feature I will get >>>>>>>>>>>>> into more version mismatch problems. Also what do I put in m= y 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 p= rovide 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 Ope= nJPA. 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.PersistenceProviderTrack= er.addingService(PersistenceProviderTracker.java:84) >>>>>>>>>>>>>>> ~[?:?] >>>>>>>>>>>>>>> at >>>>>>>>>>>>>>> org.apache.aries.jpa.container.impl.PersistenceProviderTrack= er.addingService(PersistenceProviderTracker.java:44) >>>>>>>>>>>>>>> ~[?:?] >>>>>>>>>>>>>>> at >>>>>>>>>>>>>>> org.osgi.util.tracker.ServiceTracker$Tracked.customizerAddin= g(ServiceTracker.java:941) >>>>>>>>>>>>>>> ~[?:?] >>>>>>>>>>>>>>> at >>>>>>>>>>>>>>> org.osgi.util.tracker.ServiceTracker$Tracked.customizerAddin= g(ServiceTracker.java:870) >>>>>>>>>>>>>>> ~[?:?] >>>>>>>>>>>>>>> at org.osgi.util.tracker.AbstractTracked.trackAdding(Abstrac= tTracked.java:256) >>>>>>>>>>>>>>> ~[?:?] >>>>>>>>>>>>>>> at org.osgi.util.tracker.AbstractTracked.trackInitial(Abstra= ctTracked.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(Abstrac= tTracked.java:256) >>>>>>>>>>>>>>> ~[?:?] >>>>>>>>>>>>>>> at org.osgi.util.tracker.AbstractTracked.track(AbstractTrack= ed.java:229) ~[?:?] >>>>>>>>>>>>>>> at >>>>>>>>>>>>>>> org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(Bu= ndleTracker.java:444) >>>>>>>>>>>>>>> ~[?:?] >>>>>>>>>>>>>>> at >>>>>>>>>>>>>>> org.apache.felix.framework.EventDispatcher.invokeBundleListe= nerCallback(EventDispatcher.java:915) >>>>>>>>>>>>>>> ~[?:?] >>>>>>>>>>>>>>> at >>>>>>>>>>>>>>> org.apache.felix.framework.EventDispatcher.fireEventImmediat= ely(EventDispatcher.java:834) >>>>>>>>>>>>>>> ~[?:?] >>>>>>>>>>>>>>> at >>>>>>>>>>>>>>> org.apache.felix.framework.EventDispatcher.fireBundleEvent(E= ventDispatcher.java:516) >>>>>>>>>>>>>>> ~[?:?] >>>>>>>>>>>>>>> at org.apache.felix.framework.Felix.fireBundleEvent(Felix.ja= va:4579) ~[?:?] >>>>>>>>>>>>>>> at org.apache.felix.framework.Felix.startBundle(Felix.java:2= 174) ~[?:?] >>>>>>>>>>>>>>> at org.apache.felix.framework.Felix.setActiveStartLevel(Feli= x.java:1373) ~[?:?] >>>>>>>>>>>>>>> at >>>>>>>>>>>>>>> org.apache.felix.framework.FrameworkStartLevelImpl.run(Frame= workStartLevelImpl.java:308) >>>>>>>>>>>>>>> ~[?:?] >>>>>>>>>>>>>>> at java.lang.Thread.run(Thread.java:748) [?:?] >>>>>>>>>>>>>>>=20 >>>>>>>>>>>>>>>=20 >>>>>>>>>>>>>>>=20 >>>>>>>>>>>>>>> This looks like version mismatch. I am loading the followin= g 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.pe= rsistence 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 >=20 --Apple-Mail-5CAAFC45-52D6-41B1-BD55-72B7E55293CF Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable Yes, it looks like your jta-datasource-name= is wrong. The name is set to responder, not jdbc/responder, so I=E2=80=99m p= retty sure that the filter in your JNDI name won=E2=80=99t match. 
=
Tim

Sent from my iPhone=

On 11 May 2018, at 21:07, Alex Soto <alex.soto@envieta.com> wrote:

Thank you Tim, I appre= ciate the help.
Yes, an EntityManagerFactoryBuilder is r= egistered as a service by my bundle:

karaf@root()> service:list org.os= gi.service.jpa.EntityManagerFactoryBuilder
[org.osgi.service.jpa.EntityManagerFactoryBuilder]
--------------------------------------------------
 osgi.unit.name =3D responderPersistenUnit
 osgi.unit.provider =3D org.apache.openjpa.p= ersistence.PersistenceProviderImpl
 = osgi.unit.version =3D 1.0.0.SNAPSHOT
 = ;service.bundleid =3D 138
=  service.id =3D 198
 service.scope =3D singleton

Dat= aSource is also registered:

karaf@root()> = service:list javax.sql.DataSource
[java= x.sql.DataSource]
----------------------
 dataSourceName =3D responder
 felix.fileinstall.filename =3D file:xxxxx/org.ops4j.d= atasource-responder.cfg
 osgi.jdbc.driver= .name =3D mariadb
 osgi.jndi.service.name= =3D responder
<= br class=3D"">
karaf@root()> ds-list&n= bsp;
Name      =E2=94=82= Product =E2=94=82 Version         =E2=94=82 U= RL                    = ;                     &nbs= p;                     &nb= sp;                     &n= bsp;   =E2=94=82 Status
=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=BC=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=
responder =E2=94=82 MySQL   = =E2=94=82 10.2.13-MariaDB =E2=94=82 jdbc:mariadb://xxxx:3306/responder?cha= racterEncoding=3DUTF-8&useServerPrepStmts=3Dtrue =E2=94=82 OK=

<= div style=3D"text-align: start; text-indent: 0px; word-wrap: break-word; -we= bkit-nbsp-mode: space; line-break: after-white-space;" class=3D"">
= Jndi shows:

karaf@root()> j= ndi:names 
JNDI Name     = ;         =E2=94=82 Class Name
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=BC=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80
<= font face=3D"Courier" style=3D"font-size: 12px;" class=3D"">osgi:service/responder =E2=94=82 org.mariadb.jdbc.= MySQLDataSource
osgi:service/jndi  &nbs= p;   =E2=94=82 org.apache.karaf.jndi.internal.JndiServiceImpl

<= div style=3D"text-align: start; text-indent: 0px; word-wrap: break-word; -we= bkit-nbsp-mode: space; line-break: after-white-space;" class=3D"">My Persist= ence Unit is defined as:

<persistence-unit<= span style=3D"font-size: 12px; font-family: Courier;" class=3D""> name=3D"respon= derPersistenUnit" transaction-type=3D"JTA">
<provider>org.apache.openjpa.persistence.Persi= stenceProviderImpl</provider>
<jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.s= ervice.name=3Djdbc/responder)</jta-data-source>
<= span class=3D"Apple-tab-span" style=3D"white-space:pre"> <exclude-unlisted-classes>true</exclude-unlisted-classes> = <class>org.enquery.encryptedquery.responder.data.User</clas= s>
<properties>
<property=  name=3D"openjpa.Log" value=3D"DefaultLevel=3DDEBUG, Tool=3DINFO"&= nbsp;/>
</properties>
</persistence-unit>

I am thinking if the =E2=80=9Cjta-= data-source=E2=80=9D property is wrong?


Best regards,
Alex soto




On M= ay 11, 2018, at 3:48 PM, Tim Ward <tim.ward@paremus.com> wrote:

Hi Alex= ,

So the logs you=E2=80=99= ve sent indicate that your persistence bundle is being found, and that it=E2= =80=99s being matched with OpenJPA. These are both good things. 
<= div class=3D"">
The next step in the pro= cess is to locate and set up the connections to the database. Depending on h= ow you=E2=80=99re setting up your persistence.xml this can happen automatica= lly, but more normally it requires configuration and/or use of the EntityMan= agerFactoryBuilder service. 

=
Things to check are that:

=E2=80=A2 you do see and EntityManagerFactoryBuilder= service
=E2=80=A2 you=E2=80=99re deploying a valid dat= abase driver supporting the JDBC service
=E2=80=A2 your= database url and driver class match the driver you=E2=80=99re deploying&nbs= p;
=E2=80=A2 you=E2=80=99re using the correct pid/unit.= name

I hope this h= elps.

Tim

Sent from my iPhone

On 11 May 2018, at 19:58, Alex Soto <alex.soto@envieta.com> wrote:

What is strange is that (based on the logs) it= seems as if the persistence unit is being discovered: 

14:50:44.050 INFO [features-3-thread-= 1] Found persistence unit responderPersistenUnit in bundle org.enquery.= encryptedquery.responder-data-jpa-entity-manager with provider org.apac= he.openjpa.persistence.PersistenceProviderImpl.
14:50:44.052 INFO [features-3= -thread-1] Found provider for responderPersistenUnit org.apache.op= enjpa.persistence.PersistenceProviderImpl
14:50:44.142 INFO [features-3-thread= -1] Adding transformer org.apache.openjpa.persistence.PersistenceP= roviderImpl$ClassTransformerImpl

=

But the  javax.persistence.EntityManag= er service is not being registered, and there is no errors.


On May 11, 2018, at 2:19 PM, Alex Soto <alex.soto@envieta.com> wrote:

Ok, I made some progress (I guess) I am no longer getting the orig= inal error:  java.lang.ClassCastException: org.apache.openjpa.persisten= ce.PersistenceProviderImpl cannot be cast to javax.persistence.spi.Persisten= ceProvider


I added my own version of the jpa&= nbsp;feature, in which I substitute the line

        <bundle dependency=3D"tru= e">mvn:org.eclipse.persistence/javax.persistence/2.1.0</bundle>


With:
        <bundle&= nbsp;dependency=3D"true">mvn:org.apache.geronimo.specs/geronimo-jta_1.1_s= pec/1.1.1</bundle>

Which results in:

<feature name=3D"aries-jpa2=E2=80=9D>
     <capability>
    &= nbsp;       osgi.service;effective:=3Dactive;objectClass= =3Djavax.persistence.spi.PersistenceProvider
    &nbs= p;   </capability>
       &= nbsp;
= <bundle dependency=3D"true">mvn:org.apach= e.geronimo.specs/geronimo-jpa_2.0_spec/1.1</bundle>
 = ;       <bundle dependency=3D"true">mvn:org.a= pache.geronimo.specs/geronimo-jta_1.1_spec/1.1.1</bundle>
=
        <bundle dependency=3D"true">mvn= :org.osgi/org.osgi.service.jdbc/1.0.0</bundle>
   = ;     <bundle dependency=3D"true" start-level=3D= "30">mvn:org.apache.felix/org.apache.felix.coordinator/1.0.2</bundle&g= t;
        <bundle start-level= =3D"30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/${aries.jpa.ver= sion}</bundle>
        <bundl= e start-level=3D"30">mvn:org.apache.aries.jpa/org.apache.aries.jpa.c= ontainer/${aries.jpa.version}</bundle>
    &nbs= p;   <bundle start-level=3D"30">mvn:org.apache.aries.jp= a/org.apache.aries.jpa.support/${aries.jpa.version}</bundle>
        <conditional>
  &= nbsp;         <condition>aries-blueprint</= condition>
            &l= t;bundle start-level=3D"30">mvn:org.apache.aries.jpa/org.apache.arie= s.jpa.blueprint/${aries.jpa.version}</bundle>
   = ;     </conditional>
</feature= >



=
Now, in my own feature, I have:

<= feature>aries-blueprint</feature>
  <feature>jndi</feature>
<feature>jdbc</feature>
<feature>transaction</feature>
<feature>aries-jpa2</feature>
=
<feature>openjpa</feature>
= <feature>pax-jdbc-mariadb</feature>
        <feature>pax-jdbc-c= onfig</feature>

Among others.  Now my bundle fails to star= t:

Status: GracePeriod
= Declarative Servi= ces
Blueprint
5/= 11/18 2:14 PM
Missing dependencies: 
(&(osgi.unit.name=3DresponderPersistenUnit)(obj= ectClass=3Djavax.persistence.EntityManager)) 
<= /blockquote>

There are no errors in the lo= g, just this unresolved dependency.
Any idea about why my persistent unit is not= being registered?

Best regards,
Alex soto




On May 11, 2018, at 11:09 AM, Tim Ward <tim.ward@paremus.com> wrote:



On 11 M= ay 2018, at 15:53, Alex Soto <alex.soto@envieta.com> wrote:

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 t= ested with EclipseLink, Hibernate and OpenJPA. 

I am looking at these integration test= s, 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 Op= enJPA integration test. So unless you are an AriesJPA developer, you would n= ot know about this.  How would anybody figure this out? 

@Configuration
  &= nbsp; public Option[] configuration() {
    &= nbsp;   return new Option[] {
    &= nbsp;       baseOptions(), //
  &nb= sp;         ariesJpa20(), //
      &= nbsp;     jta11Bundles(), // Openjpa currently= does not work with jta 1.2. See https://issues.apache.org/jira= /browse/OPENJPA-2607
           = ; openJpa(), //
          &nbs= p; derbyDSF(), //
          &n= bsp; 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-hibernat= e, jpa-openjpa, etc.

Yes, that=E2= =80=99s pretty much what is needed, but Karaf would be the place to create a= nd maintain those features.



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 i= n my bundle=E2=80=99s osgi.bnd file:

-contract: J= avaJPA

Is that all that is needed?  It does not indicate version.

That is most of what is needed - y= ou also need to be compiling against a library which offers the contract (fo= r example the spec bundles provided by Aries). If you do that you will end u= p with Import-Package statements for javax.persistence (et al) with no versi= on, but also a Require-Capability: osgi.contract;filter:=3D(&(osgi.contr= act=3DJavaJPA)(version=3DXXX)) where the XXX is determined from the Provide-= Capability of the bundle you compiled against.


=
The real probl= em is that the AriesJPA feature shouldn=E2=80=99t exist as a standalone thin= g (it doesn=E2=80=99t make sense to deploy it on its own). It should come fo= r free when you install the OpenJPA (or Hibernate, or EclipseLink) feature, u= sing whichever API they have deployed.
<= div class=3D"">
Exactly, this is harder t= han it should be.  When I install a feature, I expect the feature to br= ing in all that is needed, not having to chase down all these dependencies.<= /div>
Is there an intention to take this approach any time so= on?
I=E2=80=99m afraid that w= ould be a decision for the Karaf maintainers rather than me. I=E2=80=99m onl= y chipping in because I=E2=80=99m an Aries PMC member who deals quite a bit w= ith the JPA and Tx Control components.

Best Regards,

Tim Ward






Tim

<= div class=3D"">

On 11 May 2018, at 14:23, Alex Soto <alex.soto@envieta.com> wrote:<= /div>
I had accidentally replied directly to Tim. &= nbsp;Repeating here:

Let me see if I understand this correctly:

K= araf version 4.2.0 enterprise repository depends on version 2.6.1 o= f AriesJPA.
AriesJPA version 2.6.1 depends on  javax.pers= istence version 2.1.0.
Karaf=E2=80=99s enterprise re= pository defines a openjpa feature that depends on OpenJPA version= 2.4.2.
OpenJPA version 2.4.2 depends on javax.persistence ver= sion 2.0.0.
 
Is this correct?
Is there is a bug in the Enterprise repository mixing incompatible version= s of OpenJPA and AriesJPA?
Is the problem in OpenJPA no= t declaring the version it depends on?

<= /div>
Inspecting in Karaf=E2=80=99s console:

karaf@root()> list
<= font face=3D"Courier" class=3D"" style=3D"font-size: 12px;">
<= /font>
 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.packag= e; (&(osgi.wiring.package=3Djavax.persistence)(version>=3D1.1.0)(!(ve= rsion>=3D2.1.0))) resolved by:
   osgi.wiring= .package; javax.persistence 2.0.0 from org.apache.geronimo.specs.geronimo-jp= a_2.0_spec [66]

karaf@root()> feature:info&n= bsp;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 you= rself (OpenJPA for instance)
Feature has no configuration
Feature has no configuration files
Feature has no de= pendencies.
Feature contains followed bundles:
&= nbsp; mvn:org.eclipse.persistence/ja= vax.persistence/2.1.0
  mvn:org.apache.geroni= mo.specs/geronimo-jta_1.1_spec/1.1.1
  mvn:org.osgi/= org.osgi.service.jdbc/1.0.0
  mvn:org.apache.felix/o= rg.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.contai= ner/2.6.1 start-level=3D30
  mvn:org.apache.aries.jp= a/org.apache.aries.jpa.support/2.6.1 start-level=3D30
<= br class=3D"">
Best re= gards,
Alex soto


<= br class=3D"">

On May 10, 2018, at 5:45 PM, Tim Ward <= tim.ward@paremus.com&= gt; 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 u= sed there.

Best Regards,

Tim

Sent from my iPhone
On 10 May 2018, at 20:43, J= ean-Baptiste Onofr=C3=A9 <j= b@nanthrax.net> wrote:

Anyway, let me ch= eck if OpenJPA 2.4.2 supports JPA 2.1 (it's what I thought).
<= br class=3D"">Regards
JB

On 05/10/2018 09:36 PM, Alex Soto wrote:
I am sorry I only see one version:

kara= f@root()> feature:list | grep jpa
openjpa    = ;            &nb= sp;            &= nbsp;    =E2=94=82 2.4.2      &= nbsp;     =E2=94=82      &= nbsp;   =E2=94=82
Started    &nb= sp;=E2=94=82 enterprise-4.2.0        &nbs= p;         =E2=94=82 Apache Ope= nJPA 2.4.x
persistence engine support
camel-jpa &= nbsp;            = ;            &nb= sp;     =E2=94=82 2.21.1     &n= bsp;     =E2=94=82      &n= bsp;
 =E2=94=82 Uninstalled =E2=94=82 camel-2.21.1  =             &nbs= p;       =E2=94=82
deltaspi= ke-jpa            &nb= sp;            &= nbsp; =E2=94=82 1.4.2         &= nbsp;  =E2=94=82       
 =E2=94=82 Uninstalled =E2=94=82 org.ops4j.pax.cdi-1.0.0.RC2  &n= bsp;    =E2=94=82 Apache Deltaspike jpa support
deltaspike-jpa          &= nbsp;            = ;    =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 Apac= he Deltaspike jpa support
jpa      &n= bsp;            =             &nbs= p;      =E2=94=82 2.6.1    &nbs= p;       =E2=94=82    &nbs= p;     =E2=94=82
Started   =   =E2=94=82 aries-jpa-2.6.1       &n= bsp;           =E2=94= =82 OSGi Persistence Container


<= br class=3D"">Is there a repository I need to add?  

Best regards,
Alex soto



On May 1= 0, 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 dep= ending of the engine you are using:

feature:ins= tall 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 d= efined in the Karaf=E2=80=99s enterprise feature,
but if that d= oesn=E2=80=99t work ,then which version do I need?  I am afraid if Ideviate from the versions selected by Kara=E2=80=99s Enterprise f= eature I will get
into more version mismatch problems.  &= nbsp;Also what do I put in my POM for
javax.persistence depend= ency?


Best regards,
Alex soto



On May 10, 2018, at 3:16 PM, Jean-Baptiste O= nofr=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 sh= ould specify the jpa feature version.

RegardsJB

On 05/10/2018 09:08 PM, Alex Soto wrote:
Hello,

I am running Karaf 4.2.0, trying to setup a project wit= h OpenJPA.  I am getting
error:


14:44:07.799 ERROR [FelixDispatchQueue] FrameworkEvent ERR= OR
- org.apache.aries.jpa.container
java.lang.Cl= assCastException:
org.apache.openjpa.persistence.PersistencePr= oviderImpl
cannot be cast to javax.persistence.spi.Persistence= Provider
at
org.apache.aries.jpa.container.impl.= PersistenceProviderTracker.addingService(PersistenceProviderTracker.java:84)=
~[?:?]
at
org.apache.aries.jpa.co= ntainer.impl.PersistenceProviderTracker.addingService(PersistenceProviderTra= cker.java:44)
~[?:?]
at
org.osgi.u= til.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)=
~[?:?]
at
org.osgi.util.tracker.S= erviceTracker$Tracked.customizerAdding(ServiceTracker.java:870)
~[?:?]
at org.osgi.util.tracker.AbstractTracked.trackAdding(= AbstractTracked.java:256)
~[?:?]
at org.osgi.uti= l.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)
~[?:?]
at org.osgi.util.tracker.ServiceTracker.open(Service= Tracker.java:318) ~[?:?]
at org.osgi.util.tracker.ServiceTrack= er.open(ServiceTracker.java:261) ~[?:?]
at
org.a= pache.aries.jpa.container.impl.PersistenceBundleTracker.trackProvider(Persis= tenceBundleTracker.java:103)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTracker.findPersiste= nceUnits(PersistenceBundleTracker.java:87)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBundleTrac= ker.addingBundle(PersistenceBundleTracker.java:66)
~[?:?]
at
org.apache.aries.jpa.container.impl.PersistenceBu= ndleTracker.addingBundle(PersistenceBundleTracker.java:39)
~[?= :?]
at
org.osgi.util.tracker.BundleTracker$Track= ed.customizerAdding(BundleTracker.java:469)
~[?:?]
at
org.osgi.util.tracker.BundleTracker$Tracked.customizerAd= ding(BundleTracker.java:415)
~[?:?]
at org.osgi.= util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
~[?:?]
at org.osgi.util.tracker.AbstractTracked.track(Abstr= actTracked.java:229) ~[?:?]
at
org.osgi.util.tra= cker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444)
~[?:?]
at
org.apache.felix.framework.EventDis= patcher.invokeBundleListenerCallback(EventDispatcher.java:915)
~[?:?]
at
org.apache.felix.framework.EventDispa= tcher.fireEventImmediately(EventDispatcher.java:834)
~[?:?]at
org.apache.felix.framework.EventDispatcher.fire= BundleEvent(EventDispatcher.java:516)
~[?:?]
at o= rg.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.fram= ework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
~[?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]


This looks like ver= sion mismatch.  I am loading the following packages in my
feature:

<feature>aries-blueprint</fe= ature>
<feature>war</feature>
<= ;feature>camel-core</feature>
<feature>camel-se= rvlet</feature>
<feature>camel-blueprint</featu= re>
<feature>camel-jackson</feature>
<feature>jndi</feature>
<feature>jdbc<= /feature>
<feature>transaction</feature>
<feature>jpa</feature>
<feature>open= jpa</feature>
<feature>pax-jdbc-mariadb</featur= e>
      <feature>pax-j= dbc-config</feature>


One t= hing I don=E2=80=99t know if is correct is the javax.persistence dependency i= n
my POM:

<dependency>
          <gr= oupId>org.eclipse.persistence</groupId>
  &= nbsp;       <artifactId>javax.persi= stence</artifactId>
      =     <version>2.0.5</version>
&= nbsp;         <scope>prov= ided</scope>
      </de= pendency>

Any hints?

Best regards,
Alex soto



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


--=  
Jean-Bapti= ste Onofr=C3=A9
jbonofre@apache.org <mailto:jbonofre@apach= e.org>
http://blog.nanthrax.net
Talend - htt= p://www.talend.com


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



<= /blockquote>= --Apple-Mail-5CAAFC45-52D6-41B1-BD55-72B7E55293CF--