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.

Regards

Tim Ward
-------------------
Apache Aries PMC member & Enterprise OSGi advocate
Enterprise OSGi in Action (http://www.manning.com/cummins)
-------------------


Date: Tue, 15 Nov 2011 14:34:23 -0600
Subject: Re: Strange OpenJPA and BP problem
From: mattmadha...@gmail.com
To: user@aries.apache.org

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 work!

Any fixes for ARIES-765 yet?
ThanksMatt

On Tue, Nov 15, 2011 at 1:05 PM, Matt Madhavan <mattmadha...@gmail.com> 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!


Matt

On Tue, Nov 15, 2011 at 3:04 AM, Timothy Ward <timothyjw...@apache.org> 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.

Regards

Tim Ward
-------------------
Apache Aries PMC member & Enterprise OSGi advocate


Enterprise OSGi in Action (http://www.manning.com/cummins)
-------------------


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


From: mattmadha...@gmail.com
To: user@aries.apache.org

Hello,
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(AbstractBrokerFactory.java:676)
        at 
org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:192)


        at 
org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)
        at 
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)


        at 
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)
        at 
org.apache.aries.jpa.container.impl.CountingEntityManagerFactory.createEntityManager(CountingEntityManagerFactory.java:70)


        at 
org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getPersistenceContext(JTAEntityManager.java:92)
        at 
org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.createNamedQuery(JTAEntityManager.java:310)


        at 
com.hcsc.ccsp.foundation.core.activeclaims.impl.ReferenceTablesDaoImpl.findAllClmProcExcepRef(ReferenceTablesDaoImpl.java:55)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)


        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)   
     at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)


        at 
org.apache.aries.proxy.impl.ProxyHandler$1.invoke(ProxyHandler.java:50)        
at org.apache.aries.blueprint.proxy.Collaborator.invoke(Collaborator.java:91)   
     at org.apache.aries.proxy.impl.ProxyHandler.invoke(ProxyHandler.java:78)


        at 
com.hcsc.ccsp.foundation.core.activeclaims.impl.$ReferenceTablesDaoImpl30102981.findAllClmProcExcepRef(Unknown
 Source)        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)



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


        at 
org.apache.openjpa.kernel.DelegatingBrokerFactory.close(DelegatingBrokerFactory.java:197)
        at 
org.apache.openjpa.persistence.EntityManagerFactoryImpl.close(EntityManagerFactoryImpl.java:275)


        at 
org.apache.aries.jpa.container.impl.CountingEntityManagerFactory.close(CountingEntityManagerFactory.java:60)
        at 
org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.destroyEntityManagerFactories(EntityManagerFactoryManager.java:328)


        at 
org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.bundleStateChange(EntityManagerFactoryManager.java:169)
        at 
org.apache.aries.jpa.container.impl.PersistenceBundleManager.modifiedBundle(PersistenceBundleManager.java:283)


        at 
org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:453)
        at 
org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:237)        at 
org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:413)


        at 
org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:807)
        at 
org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:729)


        at 
org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:610)
        at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:3761)    
    at org.apache.felix.framework.Felix.updateBundle(Felix.java:2044)


        at org.apache.felix.framework.BundleImpl.update(BundleImpl.java:936)    
    at 
org.apache.karaf.shell.dev.watch.BundleWatcher.run(BundleWatcher.java:107)
Any ideas please?



My datasource looks like this!
<?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";   
default-activation="lazy">





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


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


                <service-properties>                    <entry 
key="osgi.jndi.service.name" 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" />


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


                <service-properties>                    <entry 
key="osgi.jndi.service.name" value="jdbc/cts-transaction01-nojta" />


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

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


                <description>Persistence unit for pend error 
model</description>                <provider>
                        org.apache.openjpa.persistence.PersistenceProviderImpl  
        </provider>
                
<jta-data-source>osgi:service/javax.sql.DataSource/(transactional=true)</jta-data-source>
               <class>com.hcsc.ccsp.common.om.activeclaims.ActvClm</class>


                
<class>com.hcsc.ccsp.common.om.activeclaims.ActvClmProcExcep</class>            
<class>com.hcsc.ccsp.common.om.activeclaims.ActvClmProcExcepPK</class>


       .......
My Bean def:
        <bean id="claimExceptionDaoBean" 
              
class="com.hcsc.ccsp.foundation.core.activeclaims.impl.ClaimExceptionDaoImpl">  
          <tx:transaction method="*" value="Required" /> 


                <jpa:context property="entityManager" 
unitname="common.om.activeclaims" />                            
        </bean>

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

Thanks in advance!
Matt

                                          



                                          

Reply via email to