Hi all,
I've a little trouble to have JPA to work on Karaf 2.3.0 (JDK 1.7), I've
create a bundle that contains
- persistence unit
- blueprint descriptor

I've installed the required features:
karaf@bt>features:list -i
State         Version   Name        Repository             Description
[installed  ] [1.0.1  ] transaction karaf-enterprise-2.3.0 OSGi Transaction
Manager
[installed  ] [1.0.1  ] jpa         karaf-enterprise-2.3.0 OSGi Persistence
Container
[installed  ] [1.0.0  ] jndi        karaf-enterprise-2.3.0 OSGi Service
Registry JNDI access
[installed  ] [1.0.0  ] bt          bt-karaf-repo          
[installed  ] [2.3.0  ] config      karaf-2.3.0            Provide OSGi
ConfigAdmin support
[installed  ] [2.3.0  ] ssh         karaf-2.3.0            Provide a SSHd
server on Karaf
[installed  ] [2.3.0  ] management  karaf-2.3.0            Provide a JMX
MBeanServer and a set of MBeans in Karaf
[installed  ] [2.3.0  ] eventadmin  karaf-2.3.0            OSGi Event Admin
service specification for event-based communication

But when I deploy the bundle, it looks like Aries is not able to lookup the
persistence unit:

14:37:29,854|DEBUG|org.apache.aries.jpa.blueprint.aries                         
   
==> Creating blueprint injection metadata to inject the unit BT-IO-FIX into
bean property entityManagerFactory
14:37:29,855|DEBUG|.apache.aries.blueprint.container.AbstractServiceReferenceRecipe
==> Found initial references null for OSGi service
(&(&(!(org.apache.aries.jpa.proxy.factory=*))(osgi.unit.name=BT-IO-FIX))(objectClass=javax.persistence.EntityManagerFactory))
14:37:29,855|DEBUG|org.apache.aries.blueprint.container.BlueprintContainerImpl  
   
==> Tracking service references: [.component-1]
14:37:29,855|INFO
|org.apache.aries.blueprint.container.BlueprintContainerImpl      ==> Bundle
bt.service.io.fix is waiting for dependencies
[(&(&(!(org.apache.aries.jpa.proxy.factory=*))(osgi.unit.name=BT-IO-FIX))(objectClass=javax.persistence.EntityManagerFactory))]
14:37:29,856|DEBUG|org.apache.aries.blueprint.container.BlueprintEventDispatcher
   
==> Sending blueprint container event BlueprintEvent[type=GRACE_PERIOD,
dependencies=[(&(&(!(org.apache.aries.jpa.proxy.factory=*))(osgi.unit.name=BT-IO-FIX))(objectClass=javax.persistence.EntityManagerFactory))]]
for bundle bt.service.io.fix
14:37:29,856|DEBUG|org.apache.karaf.shell.osgi.BlueprintListener                
   
==> Blueprint app state changed to GracePeriod for bundle 162


Below META-INF:MANIFEST.MF (generated by gradle osgi):
Manifest-Version: 1.0
Export-Package: bt.service.io.fix.factory;uses:="org.slf4j.spi,org.slf
 4j,quickfix,bt.core,javax.persistence",bt.service.io.fix;uses:="org.s
 lf4j,quickfix,org.apache.commons.lang3,bt.core,bt.core.util,org.osgi.
 framework,bt.core.session,bt.core.codec"
Private-Package: bt.service.io.fix.jpa.entity
Tool: Bnd-1.50.0
Bundle-Name: BT :: Service :: IO :: FIX
Created-By: 1.7.0_11 (Oracle Corporation)
JPA-PersistenceUnits: BT-IO-FIX
Meta-Persistence: META-INF/persistence.xml
Bundle-Version: 1.0.0
Bnd-LastModified: 1359704784000
Bundle-ManifestVersion: 2
Bundle-Description: BT :: Service :: IO :: FIX
Import-Package: bt.core,bt.core.codec,bt.core.session,bt.core.util,jav
 ax.persistence;version="[1.1,2)",org.apache.commons.lang3;version="[3
 .1,4)",org.osgi.framework;version="[1.6,2)",org.slf4j;version="[1.7,2
 )",org.slf4j.spi;version="[1.7,2)",quickfix
Bundle-SymbolicName: bt.service.io.fix


below META-INF/persistence.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<persistence
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd";
    xmlns="http://java.sun.com/xml/ns/persistence";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    version="2.0">

    <persistence-unit name="BT-IO-FIX" transaction-type="RESOURCE_LOCAL">
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
       
<non-jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/BTDS)</non-jta-data-source>
        <class>bt.service.io.fix.jpa.entity.FIXMessageEntity</class>
        <class>bt.service.io.fix.jpa.entity.FIXSessionEntity</class>
        <exclude-unlisted-classes>true</exclude-unlisted-classes>
        <properties>
            <property name="eclipselink.logging.level"                     
value="FINEST"/>
            <property name="eclipselink.logging.level.sql"                 
value="FINE"/>
            <property name="eclipselink.logging.parameters"                
value="true"/>
            <property name="eclipselink.logging.timestamp"                 
value="true"/>
            <property name="eclipselink.logging.session"                   
value="true"/>
            <property name="eclipselink.logging.thread"                    
value="true"/>
            <property name="eclipselink.logging.exceptions"                
value="true"/>
            <property name="eclipselink.session.include.descriptor.queries"
value="true"/>
        </properties>
    </persistence-unit>
</persistence>


Here OSGI-INF/blueprint/blueprint.xml:
<bean
      id    = "bt-service-core-io-fix-message-store-factory"
      class = "bt.service.io.fix.factory.FIXMessageStoreFactory"
      scope = "singleton">
      <jpa:unit property="entityManagerFactory" unitname="BT-IO-FIX"/>
</bean>

Do you see anything wrong in my setup?

Regards,
Luca 




--
View this message in context: 
http://karaf.922171.n3.nabble.com/Karaf-JPA-and-EclipseLink-tp4027571.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Reply via email to