Hi, the examples are for 4.2.x only not 4.1.x.
All versions are contained in the JPA example itself, using hibernate provided by Karaf 4.2.1. Regards JB On 20/07/2018 16:17, Miroslav Beranič wrote: > Hi, > > I've upgraded my environment from ServiceMix 7.1.0-SNAPSHOT ( running > Karaf 4.0.9 ) to Karaf 4.1.x ( GitHub ) branch and later on I've > experimented with version 4.2.x. > I was using linked linkes from Karaf home page ( > https://karaf.apache.org/documentation.html ) to GitHub Examples - for JPA. > > My main task is to get JPA 2 up and running, but I fail to do so. > > So on provided examples Github repository: > https://github.com/jbonofre/karaf/tree/DEV_GUIDE/examples/karaf-jpa-example > > I've tested with Karaf 4.1.x and 4.2.x and in both version, Examples for > JPA do now work - for me. > > For Karaf 4.2.x I've created PasteBin outputs ( please see ): > 1.) https://pastebin.com/eJybVNhn > 2.) https://pastebin.com/W2UhihdR > > In examples, I've noted that there is a reference to Hibernate > 6.0.10.Final - this version is not released yet ( hibernate.org > <http://hibernate.org> ), so I guess this is a wrong version, or ? as I > see Karaf has build-in support for Hibernate 5.2.9.Final. > > https://github.com/jbonofre/karaf/blob/DEV_GUIDE/examples/karaf-jpa-example/karaf-jpa-example-features/src/main/feature/feature.xml > > For Hibernate version I am looking at: > https://github.com/apache/karaf/blob/master/pom.xml > <hibernate.version>5.2.9.Final</hibernate.version> > > So what I did was: > > 1.) checked out Karaf 4.1.x from Github > 2.) checked out Karaf Examples ( DEV_GUIDE branch from Github ) > > 3.) Build Karaf with Maven: mvn -Pfastinstall and started Karaf with > ./bin/karaf debug > 4.) Build Karaf Examples ( changed version of Hibernate from > 6.0.10.Final to 5.2.9.Final ) > > Read instruction from: > https://github.com/jbonofre/karaf/blob/DEV_GUIDE/examples/karaf-jpa-example/README.md > > 5.) feature:repo-add > mvn:org.apache.karaf.examples/karaf-jpa-example-features/4.2.1-SNAPSHOT/xml > 6.) feature:install karaf-jpa-example-datasource > 7.) feature:install karaf-jpa-example-provider > > Fail: > > Error executing command: Unable to resolve root: missing requirement > [root] osgi.identity; osgi.identity=karaf-jpa-example-provider; > type=karaf.feature; version="[4.2.1.SNAPSHOT,4.2.1.SNAPSHOT]"; > filter:="(&(osgi.identity=karaf-jpa-example-provider)(type=karaf.feature)(version>=4.2.1.SNAPSHOT)(version<=4.2.1.SNAPSHOT))" > [caused by: Unable to resolve karaf-jpa-example-provider/4.2.1.SNAPSHOT: > missing requirement [karaf-jpa-example-provider/4.2.1.SNAPSHOT] > osgi.identity; > osgi.identity=org.apache.karaf.examples.karaf-jpa-example-provider; > type=osgi.bundle; version="[4.2.1.SNAPSHOT,4.2.1.SNAPSHOT]"; > resolution:=mandatory [caused by: Unable to resolve > org.apache.karaf.examples.karaf-jpa-example-provider/4.2.1.SNAPSHOT: > missing requirement > [org.apache.karaf.examples.karaf-jpa-example-provider/4.2.1.SNAPSHOT] > osgi.service; objectClass=javax.persistence.spi.PersistenceProvider; > javax.persistence.provider=org.hibernate.jpa.HibernatePersistenceProvider; > effective:=active]] > > I am using Linux x64, Oracle Java 8 172 x64. > > What I am doing wrong. I've mixed different version of Hibernate, Karaf, > ... and noting. Always some more or less strange error. > > Plus there is an issue: what version of maven-bundle-plugin should/must > be used? I've tried 3.01 and 3.2.0. When I use 3.0.1 I have to update > <Import-Package> if I use 3.2.0 I get error that javassist is not resolved: > > Error executing command: Unable to resolve root: missing requirement > [root] osgi.identity; osgi.identity=. ... osgi.wiring.package; > filter:="(&(osgi.wiring.package=javassist.util.proxy)(version>=3.22.0)(!(version>=4.0.0)))"]]] > > > > So all in all I can not and did not find and singe point of truth what > is valid example or way of doing JPA 2 with Hibernate. I guess I am > doing something wrong as all examples make it so simple but ... no luck. > All I did is clean ( new computer - virtual ) checkout from git, build > and deploy - and fail. > > I would like to migrate existing code using JPA 1 to JPA 2 ( 2.2 ? ) but > ... this is difficult task to complete ( this is after one week of pain > and frustration ). > > I've done examples from https://github.com/cschneider/Karaf-Tutorial > also, but no luck. More-or-less same problems. > > > 1.) What versions of Maven plugins should I use? > 2.) What versions of JPA? > 3.) What versions of Hibernate? > 4.) What example should I follow ( URL / Git and branch ) ? > > > This are my top questions. > > > Kind Regards, > Miroslav > > > > -- > Miroslav Beranič > MIBESIS > +386(0)40/814-843 > [email protected] <mailto:[email protected]> > http://www.mibesis.si
