Hi Bram,

do you have several blueprint bundles ?

Regards
JB

On 06/10/2013 07:03 PM, Bram Pouwelse wrote:
Hi,

I've sent the message below to the Aries list last week, but no response
yet. I'm wondering if other Karaf users are having the same issue using
the JPA feature in Karaf.



I'm having some problems using Aries JPA (running on Karaf 2.3.1 and
using OpenJPA 2.2.1) .

The first problem is that the EntityManagerFactory is created and
registered in the service registry even if the DataSource is not
available, this causes a problem because other bundles start using the
EntityManagerFactory based on it's availability.

Is it possible to register the EntityManagerFactory only of the
DataSource is available (I'm using JNDI). For now I've added a service
dependency on the DataSource to bundles to make them aware of the fact
that the EntityManagerFactory can't be used.


The second problem I have is that when I restart the bundle that
registers the DataSource I get an IllegalStateException [1] when using
JPA. The only way to get JPA working again is restarting the JPA
Container bundle.


The solution for the first issue seems to work pretty well, but it would
be really nice to be able to update the DataSource bundle without having
to restart the JPA Container.

Any idea's on how to overcome the IllegalStateException?

Thanks!

Bram

[1]: Caused by: java.lang.IllegalStateException: Invalid BundleContext.
at
org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:514)
at
org.apache.felix.framework.BundleContextImpl.getServiceReferences(BundleContextImpl.java:425)
at
org.apache.aries.jndi.services.ServiceHelper.findService(ServiceHelper.java:375)
at
org.apache.aries.jndi.services.ServiceHelper.access$500(ServiceHelper.java:66)
at
org.apache.aries.jndi.services.ServiceHelper$JNDIServiceDamper.call(ServiceHelper.java:180)
at Proxyca2dc362_3bc7_421c_ba6d_a2b9855d61d6.getConnection(Unknown Source)
at
org.apache.aries.jpa.container.unit.impl.DelayedLookupDataSource.getConnection(DelayedLookupDataSource.java:36)
at
org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:110)

--
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Reply via email to