Hello,

I tried to work with last SNAPSHOT of karat 3.0.2 and i can be able to run JPA 
2.1 with eclipselinks 2.5.2. This is the procedure to install eclipselink 2.5.2:

karaf@root()> feature:install jdbc
karaf@root()> feature:install jndi
karaf@root()> feature:install transaction
karaf@root()> feature:install jpa
karaf@root()> list -t 0 | grep -i hibernate-jpa
91 | Active   |  30 | 1.0.0.Final           | hibernate-jpa-2.1-api             
                                 
karaf@root()> uninstall -f 91
karaf@root()> install -s mvn:org.eclipse.persistence/javax.persistence/2.1.0
Bundle ID: 96
karaf@root()> install -s 
mvn:org.eclipse.persistence/org.eclipse.persistence.antlr/2.5.2
Bundle ID: 97
karaf@root()> install -s 
mvn:org.eclipse.persistence/org.eclipse.persistence.asm/2.5.2
Bundle ID: 98
karaf@root()> install -s 
mvn:org.eclipse.persistence/org.eclipse.persistence.core/2.5.2
Bundle ID: 99
karaf@root()> install -s 
mvn:org.eclipse.persistence/org.eclipse.persistence.jpa.jpql/2.5.2
Bundle ID: 100
karaf@root()> install -s 
mvn:org.eclipse.persistence/org.eclipse.persistence.jpa/2.5.2
Bundle ID: 101
karaf@root()> list
START LEVEL 100 , List Threshold: 50
 ID | State  | Lvl | Version                 | Name                           
------------------------------------------------------------------------------
 79 | Active |  80 | 1.6.0                   | Commons Pool                   
 80 | Active |  80 | 1.4                     | Commons DBCP                   
 81 | Active |  80 | 3.0.2.SNAPSHOT          | Apache Karaf :: JDBC :: Core   
 82 | Active |  80 | 3.0.2.SNAPSHOT          | Apache Karaf :: JDBC :: Command
 90 | Active |  80 | 3.0.2.SNAPSHOT          | Apache Karaf :: JNDI :: Command
 96 | Active |  80 | 2.1.0.v201304241213     | Java Persistence API 2.1       
 97 | Active |  80 | 3.2.0.v201302191141     | EclipseLink ANTLR              
 98 | Active |  80 | 3.3.1.v201302191223     | EclipseLink ASM                
 99 | Active |  80 | 2.5.2.v20140319-9ad6abd | EclipseLink Core               
100 | Active |  80 | 2.5.2.v20140319-9ad6abd | EclipseLink Hermes Parser      
101 | Active |  80 | 2.5.2.v20140319-9ad6abd | EclipseLink JPA                
karaf@root()> ^D

Deploy eclipselink provider:

create file deploy/eclipselink-provider.xml 

<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
           
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0";>
    
    <manifest xmlns="http://karaf.apache.org/xmlns/deployer/blueprint/v1.0.0";>
        Bundle-Version: 1.0.0
        Bundle-Description: Eclipselink JPA Provider
        Bundle-Name: EclipseLink JPA Provider
        Bundle-SymbolicName: org.eclipse.persistence.jpa.PersistenceProvider
    </manifest>

    <bean id="ECLIPSELINK_PERSISTENCE_PROVIDER"
      class="org.eclipse.persistence.jpa.PersistenceProvider">
    </bean>

    <service ref = "ECLIPSELINK_PERSISTENCE_PROVIDER"
             interface = "javax.persistence.spi.PersistenceProvider">
        <service-properties>
            <entry key = "org.apache.aries.jpa.proxy.factory" value="true"/>
            <entry key = "osgi.jndi.service.name"
                   value = "eclipselink.persistence.provider"/>
            <entry key = "osgi.unit.provider"
                   value = "org.eclipse.persistence.jpa.PersistenceProvider"/>
            <entry key = "javax.persistence.provider"
                   value = "org.eclipse.persistence.jpa.PersistenceProvider"/>
            <entry key = "javax.persistence.spi.PersistenceProvider"
                   value = "org.eclipse.persistence.jpa.PersistenceProvider"/>
            <entry key = "javax.persistence.PersistenceProvider"
                   value = "org.eclipse.persistence.jpa.PersistenceProvider"/>
        </service-properties>
    </service>
</blueprint> 

This is the final installation:

karaf@root()> list
START LEVEL 100 , List Threshold: 50
 ID | State  | Lvl | Version                 | Name                           
------------------------------------------------------------------------------
 79 | Active |  80 | 1.6.0                   | Commons Pool                   
 80 | Active |  80 | 1.4                     | Commons DBCP                   
 81 | Active |  80 | 3.0.2.SNAPSHOT          | Apache Karaf :: JDBC :: Core   
 82 | Active |  80 | 3.0.2.SNAPSHOT          | Apache Karaf :: JDBC :: Command
 90 | Active |  80 | 3.0.2.SNAPSHOT          | Apache Karaf :: JNDI :: Command
 96 | Active |  80 | 2.1.0.v201304241213     | Java Persistence API 2.1       
 97 | Active |  80 | 3.2.0.v201302191141     | EclipseLink ANTLR              
 98 | Active |  80 | 3.3.1.v201302191223     | EclipseLink ASM                
 99 | Active |  80 | 2.5.2.v20140319-9ad6abd | EclipseLink Core               
100 | Active |  80 | 2.5.2.v20140319-9ad6abd | EclipseLink Hermes Parser      
101 | Active |  80 | 2.5.2.v20140319-9ad6abd | EclipseLink JPA                
102 | Active |  80 | 1.0.0                   | EclipseLink JPA Provider       

Some warning regarding to XML parser and messages from eclipselink are showed 
to stdout.

hibernate-jpa-2.1-api bundle need to by uninstalled because eclipselink have a 
dependency to bundle org.eclipse.persistence/javax.persistence/2.1.0 and these 
two bundle provide the same clases. The final effect are a confusion between 
Aries JPA and users bundle with class cast exception.

There is a extra trick, i don’t know why, but is necessary to add some package  
import in the bundle with persistence unit definition. This is the section 
needed for maven-bundle-plugin:

<Import-Package>
    org.eclipse.persistence.internal.weaving,
    org.eclipse.persistence.internal.descriptors,
    org.eclipse.persistence.queries,
    org.eclipse.persistence.descriptors.changetracking,
    org.eclipse.persistence.internal.identitymaps,
    org.eclipse.persistence.sessions,
    org.eclipse.persistence.internal.jpa.rs.metadata.model,
    org.eclipse.persistence.indirection,
    *
</Import-Package>

I hope this can be usefully to make eclipselink feature :)

Regards,
Rodrigo

El 22/07/2014, a las 09:03, Jean-Baptiste Onofré <[email protected]> escribió:

> Hi Rodrigo,
> 
> I released Aries JPA 1.0.2 which now supports JPA 2.1.
> Karaf 3.0.2-SNAPSHOT is already updated to this version and so supports JPA 
> 2.1.
> 
> I didn't work on the eclipselink feature yet.
> 
> Regards
> JB
> 
> On 07/22/2014 01:49 PM, Rodrigo Serra wrote:
>> Hello everybody,
>> 
>> Any news about JPA 2.1 and feature eclipselink? Is already in branch karat 
>> 3.0.2?
>> 
>> Regards
>> Rodrigo
>> 
>> El 10/07/2014, a las 12:44, Jean-Baptiste Onofré <[email protected]> 
>> escribió:
>> 
>>> 3.0.2 is planned in two weeks (you can see the release schedule on the 
>>> website).
>>> 
>>> It's not yet on trunk as I didn't push the Aries change yet. I will do it 
>>> during the week end "max".
>>> 
>>> Regards
>>> JB
>>> 
>>> On 07/10/2014 05:39 PM, Rodrigo Serra wrote:
>>>> Thank for you fast response JB.
>>>> 
>>>> Is already in trunk? What is the release time for 3.0.2?
>>>> 
>>>> Regards,
>>>> Rodrigo
>>>> 
>>>> El 10/07/2014, a las 12:00, Jean-Baptiste Onofré <[email protected]> 
>>>> escribió:
>>>> 
>>>>> Hi Rodrigo,
>>>>> 
>>>>> no, JPA 2.1 will be supported in 3.0.2.
>>>>> 
>>>>> Regards
>>>>> JB
>>>>> 
>>>>> On 07/10/2014 04:57 PM, Rodrigo Serra wrote:
>>>>>> Hello,
>>>>>> 
>>>>>> Is supported eclipselink JPA 2.1 in Karaf 3.01?
>>>>>> 
>>>>>> Regards
>>>>>> Rodrigo
>>>>>> 
>>>>> 
>>>>> --
>>>>> Jean-Baptiste Onofré
>>>>> [email protected]
>>>>> http://blog.nanthrax.net
>>>>> Talend - http://www.talend.com
>>>> 
>>> 
>>> --
>>> Jean-Baptiste Onofré
>>> [email protected]
>>> http://blog.nanthrax.net
>>> Talend - http://www.talend.com
>> 
> 
> -- 
> Jean-Baptiste Onofré
> [email protected]
> http://blog.nanthrax.net
> Talend - http://www.talend.com

Reply via email to