Hi,

I use EclipseLink for JPA implementation in a custo Karaf distribution
and it work's well.

In my persistence feature pom I have this dependencies :

        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.core</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>osgi.cmpn</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- JPA -->
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>javax.persistence</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.aries.jpa</groupId>
            <artifactId>org.apache.aries.jpa.api</artifactId>
            <scope>provided</scope>
        </dependency>

and in my assembly this feature on boot :

                        <feature>jdbc</feature>
                        <feature>jndi</feature>
                        <feature>jpa</feature>
                      
                        <feature>transaction</feature>
                        <feature>eclipselink</feature>                

                        <feature>pax-jdbc</feature>
                        <feature>pax-jdbc-config</feature>
                        <feature>pax-jdbc-pool-hikaricp</feature>
                        <feature>pax-jdbc-pool-aries</feature>
                        <feature>pax-jdbc-postgresql</feature>


in the etc folder the database config file
"org.ops4j.datasource-mydatasource.cfg" :

osgi.jdbc.driver.class=org.postgresql.Driver
dataSourceName=my-datasource
databaseName=my-database
serverName=172.17.0.2
portNumber=5432
user=dbuser
password=dbpassword

Hope this help.

Le 21/11/2017 à 17:57, Alex Soto a écrit :
> Does anybody know a good, simple step by step tutorial on how to
> quickly start using JPA 2.1 with Karaf 4.1.3?
> At this point I am not requiring any specific JPA
> implementation/version (Hibernate vs. any other).
> So far using Karaf’s default has not worked for me.  I would expect
> Karaf’s defaults should work out our the box.
>
>
>> On Nov 20, 2017, at 2:54 PM, Jean-Baptiste Onofré <j...@nanthrax.net
>> <mailto:j...@nanthrax.net>> wrote:
>>
>> Ok, I see hibernate now. Let me check if I see the jpa spec bundle.
>>
>> Regards
>> JB
>> On Nov 20, 2017, at 20:42, Alex Soto <alex.s...@envieta.com
>> <mailto:alex.s...@envieta.com>> wrote:
>>
>>     Thank you JB for the quick response.  
>>     OK, so I installed the jpa feature:
>>
>>     feature:install jpa
>>
>>     karaf@root()> list
>>     START LEVEL 100 , List Threshold: 50
>>      ID │ State     │ Lvl │ Version            │ Name
>>     
>> ────┼───────────┼─────┼────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
>>      28 │ Active    │  80 │ 4.1.3              │ Apache Karaf :: OSGi
>>     Services :: Event
>>      52 │ Active    │  80 │ 1.3.0              │ ClassMate
>>      53 │ Active    │  80 │ 3.20.0.GA          │ Javassist
>>      54 │ Active    │  80 │ 1.2                │ javax.interceptor API
>>      55 │ Active    │  80 │ 1.6.6              │ Byte Buddy (without
>>     dependencies)
>>      56 │ Active    │  80 │ 2.7.7.5            │ Apache ServiceMix ::
>>     Bundles :: antlr
>>      57 │ Active    │  80 │ 1.6.1.5            │ Apache ServiceMix ::
>>     Bundles :: dom4j
>>      58 │ Active    │  80 │ 5.0.1.Final        │
>>     hibernate-commons-annotations
>>      59 │ Active    │  80 │ 5.2.8.Final        │ hibernate-core
>>      60 │ Active    │  80 │ 1.0.0.Final        │ hibernate-jpa-2.1-api
>>      61 │ Active    │  80 │ 5.2.8.Final        │ hibernate-osgi
>>      62 │ Active    │  80 │ 2.0.3.Final        │ Java Annotation Indexer
>>      63 │ Active    │  80 │ 3.3.0.Final        │ JBoss Logging 3
>>      65 │ Active    │  80 │ 1.9.2.1            │ Apache ServiceMix ::
>>     Bundles :: jasypt
>>      66 │ Active    │  80 │ 1.1.0              │ OPS4J Pax JDBC Config
>>      67 │ Active    │  80 │ 1.1.0              │ OPS4J Pax JDBC
>>     Pooling Support Base
>>      68 │ Active    │  80 │ 1.0.0.201505202023 │
>>     org.osgi:org.osgi.service.jdbc
>>      69 │ Active    │  80 │ 1.3.172            │ H2 Database Engine
>>     117 │ Active    │  80 │ 1.2.0              │ CDI APIs
>>     118 │ Active    │  80 │ 1.2                │ javax.transaction API
>>     119 │ Active    │  80 │ 1.1.1              │ Apache Aries
>>     Transaction Blueprint
>>     120 │ Active    │  80 │ 2.1.0              │ Apache Aries
>>     Transaction Blueprint
>>     121 │ Active    │  80 │ 1.3.3              │ Apache Aries
>>     Transaction Manager
>>     122 │ Active    │  80 │ 1.0.2              │ Apache Felix
>>     Coordinator Service
>>     123 │ Active    │  80 │ 1.0.0.2            │ Apache ServiceMix ::
>>     Bundles :: javax.inject
>>     124 │ Installed │  80 │ 2.7.0.SNAPSHOT     │ Apache Aries JPA
>>     example tasklist model
>>     125 │ Active    │  80 │ 2.6.1              │ Apache Aries JPA
>>     Container API
>>     126 │ Active    │  80 │ 2.6.1              │ Apache Aries JPA
>>     blueprint
>>     127 │ Active    │  80 │ 2.6.1              │ Apache Aries JPA
>>     container
>>     128 │ Active    │  80 │ 2.6.1              │ Apache Aries JPA support
>>     129 │ Active    │  80 │ 1.1.1              │ geronimo-jms_1.1_spec
>>     130 │ Active    │  80 │ 1.7.0.6            │ Apache ServiceMix ::
>>     Bundles :: antThe same problem persists
>>
>>     And
>>
>>     karaf@root()> bundle:diag 124
>>     Apache Aries JPA example tasklist model (124)
>>     ---------------------------------------------
>>     Status: Installed
>>     Unsatisfied Requirements:
>>     [org.apache.aries.jpa.example.tasklist.model [124](R 124.0)]
>>     osgi.service; (osgi.jndi.service.name=tasklist)
>>     [org.apache.aries.jpa.example.tasklist.model [124](R 124.0)]
>>     osgi.contract; (&(osgi.contract=JavaJPA)(version=2.1.0))
>>     Declarative Services
>>
>>
>>     Or is it something else I need to install?
>>
>>     Best regards,
>>
>>     Alex soto
>>     alex.s...@envieta.com <mailto:alex.s...@envieta.com>
>>
>>
>>
>>>     On Nov 20, 2017, at 2:31 PM, Jean-Baptiste Onofré <
>>>     j...@nanthrax.net <mailto:j...@nanthrax.net>> wrote:
>>>
>>>     I don't see the jpa engine in your bundle list ? Openjpa,
>>>     hibernate, eclipselink ?
>>>     The jpa version depends of the engine.
>>>
>>>     Regards
>>>     JB
>>>     On Nov 20, 2017, at 20:09, Alex Soto < alex.s...@envieta.com
>>>     <mailto:alex.s...@envieta.com>> wrote:
>>>
>>>         Hello,
>>>
>>>         This is my first attempt to use JPA with Karaf, so I am
>>>         trying to follow example from  
>>>         https://github.com/apache/aries-jpa using Karaf 4.1.3, so
>>>         far unsuccessfully. 
>>>         On a clean Karaf I have installed the following:
>>>
>>>         feature:install hibernate-orm
>>>          feature:install pax-jdbc-config
>>>         feature:install pax-jdbc-h2
>>>         feature:install http-whiteboard
>>>         feature:install scr
>>>         feature:install transaction
>>>
>>>         Then I copied the data source config
>>>         file org.ops4j.datasource-tasklist.cfg to the Karaf’s etc
>>>         directory.
>>>
>>>         Now, when I install the first Example bundle:
>>>
>>>         *install -s 
>>> mvn:org.apache.aries.jpa.example/org.apache.aries.jpa.example.tasklist.model/2.7.0-SNAPSHOT*
>>>
>>>         Error executing command: Error installing bundles:
>>>         Unable to start
>>>         bundle 
>>> mvn:org.apache.aries.jpa.example/org.apache.aries.jpa.example.tasklist.model/2.7.0-SNAPSHOT:
>>>         org.osgi.framework.BundleException: Unable to
>>>         resolve org.apache.aries.jpa.example.tasklist.model [124](R
>>>         124.0): missing requirement
>>>         [org.apache.aries.jpa.example.tasklist.model [124](R
>>>         124.0)] osgi.contract;
>>>         (&(osgi.contract=JavaJPA)(version=2.1.0))
>>>         Unresolved requirements:
>>>         [[org.apache.aries.jpa.example.tasklist.model
>>>         [124](R 124.0)] osgi.contract;
>>>         (&(osgi.contract=JavaJPA)(version=2.1.0))]
>>>
>>>         *list*
>>>         START LEVEL 100 , List Threshold: 50
>>>          ID │ State  │ Lvl │ Version            │ Name
>>>         
>>> ────┼────────┼─────┼────────────────────┼───────────────────────────────────────────
>>>          28 │ Active │  80 │ 4.1.3              │ Apache Karaf ::
>>>         OSGi Services :: Event
>>>          52 │ Active │  80 │ 1.3.0              │ ClassMate
>>>          53 │ Active │  80 │ 3.20.0.GA          │ Javassist
>>>          54 │ Active │  80 │ 1.2                │ javax.interceptor API
>>>          55 │ Active │  80 │ 1.6.6              │ Byte Buddy
>>>         (without dependencies)
>>>          56 │ Active │  80 │ 2.7.7.5            │ Apache ServiceMix
>>>         :: Bundles :: antlr
>>>          57 │ Active │  80 │ 1.6.1.5            │ Apache ServiceMix
>>>         :: Bundles :: dom4j
>>>          58 │ Active │  80 │ 5.0.1.Final        │
>>>         hibernate-commons-annotations
>>>          59 │ Active │  80 │ 5.2.8.Final        │ hibernate-core
>>>          60 │ Active │  80 │ 1.0.0.Final        │ hibernate-jpa-2.1-api
>>>          61 │ Active │  80 │ 5.2.8.Final        │ hibernate-osgi
>>>          62 │ Active │  80 │ 2.0.3.Final        │ Java Annotation
>>>         Indexer
>>>          63 │ Active │  80 │ 3.3.0.Final        │ JBoss Logging 3
>>>          65 │ Active │  80 │ 1.9.2.1            │ Apache ServiceMix
>>>         :: Bundles :: jasypt
>>>          66 │ Active │  80 │ 1.1.0              │ OPS4J Pax JDBC Config
>>>          67 │ Active │  80 │ 1.1.0              │ OPS4J Pax JDBC
>>>         Pooling Support Base
>>>          68 │ Active │  80 │ 1.0.0.201505202023 │
>>>         org.osgi:org.osgi.service.jdbc
>>>          69 │ Active │  80 │ 1.3.172            │ H2 Database Engine
>>>         117 │ Active │  80 │ 1.2.0              │ CDI APIs
>>>         118 │ Active │  80 │ 1.2                │ javax.transaction API
>>>         119 │ Active │  80 │ 1.1.1              │ Apache Aries
>>>         Transaction Blueprint
>>>         120 │ Active │  80 │ 2.1.0              │ Apache Aries
>>>         Transaction Blueprint
>>>         121 │ Active │  80 │ 1.3.3              │ Apache Aries
>>>         Transaction Manager
>>>         122 │ Active │  80 │ 1.0.2              │ Apache Felix
>>>         Coordinator Service
>>>         123 │ Active │  80 │ 1.0.0.2            │ Apache ServiceMix
>>>         :: Bundles :: javax.injec
>>>
>>>         *bundle:diag 124*
>>>         Unsatisfied Requirements:
>>>         [org.apache.aries.jpa.example.tasklist.model [124](R 124.0)]
>>>         osgi.service; (osgi.jndi.service.name=tasklist)
>>>         [org.apache.aries.jpa.example.tasklist.model [124](R
>>>         124.0)] osgi.contract;
>>>         (&(osgi.contract=JavaJPA)(version=2.1.0))
>>>
>>>
>>>         Any idea how to troubleshoot this problem? 
>>>
>>>         Best regards,
>>>         Alex soto
>>>
>>>
>>>
>>
>

Reply via email to