You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Bengt Rodehav (JIRA)" <ji...@apache.org> on 2016/07/11 06:29:10 UTC

[jira] [Comment Edited] (KARAF-4615) Cannot get OpenJPA 2.4.1 to work due to JPA 2.1 being installed

    [ https://issues.apache.org/jira/browse/KARAF-4615?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15370249#comment-15370249 ] 

Bengt Rodehav edited comment on KARAF-4615 at 7/11/16 6:28 AM:
---------------------------------------------------------------

I think only supporting JPA 2.0 is not a problem (that's my workaround). Only supporting JPA 2.1 should also work but I think you need two separate Aries JPA features for that. For 2.0 my setup would work, for 2.1 the original setup would work (but doesn't work with OpenJPA since it does not work with JPA 2.1).

So, one way would be to provide two separate Aries JPA features: One for JPA 2.0 and one for JPA 2.1. Alternatively, if the osgi jpa spec package is the problem, replace the JPA 2.1 spec bundle with a bundle that does not also include the osgi jpa spec  packages.

Not sure how to support both JPA 2.0 and 2.1 in the same runtime container at the same time though.


was (Author: rodehav):
I think only supporting JPA 2.0 is not a problem (that's my workaround). Only supporting JPA 2.1 should also work but I think you need two separate Aries JPA features from that. For 2.0 my setup would work, for 2.1 the original setup would work (but doesn't work with OpenJPA since it does not work with JPA 2.1).

So, one way would be to provide two separate Aries JPA features: One for JPA 2.0 and one for JPA 2.1. Alternatively, if the osgi jpa spec package is the problem, replace the JPA 2.1 spec bundle with a bundle that does not also include the osgi jpa spec  packages.

Not sure how to support both JPA 2.0 and 2.1 in the same runtime container at the same time though.

> Cannot get OpenJPA 2.4.1 to work due to JPA 2.1 being installed
> ---------------------------------------------------------------
>
>                 Key: KARAF-4615
>                 URL: https://issues.apache.org/jira/browse/KARAF-4615
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-feature
>    Affects Versions: 4.0.5
>            Reporter: Bengt Rodehav
>            Assignee: Christian Schneider
>             Fix For: 4.0.6
>
>
> In order to use OpenJPA 2.4.1 both the "openjpa" (2.4.1) feature and the "jpa" (2.3.0) features need to be installed.
> However, OpenJPA needs JPA 2.0 - it does not work with JPA 2.1. But when installing the "jpa" (2.3.0) feature, JPA 2.1 is being installed.
> This has been discussed on the Karaf user list under the subject "Migrating from Karaf 2.4.1 to 4.0.5, JPA problems".
> I have, as a workaround, modified the enterprise-4.0.5-features.xml, feature "jpa" (2.3.0), as follows:
> * I have changed the version range for the peristence-api feature from [2.0.0,2.2.0) to [2.0.0,2.1.0). This disqualifies JPA 2.1 and instead cause JPA 2.0 to be installed.
> * The JPA 2.1 bundle seemed to be providing the package  org.osgi.service.jpa which is mandatory. I therefore added the following dependency:
> ** <bundle dependency="true">mvn:org.osgi/org.osgi.service.jpa/1.0.0</bundle>
> So my modified "jpa" (2.3.0) feature now looks like this:
> <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>
>     <bundle dependency="true">mvn:org.osgi/org.osgi.service.jpa/1.0.0</bundle>
>     <feature version="[2.0.0,2.1.0)" prerequisite="false" dependency="false">persistence-api</feature>
>     <bundle dependency="true">mvn:org.apache.felix/org.apache.felix.coordinator/1.0.2</bundle>
>     <bundle dependency="true">mvn:org.osgi/org.osgi.service.jdbc/1.0.0</bundle>
>     <bundle>mvn:org.apache.aries.jpa/org.apache.aries.jpa.api/2.3.0</bundle>
>     <bundle>mvn:org.apache.aries.jpa/org.apache.aries.jpa.container/2.3.0</bundle>
>     <bundle>mvn:org.apache.aries.jpa/org.apache.aries.jpa.support/2.3.0</bundle>
>     <conditional>
>         <condition>aries-blueprint</condition>
>         <bundle>mvn:org.apache.aries.jpa/org.apache.aries.jpa.blueprint/2.3.0</bundle>
>     </conditional>
> </feature>



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)