JPA (Hibernate) with Apache Karaf 4.2

classic Classic list List threaded Threaded
31 messages Options
12
Reply | Threaded
Open this post in threaded view
|

JPA (Hibernate) with Apache Karaf 4.2

alex09
Hi there,

being new to OSGi, I have difficulties getting demos/examples/tutorials to
run (esp. with JPA) with Apache Karaf 4.2.

I tried all these resources:
* Apache Aries 2.7 JPA examples:
https://github.com/apache/aries-jpa/tree/master/examples (also user
documentation is not accurate for the current Karaf versions)
* Tutorials at http://karaf.apache.org/documentation.html#tutorials, which
don't work as liquid-reality.de has not been available for weeks now (I
found some of them here, but still they don't work:
https://github.com/cschneider/Karaf-Tutorial)
* Apache Aries 2.7: The Blog Example:
http://aries.apache.org/modules/samples/blog-sample.html
* Hibernate Demos:
https://github.com/hibernate/hibernate-demos/tree/master/hibernate-orm/osgi
(also reflecting the outdated user documentation)
* also the Entwicklerpress 143 book "OSGi Entwicklung" and Enterprise OSGi
in Action

All without success, the sample are really dated and there is a lot more to
do than just simple changes - this is difficult for someone coming new to
this topic.
I'd certainly volunteer for helping with this, but as there is no starting
point currently, this is complicated.

So my question is: are there any plans to create a new, sound
description/documentation/tutorial/example for JPA/Hibernate on Apache Karaf
4.x? Or isn't this supposed to work anymore as there are better practices
for persistence in OSGi?

Thanks & Best

Alex



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Reply | Threaded
Open this post in threaded view
|

Re: JPA (Hibernate) with Apache Karaf 4.2

fpapon
Hi Alex,

We have already start example in a dev guide and planned to released it in the 4.2.1 or Karaf.

You have a preview on the JB repo :

https://github.com/jbonofre/karaf/tree/DEV_GUIDE/examples

There is JPA example working with Hibernate.

Hope it can help and you are welcome to contribute :)

François

Le 29 mai 2018 10:54 PM, alex09 <[hidden email]> a écrit :

>
> Hi there,
>
> being new to OSGi, I have difficulties getting demos/examples/tutorials to
> run (esp. with JPA) with Apache Karaf 4.2.
>
> I tried all these resources:
> * Apache Aries 2.7 JPA examples:
> https://github.com/apache/aries-jpa/tree/master/examples (also user
> documentation is not accurate for the current Karaf versions)
> * Tutorials at http://karaf.apache.org/documentation.html#tutorials, which
> don't work as liquid-reality.de has not been available for weeks now (I
> found some of them here, but still they don't work:
> https://github.com/cschneider/Karaf-Tutorial)
> * Apache Aries 2.7: The Blog Example:
> http://aries.apache.org/modules/samples/blog-sample.html 
> * Hibernate Demos:
> https://github.com/hibernate/hibernate-demos/tree/master/hibernate-orm/osgi 
> (also reflecting the outdated user documentation)
> * also the Entwicklerpress 143 book "OSGi Entwicklung" and Enterprise OSGi
> in Action
>
> All without success, the sample are really dated and there is a lot more to
> do than just simple changes - this is difficult for someone coming new to
> this topic.
> I'd certainly volunteer for helping with this, but as there is no starting
> point currently, this is complicated.
>
> So my question is: are there any plans to create a new, sound
> description/documentation/tutorial/example for JPA/Hibernate on Apache Karaf
> 4.x? Or isn't this supposed to work anymore as there are better practices
> for persistence in OSGi?
>
> Thanks & Best
>
> Alex
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html 
Francois Papon
Openrun : https://www.openrun.re
Reply | Threaded
Open this post in threaded view
|

Re: JPA (Hibernate) with Apache Karaf 4.2

Kerry
In reply to this post by alex09
Hi Alex,

I've created a simple project that shows how to use JPA in Karaf although it uses OpenJPA as the JPA provider:

https://github.com/jtkb/jpatest

Hopefully it will be straight forward enough for you to get to grips with JPA in an OSGi environment.

Kerry


On 29/05/18 19:54, alex09 wrote:

> Hi there,
>
> being new to OSGi, I have difficulties getting demos/examples/tutorials to
> run (esp. with JPA) with Apache Karaf 4.2.
>
> I tried all these resources:
> * Apache Aries 2.7 JPA examples:
> https://github.com/apache/aries-jpa/tree/master/examples (also user
> documentation is not accurate for the current Karaf versions)
> * Tutorials at http://karaf.apache.org/documentation.html#tutorials, which
> don't work as liquid-reality.de has not been available for weeks now (I
> found some of them here, but still they don't work:
> https://github.com/cschneider/Karaf-Tutorial)
> * Apache Aries 2.7: The Blog Example:
> http://aries.apache.org/modules/samples/blog-sample.html
> * Hibernate Demos:
> https://github.com/hibernate/hibernate-demos/tree/master/hibernate-orm/osgi
> (also reflecting the outdated user documentation)
> * also the Entwicklerpress 143 book "OSGi Entwicklung" and Enterprise OSGi
> in Action
>
> All without success, the sample are really dated and there is a lot more to
> do than just simple changes - this is difficult for someone coming new to
> this topic.
> I'd certainly volunteer for helping with this, but as there is no starting
> point currently, this is complicated.
>
> So my question is: are there any plans to create a new, sound
> description/documentation/tutorial/example for JPA/Hibernate on Apache Karaf
> 4.x? Or isn't this supposed to work anymore as there are better practices
> for persistence in OSGi?
>
> Thanks & Best
>
> Alex
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>

Reply | Threaded
Open this post in threaded view
|

Re: JPA (Hibernate) with Apache Karaf 4.2

Tim Ward-2
Have you all considered looking at the JPA example/tutorial in OSGi enRoute? This demonstrates how to use Aries JPA 2.7 (the reference implementation of the OSGi JPA Service 1.1) with Hibernate and Aries Transaction Control (the reference implementation of the OSGi Transaction Control Service) to create a transactional data access service using JPA.


Note that this guide includes descriptions of the various hibernate bugs that you have to work around.

I hope this helps,

Tim

On 29 May 2018, at 20:20, Kerry <[hidden email]> wrote:

Hi Alex,

I've created a simple project that shows how to use JPA in Karaf although it uses OpenJPA as the JPA provider:

https://github.com/jtkb/jpatest

Hopefully it will be straight forward enough for you to get to grips with JPA in an OSGi environment.

Kerry


On 29/05/18 19:54, alex09 wrote:
Hi there,

being new to OSGi, I have difficulties getting demos/examples/tutorials to
run (esp. with JPA) with Apache Karaf 4.2.

I tried all these resources:
* Apache Aries 2.7 JPA examples:
https://github.com/apache/aries-jpa/tree/master/examples (also user
documentation is not accurate for the current Karaf versions)
* Tutorials at http://karaf.apache.org/documentation.html#tutorials, which
don't work as liquid-reality.de has not been available for weeks now (I
found some of them here, but still they don't work:
https://github.com/cschneider/Karaf-Tutorial)
* Apache Aries 2.7: The Blog Example:
http://aries.apache.org/modules/samples/blog-sample.html
* Hibernate Demos:
https://github.com/hibernate/hibernate-demos/tree/master/hibernate-orm/osgi
(also reflecting the outdated user documentation)
* also the Entwicklerpress 143 book "OSGi Entwicklung" and Enterprise OSGi
in Action

All without success, the sample are really dated and there is a lot more to
do than just simple changes - this is difficult for someone coming new to
this topic.
I'd certainly volunteer for helping with this, but as there is no starting
point currently, this is complicated.

So my question is: are there any plans to create a new, sound
description/documentation/tutorial/example for JPA/Hibernate on Apache Karaf
4.x? Or isn't this supposed to work anymore as there are better practices
for persistence in OSGi?

Thanks & Best

Alex



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html



Reply | Threaded
Open this post in threaded view
|

Re: JPA (Hibernate) with Apache Karaf 4.2

alex09
In reply to this post by fpapon
Thanks a lot, that's what I was looking for (also @Kerry, will try this
seperately).

The first steps work as excepted, but at karaf-jpa-example-provider I get
resolve errors - as I am on a fresh downloaded Karaf 4.2.0, only Hibernate
5.2.9.Final can be installed as a feature.


karaf@root()>  feature:install karaf-jpa-example-provider
org.osgi.service.resolver.ResolutionException: Unable to resolve root:
missing requirement [root] osgi.identity;
osgi.identity=karaf-jpa-example-provider; type=karaf.feature;
version="[4.2.0.SNAPSHOT,4.2.0.SNAPSHOT]";
filter:="(&(osgi.identity=karaf-jpa-example-provider)(type=karaf.feature)(version>=4.2.0.SNAPSHOT)(version<=4.2.0.SNAPSHOT))"
[caused by: Unable to resolve karaf-jpa-example-provider/4.2.0.SNAPSHOT:
missing requirement [karaf-jpa-example-provider/4.2.0.SNAPSHOT]
osgi.identity; osgi.identity=karaf-jpa-example-common; type=karaf.feature;
version="[4.2.0.SNAPSHOT,4.2.0.SNAPSHOT]" [caused by: Unable to resolve
karaf-jpa-example-common/4.2.0.SNAPSHOT: missing requirement
[karaf-jpa-example-common/4.2.0.SNAPSHOT] osgi.identity;
osgi.identity=hibernate; type=karaf.feature;
version="[4.3.6.Final,4.3.6.Final]"]]
        at
org.apache.felix.resolver.ResolutionError.toException(ResolutionError.java:42)
        at
org.apache.felix.resolver.ResolverImpl.doResolve(ResolverImpl.java:391)
        at
org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:377)
        at
org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:331)
        at
org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:248)
        at
org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:388)
        at
org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1025)
        at
org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:964)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Error executing command: Unable to resolve root: missing requirement [root]
osgi.identity; osgi.identity=karaf-jpa-example-provider; type=karaf.feature;
version="[4.2.0.SNAPSHOT,4.2.0.SNAPSHOT]";
filter:="(&(osgi.identity=karaf-jpa-example-provider)(type=karaf.feature)(version>=4.2.0.SNAPSHOT)(version<=4.2.0.SNAPSHOT))"
[caused by: Unable to resolve karaf-jpa-example-provider/4.2.0.SNAPSHOT:
missing requirement [karaf-jpa-example-provider/4.2.0.SNAPSHOT]
osgi.identity; osgi.identity=karaf-jpa-example-common; type=karaf.feature;
version="[4.2.0.SNAPSHOT,4.2.0.SNAPSHOT]" [caused by: Unable to resolve
karaf-jpa-example-common/4.2.0.SNAPSHOT: missing requirement
[karaf-jpa-example-common/4.2.0.SNAPSHOT] osgi.identity;
osgi.identity=hibernate; type=karaf.feature;
version="[4.3.6.Final,4.3.6.Final]"]]



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Reply | Threaded
Open this post in threaded view
|

Re: JPA (Hibernate) with Apache Karaf 4.2

fpapon
Hi,

You have to install enterprise-legacy feature :

karaf@root()> feature:repo-add enterprise-legacy

François



-----
Francois Papon
Openrun : https://www.openrun.re
--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Francois Papon
Openrun : https://www.openrun.re
Reply | Threaded
Open this post in threaded view
|

Re: JPA (Hibernate) with Apache Karaf 4.2

alex09
In reply to this post by Kerry
Thanks Kerry!

When building simple-commands, an artefact is missing:

        <dependency>
            <groupId>com.javatechnics.jpa</groupId>
            <artifactId>simple</artifactId>
            <version>1.0.0-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>

Does this have to be installed seperately?



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Reply | Threaded
Open this post in threaded view
|

Re: JPA (Hibernate) with Apache Karaf 4.2

alex09
In reply to this post by fpapon
Ok, that's gets me to a blueprint-resolution error, therefore I installed

feature:install aries-blueprint

but then it the next error I don't know how to fix this version conflict:

karaf@root()> feature:install karaf-jpa-example-provider
org.osgi.service.resolver.ResolutionException: Unable to resolve root:
missing requirement [root] osgi.identity;
osgi.identity=karaf-jpa-example-provider; type=karaf.feature;
version="[4.2.0.SNAPSHOT,4.2.0.SNAPSHOT]";
filter:="(&(osgi.identity=karaf-jpa-example-provider)(type=karaf.feature)(version>=4.2.0.SNAPSHOT)(version<=4.2.0.SNAPSHOT))"
[caused by: Unable to resolve karaf-jpa-example-provider/4.2.0.SNAPSHOT:
missing requirement [karaf-jpa-example-provider/4.2.0.SNAPSHOT]
osgi.identity;
osgi.identity=org.apache.karaf.examples.karaf-jpa-example-provider;
type=osgi.bundle; version="[4.2.0.SNAPSHOT,4.2.0.SNAPSHOT]";
resolution:=mandatory [caused by: Unable to resolve
org.apache.karaf.examples.karaf-jpa-example-provider/4.2.0.SNAPSHOT: missing
requirement
[org.apache.karaf.examples.karaf-jpa-example-provider/4.2.0.SNAPSHOT]
osgi.service; objectClass=javax.persistence.spi.PersistenceProvider;
javax.persistence.provider=org.hibernate.jpa.HibernatePersistenceProvider;
effective:=active]]
        at
org.apache.felix.resolver.ResolutionError.toException(ResolutionError.java:42)
        at
org.apache.felix.resolver.ResolverImpl.doResolve(ResolverImpl.java:391)
        at
org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:377)
        at
org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:331)
        at
org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:248)
        at
org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:388)
        at
org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1025)
        at
org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:964)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Error executing command: Unable to resolve root: missing requirement [root]
osgi.identity; osgi.identity=karaf-jpa-example-provider; type=karaf.feature;
version="[4.2.0.SNAPSHOT,4.2.0.SNAPSHOT]";
filter:="(&(osgi.identity=karaf-jpa-example-provider)(type=karaf.feature)(version>=4.2.0.SNAPSHOT)(version<=4.2.0.SNAPSHOT))"
[caused by: Unable to resolve karaf-jpa-example-provider/4.2.0.SNAPSHOT:
missing requirement [karaf-jpa-example-provider/4.2.0.SNAPSHOT]
osgi.identity;
osgi.identity=org.apache.karaf.examples.karaf-jpa-example-provider;
type=osgi.bundle; version="[4.2.0.SNAPSHOT,4.2.0.SNAPSHOT]";
resolution:=mandatory [caused by: Unable to resolve
org.apache.karaf.examples.karaf-jpa-example-provider/4.2.0.SNAPSHOT: missing
requirement
[org.apache.karaf.examples.karaf-jpa-example-provider/4.2.0.SNAPSHOT]
osgi.service; objectClass=javax.persistence.spi.PersistenceProvider;
javax.persistence.provider=org.hibernate.jpa.HibernatePersistenceProvider;
effective:=active]]



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Reply | Threaded
Open this post in threaded view
|

Re: JPA (Hibernate) with Apache Karaf 4.2

jbonofre
Did you install the hibernate feature ?

Regards
JB

On 30/05/2018 13:08, alex09 wrote:

> Ok, that's gets me to a blueprint-resolution error, therefore I installed
>
> feature:install aries-blueprint
>
> but then it the next error I don't know how to fix this version conflict:
>
> karaf@root()> feature:install karaf-jpa-example-provider
> org.osgi.service.resolver.ResolutionException: Unable to resolve root:
> missing requirement [root] osgi.identity;
> osgi.identity=karaf-jpa-example-provider; type=karaf.feature;
> version="[4.2.0.SNAPSHOT,4.2.0.SNAPSHOT]";
> filter:="(&(osgi.identity=karaf-jpa-example-provider)(type=karaf.feature)(version>=4.2.0.SNAPSHOT)(version<=4.2.0.SNAPSHOT))"
> [caused by: Unable to resolve karaf-jpa-example-provider/4.2.0.SNAPSHOT:
> missing requirement [karaf-jpa-example-provider/4.2.0.SNAPSHOT]
> osgi.identity;
> osgi.identity=org.apache.karaf.examples.karaf-jpa-example-provider;
> type=osgi.bundle; version="[4.2.0.SNAPSHOT,4.2.0.SNAPSHOT]";
> resolution:=mandatory [caused by: Unable to resolve
> org.apache.karaf.examples.karaf-jpa-example-provider/4.2.0.SNAPSHOT: missing
> requirement
> [org.apache.karaf.examples.karaf-jpa-example-provider/4.2.0.SNAPSHOT]
> osgi.service; objectClass=javax.persistence.spi.PersistenceProvider;
> javax.persistence.provider=org.hibernate.jpa.HibernatePersistenceProvider;
> effective:=active]]
>         at
> org.apache.felix.resolver.ResolutionError.toException(ResolutionError.java:42)
>         at
> org.apache.felix.resolver.ResolverImpl.doResolve(ResolverImpl.java:391)
>         at
> org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:377)
>         at
> org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:331)
>         at
> org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:248)
>         at
> org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:388)
>         at
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1025)
>         at
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:964)
>         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>         at java.lang.Thread.run(Thread.java:748)
> Error executing command: Unable to resolve root: missing requirement [root]
> osgi.identity; osgi.identity=karaf-jpa-example-provider; type=karaf.feature;
> version="[4.2.0.SNAPSHOT,4.2.0.SNAPSHOT]";
> filter:="(&(osgi.identity=karaf-jpa-example-provider)(type=karaf.feature)(version>=4.2.0.SNAPSHOT)(version<=4.2.0.SNAPSHOT))"
> [caused by: Unable to resolve karaf-jpa-example-provider/4.2.0.SNAPSHOT:
> missing requirement [karaf-jpa-example-provider/4.2.0.SNAPSHOT]
> osgi.identity;
> osgi.identity=org.apache.karaf.examples.karaf-jpa-example-provider;
> type=osgi.bundle; version="[4.2.0.SNAPSHOT,4.2.0.SNAPSHOT]";
> resolution:=mandatory [caused by: Unable to resolve
> org.apache.karaf.examples.karaf-jpa-example-provider/4.2.0.SNAPSHOT: missing
> requirement
> [org.apache.karaf.examples.karaf-jpa-example-provider/4.2.0.SNAPSHOT]
> osgi.service; objectClass=javax.persistence.spi.PersistenceProvider;
> javax.persistence.provider=org.hibernate.jpa.HibernatePersistenceProvider;
> effective:=active]]
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>

--
--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: JPA (Hibernate) with Apache Karaf 4.2

jbonofre
In reply to this post by alex09
By the way, what Karaf version are you using ?

4.2.0-SNAPSHOT doesn't look good to me, it should be 4.2.1-SNAPSHOT or
4.2.0.

I think you just took the example as it is: the branch requires a rebase.

I'm doing it now.

Regards
JB

On 30/05/2018 13:08, alex09 wrote:

> Ok, that's gets me to a blueprint-resolution error, therefore I installed
>
> feature:install aries-blueprint
>
> but then it the next error I don't know how to fix this version conflict:
>
> karaf@root()> feature:install karaf-jpa-example-provider
> org.osgi.service.resolver.ResolutionException: Unable to resolve root:
> missing requirement [root] osgi.identity;
> osgi.identity=karaf-jpa-example-provider; type=karaf.feature;
> version="[4.2.0.SNAPSHOT,4.2.0.SNAPSHOT]";
> filter:="(&(osgi.identity=karaf-jpa-example-provider)(type=karaf.feature)(version>=4.2.0.SNAPSHOT)(version<=4.2.0.SNAPSHOT))"
> [caused by: Unable to resolve karaf-jpa-example-provider/4.2.0.SNAPSHOT:
> missing requirement [karaf-jpa-example-provider/4.2.0.SNAPSHOT]
> osgi.identity;
> osgi.identity=org.apache.karaf.examples.karaf-jpa-example-provider;
> type=osgi.bundle; version="[4.2.0.SNAPSHOT,4.2.0.SNAPSHOT]";
> resolution:=mandatory [caused by: Unable to resolve
> org.apache.karaf.examples.karaf-jpa-example-provider/4.2.0.SNAPSHOT: missing
> requirement
> [org.apache.karaf.examples.karaf-jpa-example-provider/4.2.0.SNAPSHOT]
> osgi.service; objectClass=javax.persistence.spi.PersistenceProvider;
> javax.persistence.provider=org.hibernate.jpa.HibernatePersistenceProvider;
> effective:=active]]
>         at
> org.apache.felix.resolver.ResolutionError.toException(ResolutionError.java:42)
>         at
> org.apache.felix.resolver.ResolverImpl.doResolve(ResolverImpl.java:391)
>         at
> org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:377)
>         at
> org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:331)
>         at
> org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:248)
>         at
> org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:388)
>         at
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1025)
>         at
> org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:964)
>         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>         at java.lang.Thread.run(Thread.java:748)
> Error executing command: Unable to resolve root: missing requirement [root]
> osgi.identity; osgi.identity=karaf-jpa-example-provider; type=karaf.feature;
> version="[4.2.0.SNAPSHOT,4.2.0.SNAPSHOT]";
> filter:="(&(osgi.identity=karaf-jpa-example-provider)(type=karaf.feature)(version>=4.2.0.SNAPSHOT)(version<=4.2.0.SNAPSHOT))"
> [caused by: Unable to resolve karaf-jpa-example-provider/4.2.0.SNAPSHOT:
> missing requirement [karaf-jpa-example-provider/4.2.0.SNAPSHOT]
> osgi.identity;
> osgi.identity=org.apache.karaf.examples.karaf-jpa-example-provider;
> type=osgi.bundle; version="[4.2.0.SNAPSHOT,4.2.0.SNAPSHOT]";
> resolution:=mandatory [caused by: Unable to resolve
> org.apache.karaf.examples.karaf-jpa-example-provider/4.2.0.SNAPSHOT: missing
> requirement
> [org.apache.karaf.examples.karaf-jpa-example-provider/4.2.0.SNAPSHOT]
> osgi.service; objectClass=javax.persistence.spi.PersistenceProvider;
> javax.persistence.provider=org.hibernate.jpa.HibernatePersistenceProvider;
> effective:=active]]
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>

--
--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: JPA (Hibernate) with Apache Karaf 4.2

alex09
In reply to this post by Tim Ward-2
Thanks, yes I tried it and it worked (though in the UI the Delete button
doesn't work, but that might be a UI issue)! However, it wopuld be great to
have this running in Karaf and if I try this, it fails with different
exceptions, so I assume that's not supposed to be that runtime-independent.
However, for others reading this, it was the only example which worked OOTB
and has explanations in it as well, together with the other enRoute docs
it's a good starting point (for IDEA users like me: Eclipse is no
requirement!)



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Reply | Threaded
Open this post in threaded view
|

Re: JPA (Hibernate) with Apache Karaf 4.2

jbonofre
Hi Alex,

fully agree, we are on the Karaf mailing list after all ;)

Did you see my latest e-mail about the example ?

Regards
JB

On 30/05/2018 15:09, alex09 wrote:

> Thanks, yes I tried it and it worked (though in the UI the Delete button
> doesn't work, but that might be a UI issue)! However, it wopuld be great to
> have this running in Karaf and if I try this, it fails with different
> exceptions, so I assume that's not supposed to be that runtime-independent.
> However, for others reading this, it was the only example which worked OOTB
> and has explanations in it as well, together with the other enRoute docs
> it's a good starting point (for IDEA users like me: Eclipse is no
> requirement!)
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>

--
--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: JPA (Hibernate) with Apache Karaf 4.2

alex09
In reply to this post by jbonofre
Yes, installed hibernate/4.3.6.Final after installing enterprise-legacy



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Reply | Threaded
Open this post in threaded view
|

Re: JPA (Hibernate) with Apache Karaf 4.2

alex09
In reply to this post by jbonofre
Not sure if I get this right, I just built from the DEV_GUIDE branch?



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Reply | Threaded
Open this post in threaded view
|

Re: JPA (Hibernate) with Apache Karaf 4.2

jbonofre
Let me rebase, that will be easier.

Regards
JB

On 30/05/2018 16:37, alex09 wrote:
> Not sure if I get this right, I just built from the DEV_GUIDE branch?
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>

--
--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: JPA (Hibernate) with Apache Karaf 4.2

Kerry
In reply to this post by alex09
Alex,

Are you building on the master branch from the top-level pom?

Kerry


On 30/05/18 11:57, alex09 wrote:

> Thanks Kerry!
>
> When building simple-commands, an artefact is missing:
>
>          <dependency>
>              <groupId>com.javatechnics.jpa</groupId>
>              <artifactId>simple</artifactId>
>              <version>1.0.0-SNAPSHOT</version>
>              <scope>provided</scope>
>          </dependency>
>
> Does this have to be installed seperately?
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>

Reply | Threaded
Open this post in threaded view
|

Re: JPA (Hibernate) with Apache Karaf 4.2

Tim Jones
In reply to this post by alex09
Hi Alex,

while I recognise this does not answer your question I thought it might help
being that you stated you are new OSGi and you asked  "as there are better
practices for persistence in OSGi?"

Are you aware of the broader OSGi landscape regarding Declarative
Services/Bluerprint/POJO/Everit components/CDI + other. If you come to a
point where you are about to embark upon a significant piece of work it may
pay to do some reading on this.

Not a great analogy but it would be a bit like starting with an example
based on JEE not knowing that the Spring framework existed. You may latter
have then wished you had known about the Spring framework to make a more
strategic decision as to what framework you wanted to base your application.

The example you are working with is based upon Aries Blueprint, the are
other examples based upon DS e.g the enRoute example
https://enroute.osgi.org/tutorial/032-tutorial_microservice-jpa.html, each
has it's pros and cons.

The following is worth a read
http://karaf.922171.n3.nabble.com/Blueprint-or-DS-or-what-to-use-td4045845.html


Regards,

Tim Jones




--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Reply | Threaded
Open this post in threaded view
|

Re: JPA (Hibernate) with Apache Karaf 4.2

alex09
Hi Tim,

thanks for these valuable hints, I am aware that these different approaches
exist and I am currently getting into this. For me, Blueprint kind of
resembles Spring (where I come from) and DS CDI/JEE, but I know that these
are not really synonyms. But that's why I want to try out different
approaches to get used to the OSGi universe.
But to be able to get into this, working examples for each technology work
best for me. However, I will have to go with Blueprint and not DS as the
application I am working on is based on this.
However, if I had ti start with a greenfield project, I'd probably go more
for DS and the enRoute approach.

Best

Alex



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Reply | Threaded
Open this post in threaded view
|

Re: JPA (Hibernate) with Apache Karaf 4.2

alex09
In reply to this post by Kerry
Hi Kerry,

yes, I cloned master of jpatest and started building with `mvn clean
install` with this result:

[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 13.522 s
[INFO] Finished at: 2018-06-01T22:10:45+02:00
[INFO]
------------------------------------------------------------------------
[ERROR] Failed to execute goal on project simple-commands: Could not resolve
dependencies for project
com.javatechnics.jpa:simple-commands:bundle:1.0.0-SNAPSHOT: Could not find
artifact com.javatechnics.jpa:simple:jar:1.0.0-SNAPSHOT -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please
read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the
command
[ERROR]   mvn <goals> -rf :simple-commands




--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Reply | Threaded
Open this post in threaded view
|

Re: JPA (Hibernate) with Apache Karaf 4.2

Kerry
Alex,

thanks for letting me know. I didn't rename a dependency in the simple-commands module when I renamed 'simple' to 'simple-dao'. I've pushed up a fix to master.

Kerry


On 01/06/18 21:12, alex09 wrote:

> Hi Kerry,
>
> yes, I cloned master of jpatest and started building with `mvn clean
> install` with this result:
>
> [INFO] BUILD FAILURE
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 13.522 s
> [INFO] Finished at: 2018-06-01T22:10:45+02:00
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] Failed to execute goal on project simple-commands: Could not resolve
> dependencies for project
> com.javatechnics.jpa:simple-commands:bundle:1.0.0-SNAPSHOT: Could not find
> artifact com.javatechnics.jpa:simple:jar:1.0.0-SNAPSHOT -> [Help 1]
> [ERROR]
> [ERROR] To see the full stack trace of the errors, re-run Maven with the -e
> switch.
> [ERROR] Re-run Maven using the -X switch to enable full debug logging.
> [ERROR]
> [ERROR] For more information about the errors and possible solutions, please
> read the following articles:
> [ERROR] [Help 1]
> http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
> [ERROR]
> [ERROR] After correcting the problems, you can resume the build with the
> command
> [ERROR]   mvn <goals> -rf :simple-commands
>
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>

12