This is not easy...

I try to lower the JPA requirements on the persistence-api feature to not
allo 2.1.0 as follows:

*...*
*    <feature name="jpa" description="OSGi Persistence Container"
version="2.3.0">*
*        <details>JPA implementation provided by Apache Aries JPA 2.x. NB:
this feature doesn't provide the JPA engine, you have to install one by
yourself (OpenJPA for instance)</details>*
*        <feature version="[1.1,2)" prerequisite="false"
dependency="false">transaction-api</feature>*
*        <feature version="[2.0.0,2.2.0)" prerequisite="false"
dependency="false">persistence-api</feature>*
*...*

to
*...*
*    <feature name="jpa" description="OSGi Persistence Container"
version="2.3.0">*
*        <details>JPA implementation provided by Apache Aries JPA 2.x. NB:
this feature doesn't provide the JPA engine, you have to install one by
yourself (OpenJPA for instance)</details>*
*        <feature version="[1.1,2)" prerequisite="false"
dependency="false">transaction-api</feature>*
*        <feature version="[2.0.0,2.1.0)" prerequisite="false"
dependency="false">persistence-api</feature>*
*...*

But I then get this:

*org.osgi.service.resolver.ResolutionException: Unable to resolve root:
missing requirement [root] osgi.identity; osgi.identity=connect-skandia;
type=karaf.feature; version="[2.8.0.SNAPSHOT,2.8.0.SNAPSHOT]";
filter:="(&(osgi.identity=connect-skandia)(type=karaf.feature)(version>=2.8.0.SNAPSHOT)(version<=2.8.0.SNAPSHOT))"
[caused by: Unable to resolve connect-skandia/2.8.0.SNAPSHOT: missing
requirement [connect-skandia/2.8.0.SNAPSHOT] osgi.identity;
osgi.identity=connect-filetransfer-history-db; type=karaf.feature;
version="[2.8.0.SNAPSHOT,2.8.0.SNAPSHOT]" [caused by: Unable to resolve
connect-filetransfer-history-db/2.8.0.SNAPSHOT: missing requirement
[connect-filetransfer-history-db/2.8.0.SNAPSHOT] osgi.identity;
osgi.identity=jpa; type=karaf.feature; version="[2.3.0,2.3.0]" [caused by:
Unable to resolve jpa/2.3.0: missing requirement [jpa/2.3.0] osgi.identity;
osgi.identity=org.apache.aries.jpa.container; type=osgi.bundle;
version="[2.3.0,2.3.0]"; resolution:=mandatory [caused by: Unable to
resolve org.apache.aries.jpa.container/2.3.0: missing requirement
[org.apache.aries.jpa.container/2.3.0] osgi.wiring.package;
filter:="(&(osgi.wiring.package=org.osgi.service.jpa)(version>=1.0.0)(!(version>=2.0.0)))"]]]]*

It seems like the or.apache.aries.jpa.container requires the package
org.osgi.service.jpa (at least version 1.0.0) and that package is only
provided by the JPA 2.1 bundle...

Hope you understand this a bit better than me but it does not seem to be
easy to come up with a working solution including OpenJPA 2.4.1 in Karar
4.0.5. If you have a workaround to try before you get a fix inte Karaf
4.0.6 I would be grateful.

/Bengt



2016-07-07 14:17 GMT+02:00 Bengt Rodehav <[email protected]>:

> OK - thanks a lot for all your help Christian.
>
> /Bengt
>
>
> 2016-07-07 14:14 GMT+02:00 Christian Schneider <[email protected]>:
>
>> Genereally Aries JPA should work with OpenJPA 2.4.1 but I think there is
>> some bug in karaf 4.0.5.
>>
>> I just tested again and found that persistence api 2.0 and 2.1 are both
>> installed. This fails as Aries JPA can only bind to one of these and will
>> choose the higher version.
>> As a workaround you should be able to create your own feature copied from
>> the Aries JPA feature but make sure you install the persistence api only in
>> version 2.0.
>>
>> I will try to create a working version of the features for karaf 4.0.6.
>>
>> Christian
>>
>>
>>
>> On 07.07.2016 14:07, Bengt Rodehav wrote:
>>
>> Installing feature "openjpa" also installs JPA 2.0 (version 1.1) so I
>> shouldn't need to install JPA manually as well. However, then I won't get
>> the Aries support for JPA. Feels a bit weird.
>>
>> What Aries JPa version should be used together with OpenJPA 2.4.1?
>>
>> /Bengt
>>
>> 2016-07-07 14:04 GMT+02:00 Bengt Rodehav <[email protected]>:
>>
>>> It seems to be the "jpa" feature that installs JPA 2.1.
>>>
>>> 2016-07-07 13:58 GMT+02:00 Bengt Rodehav < <[email protected]>
>>> [email protected]>:
>>>
>>>> On a fresh Karaf 4.0.5 I do:
>>>>
>>>> *la | grep -i jpa*
>>>> *la | grep -i persistence*
>>>>
>>>> Nothing is displayed. I then do:
>>>>
>>>>
>>>> *feature:install openjpa jpa *
>>>>
>>>> If I then execute the above commands I get:
>>>>
>>>> *karaf@root()> la | grep -i jpa*
>>>> *62 | Active   |  80 | 2.3.0               | Apache Aries JPA Container
>>>> API*
>>>> *63 | Active   |  80 | 2.3.0               | Apache Aries JPA blueprint*
>>>> *64 | Active   |  80 | 2.3.0               | Apache Aries JPA container*
>>>> *65 | Active   |  80 | 2.3.0               | Apache Aries JPA support*
>>>> *71 | Active   |  80 | 1.1                 | Apache Geronimo JSR-317
>>>> JPA 2.0 Spec AP*
>>>> *73 | Active   |  80 | 2.4.1               | OpenJPA Aggregate Jar*
>>>> *karaf@root()> la | grep -i persistence*
>>>> *55 | Active   |  80 | 2.1.0.v201304241213 | Java Persistence API 2.1*
>>>> *karaf@root()>*
>>>>
>>>> So JPA 2.1 has indeed been installed. I don't know if this is why I
>>>> have problems but it still seems strange.
>>>>
>>>> /Bengt
>>>>
>>>>
>>>> 2016-07-07 13:11 GMT+02:00 Christian Schneider <[email protected]
>>>> >:
>>>>
>>>>> Can you start from an empty karaf 4.0.5 and then do
>>>>>
>>>>> feature:install openjpa jpa
>>>>>
>>>>> This should install openjpa 2.4.1 and aries jpa 2.3.0 with
>>>>> javax.persistence 2.0 and jta 1.2.
>>>>>
>>>>> This configuration should work. So maybe something else you install
>>>>> requires the jpa 2.1 spec.
>>>>>
>>>>> Christian
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On 07.07.2016 10:28, Bengt Rodehav wrote:
>>>>>
>>>>> Reading your post again Christian I realize that I should not use JPA
>>>>> 2.1 but JPA 2.0.
>>>>>
>>>>> I seem to have JPA 2.0 and JPA 2.1 installed at runtime:
>>>>>
>>>>> *karaf@root()> la | grep -i jpa*
>>>>> * 37 | Active   |  80 | 2.3.0                 | Apache Aries JPA
>>>>> Container API*
>>>>> * 38 | Active   |  80 | 2.3.0                 | Apache Aries JPA
>>>>> blueprint*
>>>>> * 39 | Active   |  80 | 2.3.0                 | Apache Aries JPA
>>>>> container*
>>>>> * 40 | Active   |  80 | 2.3.0                 | Apache Aries JPA
>>>>> support*
>>>>> * 70 | Active   |  80 | 1.1                   | Apache Geronimo
>>>>> JSR-317 JPA 2.0 Spec API*
>>>>> *106 | Active   |  80 | 2.4.1                 | OpenJPA Aggregate Jar*
>>>>> *karaf@root()> la | grep -i persistence*
>>>>> * 17 | Active   |  80 | 2.1.0.v201304241213   | Java Persistence API
>>>>> 2.1*
>>>>> *175 | Active   |  80 | 2.8.0.SNAPSHOT        | Connect ::
>>>>> persistence-util*
>>>>>
>>>>> I don't really know why the JPA version 2.1 (2.1.0.v201304241213) is
>>>>> being installed. I do not do this explicitly.
>>>>>
>>>>> Looking at OpenJPA 2.4.1, it seems to depend on JTA 1.1 not JTA 1.2.
>>>>>
>>>>> Looked again at my JPA version. I do use JPA 2.0. But I use version
>>>>> 1.1 of artifact geronimo-jpa_2.0_spec which caused me to believe I was
>>>>> using JPA 1.1....
>>>>>
>>>>> I'm still kind of confused. It would be thankful if you could tell me
>>>>> what features (and versions of those features) I should install in order 
>>>>> to
>>>>> use the latest version (2.4.1) of OpenJPA.
>>>>>
>>>>> /Bengt
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Christian Schneiderhttp://www.liquid-reality.de
>>>>>
>>>>> Open Source Architecthttp://www.talend.com
>>>>>
>>>>>
>>>>
>>>
>>
>>
>> --
>> Christian Schneiderhttp://www.liquid-reality.de
>>
>> Open Source Architecthttp://www.talend.com
>>
>>
>

Reply via email to