Hi,

The error you are seeing is because there are no OSGi compatible JPA providers 
in your OSGi framework. By OSGi compatible, I mean providers that register 
their PersistenceProvider implementation in the OSGi service registry as 
defined in the JPA service specification.

I see that you are choosing to use DataNucleus. I have not tried this provider 
with Aries, and whilst there is no reason that it should not work I am unsure 
as to whether they correctly expose their PersistenceProvider implementation in 
the OSGi service registry.

This problem should be simple to fix. If you change the DataNucleus bundle to 
include blueprint metadata that exposes the 
"org.datanucleus.jpa.PersistenceProviderImpl" class as a service using the 
javax.persistence.spi.PersistenceProvider interface, and with a service 
property of "javax.persistence.provider" with a value of 
"org.datanucleus.jpa.PersistenceProviderImpl".

An example blueprint snippet would be as follows:

<bean id="pp" class="org.datanucleus.jpa.PersistenceProviderImpl"/>

<service interface="javax.persistence.spi.PersistenceProvider" ref="pp">
  <service-properties>
    <entry key="javax.persistence.provider" 
value="org.datanucleus.jpa.PersistenceProviderImpl"/>
  </service-properties>
</service>


Regards,

Tim



________________________________
> Date: Wed, 17 Nov 2010 19:51:35 +0200
> Subject: Aries JPA Issue
> From: ioca...@gmail.com
> To: aries-user@incubator.apache.org
>
> Hi,
>
> I am trying to build an application that uses aries jpa and deploy it
> to karaf.
> My application is similar to the blog sample application provided by aries.
> Inside my application I have a bundle that contains the persistence
> unit, my entities and a DAO (as an OSGi service via bleuprint xml).
>
> This bundle falls in GracePeriod status, beacause it can't find the
> EntityManagerFactory(?):
>
> Here is what I get in my log:
>
> Found initial references null for OSGi service
> (&(&(org.apache.aries.jpa.proxy.factory=*)(osgi.unit.name=wicket-osgi-pu))(objectClass=javax.persistence.EntityManagerFactory))
>
> 18:36:45,823 | WARN | l Console Thread |
> container | er.impl.PersistenceBundleManager
> 564 | 171 - org.apache.aries.jpa.container - 0.2.0.incubating | There
> are no providers available.
>
> My persistence.xml:
>
>
> > xmlns="http://java.sun.com/xml/ns/persistence";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
> http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd";>
>
> org.datanucleus.jpa.PersistenceProviderImpl
>
> aries:services/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/blogdb)
> net.iocanel.database.entities.Person
>
>
>
> My blueprint.xml
>
>
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0";
> xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.0.0";
> xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
> http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd";
> default-activation="lazy">
>
> > class="net.iocanel.database.dao.PersonJpaDAO">
>
> > unitname="wicket-osgi-pu" />
>
>
> > interface="net.iocanel.database.dao.PersonDAO">
>
>
>
> --
> Ioannis Canellos
> http://iocanel.blogspot.com
> Integration Engineer @ Upstream S.A.
>
>
                                          

Reply via email to