Bengt Rodehav created KARAF-4615:
------------------------------------

             Summary: 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


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)

Reply via email to