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>