You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@aries.apache.org by Ioannis Canellos <io...@gmail.com> on 2010/11/17 18:51:35 UTC

Aries JPA Issue

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:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" 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">
  <persistence-unit name="wicket-osgi-pu" transaction-type="RESOURCE_LOCAL">
     <provider>org.datanucleus.jpa.PersistenceProviderImpl</provider>
    <non-jta-data-source>aries:services/javax.sql.DataSource/(
osgi.jndi.service.name=jdbc/blogdb)</non-jta-data-source>
    <class>net.iocanel.database.entities.Person</class>
  </persistence-unit>
</persistence>

My blueprint.xml

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
        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">

        <bean id="personDAO"
                class="net.iocanel.database.dao.PersonJpaDAO">
                <tx:transaction method="*" value="Required" />
                <jpa:context property="entityManager"
unitname="wicket-osgi-pu" />
        </bean>

        <service ref="personDAO"
                interface="net.iocanel.database.dao.PersonDAO">
        </service>

</blueprint>
-- 
*Ioannis Canellos*
http://iocanel.blogspot.com
Integration Engineer @ Upstream S.A. <http://www.upstreamsystems.com>

Re: Aries JPA Issue

Posted by Ioannis Canellos <io...@gmail.com>.
I added inside datanucleus and it did the trick.

On Wed, Nov 17, 2010 at 9:29 PM, Ioannis Canellos <io...@gmail.com> wrote:

> Thanks for you response Tim.
>
> Indeed this is the root cause of the problem.
>
> I tried to deploy the blueprint xml snippet directly into karaf and it
> didn't work. I got some errors about class not found etc (I think that it
> should work).
>
> I will try to add it inside the data nucleus bundle to see if I have better
> luck.
>
> I wil let you know ...
>
> Thanks again.
>
>
>
> On Wed, Nov 17, 2010 at 9:03 PM, Timothy Ward <ti...@apache.org>wrote:
>
>>
>> Also, if this does fix your problem, please raise a JIRA against
>> DataNucleus to get their JPA provider registered according to the JPA
>> service specification. We want Aries to work with every JPA provider out
>> there!
>>
>> Regards,
>>
>> Tim
>>
>> ----------------------------------------
>> > From: timothyjward@apache.org
>> > To: aries-user@incubator.apache.org
>> > Subject: RE: Aries JPA Issue
>> > Date: Wed, 17 Nov 2010 19:01:15 +0000
>> >
>> >
>> > 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:
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > Regards,
>> >
>> > Tim
>> >
>> >
>> >
>> > ________________________________
>> > > Date: Wed, 17 Nov 2010 19:51:35 +0200
>> > > Subject: Aries JPA Issue
>> > > From: iocanel@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.
>> > >
>> > >
>> >
>>
>>
>
>
>
> --
> *Ioannis Canellos*
> http://iocanel.blogspot.com
>
> Integration Engineer @ Upstream S.A. <http://www.upstreamsystems.com>
>
>
>


-- 
*Ioannis Canellos*
http://iocanel.blogspot.com

Integration Engineer @ Upstream S.A. <http://www.upstreamsystems.com>

Re: Aries JPA Issue

Posted by Ioannis Canellos <io...@gmail.com>.
Thanks for you response Tim.

Indeed this is the root cause of the problem.

I tried to deploy the blueprint xml snippet directly into karaf and it
didn't work. I got some errors about class not found etc (I think that it
should work).

I will try to add it inside the data nucleus bundle to see if I have better
luck.

I wil let you know ...

Thanks again.


On Wed, Nov 17, 2010 at 9:03 PM, Timothy Ward <ti...@apache.org>wrote:

>
> Also, if this does fix your problem, please raise a JIRA against
> DataNucleus to get their JPA provider registered according to the JPA
> service specification. We want Aries to work with every JPA provider out
> there!
>
> Regards,
>
> Tim
>
> ----------------------------------------
> > From: timothyjward@apache.org
> > To: aries-user@incubator.apache.org
> > Subject: RE: Aries JPA Issue
> > Date: Wed, 17 Nov 2010 19:01:15 +0000
> >
> >
> > 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:
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Regards,
> >
> > Tim
> >
> >
> >
> > ________________________________
> > > Date: Wed, 17 Nov 2010 19:51:35 +0200
> > > Subject: Aries JPA Issue
> > > From: iocanel@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.
> > >
> > >
> >
>
>



-- 
*Ioannis Canellos*
http://iocanel.blogspot.com

Integration Engineer @ Upstream S.A. <http://www.upstreamsystems.com>

RE: Aries JPA Issue

Posted by Timothy Ward <ti...@apache.org>.
Also, if this does fix your problem, please raise a JIRA against DataNucleus to get their JPA provider registered according to the JPA service specification. We want Aries to work with every JPA provider out there!

Regards,

Tim

----------------------------------------
> From: timothyjward@apache.org
> To: aries-user@incubator.apache.org
> Subject: RE: Aries JPA Issue
> Date: Wed, 17 Nov 2010 19:01:15 +0000
>
>
> 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:
>
> 
>
> 
>   
>     
>   
> 
>
>
> Regards,
>
> Tim
>
>
>
> ________________________________
> > Date: Wed, 17 Nov 2010 19:51:35 +0200
> > Subject: Aries JPA Issue
> > From: iocanel@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.
> >
> >
>
 		 	   		  

RE: Aries JPA Issue

Posted by Timothy Ward <ti...@apache.org>.
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: iocanel@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.
>
>
 		 	   		  

RE: Aries JPA Issue

Posted by Timothy Ward <ti...@apache.org>.
Hi Ionnis, Charles

The aries:services URL scheme is actually still supported - it was originally developed by the aries team and then we helped to standardise support for it in the OSGi JNDI specification. The standard version obviously uses the OSGi name, but the correct syntax according to the specification would actually be:

osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/blogdb)

Note that this uses "service" not "services" in the lookup. I agree this is a confusing difference between the URL schemes, but arguably we made the wrong choice originally with aries as the lookup returns a single service, not multiple services. Obviously since this has been through two releases we can't change the aries URL scheme now, so we're stuck with the mismatch I'm afraid.

It is obviously preferrable for applications to use the standard syntax where possible, and the Aries JNDI code supports both URL schemes.

Regards,

Tim

________________________________
> Date: Thu, 18 Nov 2010 09:40:38 +0100
> From: cmoulliard@gmail.com
> To: aries-user@incubator.apache.org
> Subject: Re: Aries JPA Issue
>
> Hi Ionnis,
>
> There is an error in your syntax :
>
> aries:services/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/blogdb)
>
> This shoud be -->
>
> osgi:services/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/blogdb)
>
> Regards,
>
> Charles
>
> On 17/11/10 18:51, Ioannis Canellos wrote:
> 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.
>
>
 		 	   		  

Re: Aries JPA Issue

Posted by Charles Moulliard <cm...@gmail.com>.
Hi Ionnis,

There is an error in your syntax :

<non-jta-data-source>aries:services/javax.sql.DataSource/(osgi.jndi.service.name 
<http://osgi.jndi.service.name>=jdbc/blogdb)</non-jta-data-source>

This shoud be -->

<non-jta-data-source>osgi:services/javax.sql.DataSource/(osgi.jndi.service.name 
<http://osgi.jndi.service.name>=jdbc/blogdb)</non-jta-data-source>

Regards,

Charles

On 17/11/10 18:51, Ioannis Canellos wrote:
> 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 
> <http://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:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <persistence version="2.0" 
> 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">
> <persistence-unit name="wicket-osgi-pu" transaction-type="RESOURCE_LOCAL">
> <provider>org.datanucleus.jpa.PersistenceProviderImpl</provider>
> <non-jta-data-source>aries:services/javax.sql.DataSource/(osgi.jndi.service.name 
> <http://osgi.jndi.service.name>=jdbc/blogdb)</non-jta-data-source>
> <class>net.iocanel.database.entities.Person</class>
> </persistence-unit>
> </persistence>
>
> My blueprint.xml
>
> <?xml version="1.0" encoding="UTF-8"?>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>         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">
>
> <bean id="personDAO"
>                 class="net.iocanel.database.dao.PersonJpaDAO">
> <tx:transaction method="*" value="Required" />
> <jpa:context property="entityManager" unitname="wicket-osgi-pu" />
> </bean>
>
> <service ref="personDAO"
>                 interface="net.iocanel.database.dao.PersonDAO">
> </service>
>
> </blueprint>
> -- 
> *Ioannis Canellos*
> http://iocanel.blogspot.com
> Integration Engineer @ Upstream S.A. <http://www.upstreamsystems.com>
>
>