aries-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timothy Ward <>
Subject RE: Strange OpenJPA and BP problem
Date Wed, 16 Nov 2011 08:31:12 GMT

Hi Matt,

No fix, or proposed fix, yet. You should feel free to have a look. Also you could avoid packaging
your entities separately from your persistence.xml. The JPA service specification states pretty
clearly that packaging entities and persistence.xml in this way is not supported. If you avoid
the packaging split then you will never hit this problem.


Tim Ward
Apache Aries PMC member & Enterprise OSGi advocate
Enterprise OSGi in Action (

Date: Tue, 15 Nov 2011 14:34:23 -0600
Subject: Re: Strange OpenJPA and BP problem

Hi Tim.Yes I ran to ARIES-765!
I do have my entities and presistence.xml in two different bundles.
After installing the persistence bundle and doing a "reffresh" in command line does seem to

Any fixes for ARIES-765 yet?

On Tue, Nov 15, 2011 at 1:05 PM, Matt Madhavan <> wrote:

Hi Tim,I'm running this in KARAF. Everything seems to deploy and all the bundles are active
with all the services on.

Any idea please? Whats the work around for  ARIES-765 ?

Thanks in advance!


On Tue, Nov 15, 2011 at 3:04 AM, Timothy Ward <> wrote:

Hi Matt, 

Without more context it is very difficult to debug remotely - did anything get redeployed?
It looks like you've hit ARIES-765 to me.


Tim Ward
Apache Aries PMC member & Enterprise OSGi advocate

Enterprise OSGi in Action (

Date: Mon, 14 Nov 2011 18:20:40 -0600
Subject: Strange OpenJPA and BP problem


I have configured an in-memory Derby data source with open jpa and Aries blueprint.
When ever I invoke a a query i'm getting the following InvalidState exception! Not getting
much info at all! Any ideas please?

<openjpa-2.1.0-r422266:1071316 nonfatal user error> org.apache.openjpa.persistence.InvalidStateException:
The factory has been closed.  The stack trace at which the factory was closed is held in the
embedded exception.

        at org.apache.openjpa.kernel.AbstractBrokerFactory.assertOpen(
       at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(

        at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(
       at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(

        at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(
       at org.apache.aries.jpa.container.impl.CountingEntityManagerFactory.createEntityManager(

        at org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getPersistenceContext(
       at org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.createNamedQuery(

       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke( 
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(
       at java.lang.reflect.Method.invoke(

        at org.apache.aries.proxy.impl.ProxyHandler$1.invoke(       
at org.apache.aries.blueprint.proxy.Collaborator.invoke(        at org.apache.aries.proxy.impl.ProxyHandler.invoke(

Source)        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

Caused by: java.lang.IllegalStateException        at org.apache.openjpa.kernel.AbstractBrokerFactory.close(

        at org.apache.openjpa.kernel.DelegatingBrokerFactory.close(
       at org.apache.openjpa.persistence.EntityManagerFactoryImpl.close(

        at org.apache.aries.jpa.container.impl.CountingEntityManagerFactory.close(
       at org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.destroyEntityManagerFactories(

        at org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.bundleStateChange(
       at org.apache.aries.jpa.container.impl.PersistenceBundleManager.modifiedBundle(

        at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(
       at org.osgi.util.tracker.AbstractTracked.track(        at

        at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(
       at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(

        at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(
       at org.apache.felix.framework.Felix.fireBundleEvent(        at org.apache.felix.framework.Felix.updateBundle(

        at org.apache.felix.framework.BundleImpl.update(        at
Any ideas please?

My datasource looks like this!
<?xml version="1.0" encoding="UTF-8"?><blueprint xmlns=""

	xmlns:xsi=""	default-activation="lazy">

	<bean id="derbyXADataSource" class="org.apache.derby.jdbc.EmbeddedXADataSource">
		<property name="databaseName" value="memory:CTS" />		<property name="createDatabase"
value="create" />

	<service id="xaDataSource" ref="derbyXADataSource" interface="javax.sql.XADataSource">

		<service-properties>			<entry key="" value="jdbc/cts-transaction01"

		</service-properties>	</service>
	<bean id="derbyDataSource" class="org.apache.derby.jdbc.EmbeddedDataSource">

	<property name="databaseName" value="memory:CTS" /> 		<property name="createDatabase"
value="create" />

	<service ref="derbyDataSource" interface="javax.sql.DataSource">

		<service-properties>			<entry key="" value="jdbc/cts-transaction01-nojta"

		</service-properties>	</service>  </blueprint>

My persistence.xml looks like:	<persistence-unit name=""	transaction-type="JTA">

		<description>Persistence unit for pend error model</description>		<provider>
			org.apache.openjpa.persistence.PersistenceProviderImpl		</provider>

		<class></class>		<class></class>

My Bean def:
	<bean id="claimExceptionDaoBean" 
	<tx:transaction method="*" value="Required" /> 

		<jpa:context property="entityManager" unitname="" />			    

Any help will be appreciated. Been struck in this for a few days now.

Thanks in advance!


View raw message