You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Tomasz Mazan <wi...@wp.pl> on 2007/08/30 17:05:40 UTC

Two phase commit - JPA + JMS

My application uses JPA to persist data and JMS destinations to send requests
to external systems. I want to make transaction using both JPA and JMS
technologies. Over these I use SessionBeans as WebServices and this layer
should manage transaction.

Could you advice the best solution and point out documentation which could
be helpful?

regards
Tomasz Mazan
-- 
View this message in context: http://www.nabble.com/Two-phase-commit---JPA-%2B-JMS-tf4354848s134.html#a12409188
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Re: Two phase commit - JPA + JMS

Posted by Tomasz Mazan <wi...@wp.pl>.
> Basically yes.  Geronimo won't prevent you from using non-xa 
> datasources and jms connection factories in JTA transactions, but if 
> anything goes wrong your data may be left in an inconsistent state.
>
> If you find that xa is too slow there may be ways of using non-xa jms 
> connection factories as long as the messages are idempotent, that is 
> sending the same message multiple times has the same effect as sending 
> it once.  I'm not an expert on this but I think there's periodic 
> discussion on the activemq lists.  I would start with xa everywhere 
> and see if there are problems.
>
> thanks
> david jencks
David, thanks. I see that I count on your help and comprehensive aswers.

Have a nice weekend
Tomasz Mazan

Re: Two phase commit - JPA + JMS

Posted by Tomasz Mazan <wi...@wp.pl>.
Matt Hogstrom pisze:
> Tomasz,
>
> Here is a sample  derived from DayTrader where we setup XA and non-XA 
> datasources.  I created new RA's for PostgreSQL, but haven't tested 
> them, that should work but hopefully you can tell me if there are issues.
>
> You'll need this jar for PostgreSQL 8.2 
> http://jdbc.postgresql.org/download/postgresql-8.2-506.jdbc3.jar and 
> need to place it in the Geronimo repo and place a dependency element 
> in your plan.
>
> You'll also need the rars which you can find at:
>
> http://snapshots.repository.codehaus.org/org/tranql/tranql-connector-postgresql-xa/8.2-SNAPSHOT/tranql-connector-postgresql-xa-8.2-20070905.015528-1.rar
> http://snapshots.repository.codehaus.org/org/tranql/tranql-connector-postgresql-local/8.2-SNAPSHOT/tranql-connector-postgresql-local-8.2-20070905.015528-1.rar
>
> rename these to 8.2-SNAPSHOT and place them in the Geronimo repo.
>
>     <ext-module>
>         <connector>*YourDataSource*</connector>
>         <external-path 
> xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
>             <dep:groupId>org.tranql</dep:groupId>
>             
> <dep:artifactId>*tranql-connector-postgresql-xa*</dep:artifactId>
>             <dep:version>*8-2.SNAPSHOT*</dep:version>
>             <dep:type>rar</dep:type>
>         </external-path>
>         <connector 
> xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2">
>             <resourceadapter>
>                 <outbound-resourceadapter>
>                     <connection-definition>
>                         
> <connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
>                         <connectiondefinition-instance>
>                             <name>*jdbc/YourXADataSource*</name>
>                             <config-property-setting 
> name="DatabaseName">YourDatabaseName</config-property-setting>
>                             <config-property-setting 
> name="Description"></config-property-setting>
>                             <config-property-setting 
> name="UserName"></config-property-setting>
>                             <config-property-setting 
> name="Password"></config-property-setting>
>                             <config-property-setting 
> name="PortNumber"></config-property-setting>
>                             <config-property-setting 
> name="ServerName"></config-property-setting>
>                             <config-property-setting 
> name="LoginTimeout"></config-property-setting>
>                             <connectionmanager>
>                                 <xa-transaction>
>                                     <transaction-caching/>
>                                 </xa-transaction>
>                                 <single-pool>
>                                     <max-size>100</max-size>
>                                     <min-size>0</min-size>
>                                     
> <blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
>                                     
> <idle-timeout-minutes>30</idle-timeout-minutes>
>                                     <match-one/>
>                                 </single-pool>
>                             </connectionmanager>
>                         </connectiondefinition-instance>
>                         <connectiondefinition-instance>
>                             <name>*j**dbc/NoTxYourDataSource*</name>
>                             <config-property-setting 
> name="DatabaseName">YourDatabaseName</config-property-setting>
>                             <config-property-setting 
> name="Description"></config-property-setting>
>                             <config-property-setting 
> name="UserName"></config-property-setting>
>                             <config-property-setting 
> name="Password"></config-property-setting>
>                             <config-property-setting 
> name="PortNumber"></config-property-setting>
>                             <config-property-setting 
> name="ServerName"></config-property-setting>
>                             <config-property-setting 
> name="LoginTimeout"></config-property-setting>
>                             <connectionmanager>
>                                 <no-transaction/>
>                                 <single-pool>
>                                     <max-size>10</max-size>
>                                     <min-size>0</min-size>
>                                     
> <blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
>                                     
> <idle-timeout-minutes>30</idle-timeout-minutes>
>                                     <match-one/>
>                                 </single-pool>
>                             </connectionmanager>
>                         </connectiondefinition-instance>
>                     </connection-definition>
>                 </outbound-resourceadapter>
>             </resourceadapter>
>         </connector>
>     </ext-module>
>
>
>

I guess that it's part of geronimo-application.xml and I needn't use 
DatabasePool deployment plan insofar I put deps to pgres driver in 
preceding XML

Tomasz Mazan vel. Beniamin

Re: Two phase commit - JPA + JMS

Posted by Tomasz Mazan <wi...@wp.pl>.
> Tomasz,
>
> I corrected the problem.  I had refactored the class and forgot to 
> update the RAR.  I've updated and published new SNAPSHOTS.  Please 
> grab a new update of the XA rar.
>
> Also, set the user / password, server, etc for your postgres environment.
>
Matt

New configuration works, but there's some non-critical bugs.

If my connection definition looks like (modulo correct property values)
                        <connectiondefinition-instance>
                            <name>MyPool</name>
                            <config-property-setting 
name="Password"></config-property-setting>
                            <config-property-setting 
name="UserName"></config-property-setting>
                            <config-property-setting 
name="PortNumber">5432</config-property-setting>
                            <config-property-setting 
name="DatabaseName"></config-property-setting>
                            <config-property-setting 
name="ServerName"></config-property-setting>
                            <config-property-setting 
name="LoginTimeout">20000</config-property-setting>
                            <connectionmanager>
there's exception during view configuration via Geronimo Console :
java.lang.Exception: Problem while updaing the persistent value of 
attibute: Attribute Name: Description, Type: class java.lang.String, GBea
nInstance: 
org.apache.geronimo.connector.outbound.ManagedConnectionFactoryWrapper
        at 
org.apache.geronimo.gbean.runtime.GBeanInstance.destroyInstance(GBeanInstance.java:1128)
        at 
org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStop(GBeanInstanceState.java:339)
        at 
org.apache.geronimo.gbean.runtime.GBeanInstanceState.stop(GBeanInstanceState.java:188)
        at 
org.apache.geronimo.gbean.runtime.GBeanInstance.stop(GBeanInstance.java:561)
        at 
org.apache.geronimo.kernel.basic.BasicKernel.stopGBean(BasicKernel.java:423)
        at 
org.apache.geronimo.kernel.config.KernelConfigurationManager.stopRecursive(KernelConfigurationManager.java:224)
        at 
org.apache.geronimo.kernel.config.KernelConfigurationManager.stop(KernelConfigurationManager.java:204)
        at 
org.apache.geronimo.kernel.config.SimpleConfigurationManager.stopConfiguration(SimpleConfigurationManager.java:575)
        at 
org.apache.geronimo.kernel.config.SimpleConfigurationManager.stopConfiguration(SimpleConfigurationManager.java:558)
        at 
org.apache.geronimo.kernel.config.SimpleConfigurationManager$$FastClassByCGLIB$$ce77a924.invoke(<generated>)
        at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
        at 
org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
        at 
org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:124)
        at 
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:865)
        at 
org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:239)
        at 
org.apache.geronimo.kernel.KernelGBean.invoke(KernelGBean.java:342)
        at 
org.apache.geronimo.kernel.KernelGBean$$FastClassByCGLIB$$1cccefc9.invoke(<generated>)
        at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
        at 
org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
        at 
org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:124)
        at 
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:865)
        at 
org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:239)
        at 
org.apache.geronimo.system.jmx.MBeanGBeanBridge.invoke(MBeanGBeanBridge.java:168)
        at 
com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:213)
        at 
com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:220)
        at 
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:815)
        at 
com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:784)
        at 
javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1408)
        at 
javax.management.remote.rmi.RMIConnectionImpl.access$100(RMIConnectionImpl.java:81)
        at 
javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1245)
        at java.security.AccessController.doPrivileged(Native Method)
        at 
javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1348)
        at 
javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:782)
        at sun.reflect.GeneratedMethodAccessor334.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at 
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
        at sun.rmi.transport.Transport$1.run(Transport.java:153)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
        at 
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
        at 
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
        at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.IllegalArgumentException: 
org.tranql.connector.postgresql.PGXAMCF: no getter for Description
        at 
org.apache.geronimo.gbean.DynamicGBeanDelegate.getAttribute(DynamicGBeanDelegate.java:124)
        at 
org.apache.geronimo.connector.outbound.ManagedConnectionFactoryWrapper.getAttribute(ManagedConnectionFactoryWrapper.java:181)
        at 
org.apache.geronimo.gbean.runtime.GBeanAttribute$DynamicGetterMethodInvoker.invoke(GBeanAttribute.java:431)
        at 
org.apache.geronimo.gbean.runtime.GBeanAttribute.getValue(GBeanAttribute.java:390)
        at 
org.apache.geronimo.gbean.runtime.GBeanInstance.destroyInstance(GBeanInstance.java:1124)
        ... 42 more

So, I'd decided to set this attribute within my deployment plan, the I 
got exception on deploy:

java.lang.IllegalArgumentException: 
org.tranql.connector.postgresql.PGXAMCF: no setter for Description
        at 
org.apache.geronimo.gbean.DynamicGBeanDelegate.setAttribute(DynamicGBeanDelegate.java:132)
        at 
org.apache.geronimo.connector.outbound.ManagedConnectionFactoryWrapper.setAttribute(ManagedConnectionFactoryWrapper.java:192)
        at 
org.apache.geronimo.gbean.runtime.GBeanAttribute$DynamicSetterMethodInvoker.invoke(GBeanAttribute.java:443)
        at 
org.apache.geronimo.gbean.runtime.GBeanAttribute.setValue(GBeanAttribute.java:416)
....

It's not critical, but looks quite poorly.

Beniamin

Re: Two phase commit - JPA + JMS

Posted by Matt Hogstrom <ma...@hogstrom.org>.
On Sep 5, 2007, at 7:41 AM, Tomasz Mazan wrote:

>
>                         <connectiondefinition-instance>
>                             <name>MyPool</name>
>                             <config-property-setting  
> name="Password"></config-property-setting>
>                             <config-property-setting  
> name="UserName"></config-property-setting>
>                             <config-property-setting  
> name="PortNumber"></config-property-setting>
>                             <config-property-setting  
> name="DatabaseName"></config-property-setting>
>                             <config-property-setting  
> name="ServerName"></config-property-setting>
>                             <config-property-setting  
> name="LoginTimeout"></config-property-setting>
>                             <connectionmanager>
>
> When I try to deploy application, I get exception:
> 13:16:12,406 ERROR [GBeanInstanceState] Error while starting; GBean  
> is now in the FAILED state: abstractName="myapp/MyApp/0.1/ear?
> J2EEApplication=myapp/MyApp/0.1/ 
> ear,JCAConnectionFactory=MyXAPool,JCAResource=MyPool,ResourceAdapter=M 
> yPoo
> l,ResourceAdapterModule=FonBsaCorePool,j2eeType=JCAManagedConnectionFa 
> ctory,name=MyXAPool"
> java.lang.ClassNotFoundException:  
> org.tranql.connector.postgresql.EmbeddedXAMCF in classloader myapp/ 
> MyApp/0.1/ear
>         at  
> org.apache.geronimo.kernel.config.MultiParentClassLoader.loadOptimized 
> Class(MultiParentClassLoader.java:428)
>         at  
> org.apache.geronimo.kernel.config.MultiParentClassLoader.loadClass 
> (MultiParentClassLoader.java:278)
> What I've done wrong, or where is cause of this exception. I didn't  
> find EmbededXAMCF class in jar/rar archives
>
> Tomasz Mazan vel. Beniamin

Tomasz,

I corrected the problem.  I had refactored the class and forgot to  
update the RAR.  I've updated and published new SNAPSHOTS.  Please  
grab a new update of the XA rar.

Also, set the user / password, server, etc for your postgres  
environment.

Re: Two phase commit - JPA + JMS

Posted by Tomasz Mazan <wi...@wp.pl>.
Matt Hogstrom pisze:
> Tomasz,
>
> Here is a sample  derived from DayTrader where we setup XA and non-XA 
> datasources.  I created new RA's for PostgreSQL, but haven't tested 
> them, that should work but hopefully you can tell me if there are issues.
>
> You'll need this jar for PostgreSQL 8.2 
> http://jdbc.postgresql.org/download/postgresql-8.2-506.jdbc3.jar and 
> need to place it in the Geronimo repo and place a dependency element 
> in your plan.
>
> You'll also need the rars which you can find at:
>
> http://snapshots.repository.codehaus.org/org/tranql/tranql-connector-postgresql-xa/8.2-SNAPSHOT/tranql-connector-postgresql-xa-8.2-20070905.015528-1.rar
> http://snapshots.repository.codehaus.org/org/tranql/tranql-connector-postgresql-local/8.2-SNAPSHOT/tranql-connector-postgresql-local-8.2-20070905.015528-1.rar
>
> rename these to 8.2-SNAPSHOT and place them in the Geronimo repo.
>
>     <ext-module>
>         <connector>*YourDataSource*</connector>
>         <external-path 
> xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
>             <dep:groupId>org.tranql</dep:groupId>
>             
> <dep:artifactId>*tranql-connector-postgresql-xa*</dep:artifactId>
>             <dep:version>*8-2.SNAPSHOT*</dep:version>
>             <dep:type>rar</dep:type>
>         </external-path>
>         <connector 
> xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2">
>             <resourceadapter>
>                 <outbound-resourceadapter>
>                     <connection-definition>
>                         
> <connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
>                         <connectiondefinition-instance>
>                             <name>*jdbc/YourXADataSource*</name>
>                             <config-property-setting 
> name="DatabaseName">YourDatabaseName</config-property-setting>
>                             <config-property-setting 
> name="Description"></config-property-setting>
>                             <config-property-setting 
> name="UserName"></config-property-setting>
>                             <config-property-setting 
> name="Password"></config-property-setting>
>                             <config-property-setting 
> name="PortNumber"></config-property-setting>
>                             <config-property-setting 
> name="ServerName"></config-property-setting>
>                             <config-property-setting 
> name="LoginTimeout"></config-property-setting>
>                             <connectionmanager>
>                                 <xa-transaction>
>                                     <transaction-caching/>
>                                 </xa-transaction>
>                                 <single-pool>
>                                     <max-size>100</max-size>
>                                     <min-size>0</min-size>
>                                     
> <blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
>                                     
> <idle-timeout-minutes>30</idle-timeout-minutes>
>                                     <match-one/>
>                                 </single-pool>
>                             </connectionmanager>
>                         </connectiondefinition-instance>
>                         <connectiondefinition-instance>
>                             <name>*j**dbc/NoTxYourDataSource*</name>
>                             <config-property-setting 
> name="DatabaseName">YourDatabaseName</config-property-setting>
>                             <config-property-setting 
> name="Description"></config-property-setting>
>                             <config-property-setting 
> name="UserName"></config-property-setting>
>                             <config-property-setting 
> name="Password"></config-property-setting>
>                             <config-property-setting 
> name="PortNumber"></config-property-setting>
>                             <config-property-setting 
> name="ServerName"></config-property-setting>
>                             <config-property-setting 
> name="LoginTimeout"></config-property-setting>
>                             <connectionmanager>
>                                 <no-transaction/>
>                                 <single-pool>
>                                     <max-size>10</max-size>
>                                     <min-size>0</min-size>
>                                     
> <blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
>                                     
> <idle-timeout-minutes>30</idle-timeout-minutes>
>                                     <match-one/>
>                                 </single-pool>
>                             </connectionmanager>
>                         </connectiondefinition-instance>
>                     </connection-definition>
>                 </outbound-resourceadapter>
>             </resourceadapter>
>         </connector>
>     </ext-module>
>
I put this code to my geronimo-application.xml which looks like:
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-2.0">
    <environment xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2">
        <moduleId>
            <groupId>myapp</groupId>
            <artifactId>MyApp</artifactId>
            <version>0.1</version>
            <type>ear</type>
        </moduleId>
    </environment>
    <ext-module>
           <connector>MyPool</connector>
        <external-path 
xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
            <dep:groupId>org.tranql</dep:groupId>
            <dep:artifactId>tranql-connector-postgresql-xa</dep:artifactId>
            <dep:version>8.2-SNAPSHOT</dep:version>
            <dep:type>rar</dep:type>
        </external-path>
        <connector 
xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2">
            <environment 
xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2">
                <dependencies>
                    <dependency>
                        <groupId>postgresql</groupId>
                        <artifactId>postgresql-8.2</artifactId>
                        <version>506.jdbc3</version>
                        <type>jar</type>
                    </dependency>
                </dependencies>
            </environment>
            <resourceadapter>
                <outbound-resourceadapter>
                    <connection-definition>
                        
<connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
                        <connectiondefinition-instance>
                            <name>MyXAPool</name>
                            <config-property-setting 
name="Password"></config-property-setting>
                            <config-property-setting 
name="UserName"></config-property-setting>
                            <config-property-setting 
name="PortNumber"></config-property-setting>
                            <config-property-setting 
name="DatabaseName"></config-property-setting>
                            <config-property-setting 
name="ServerName"></config-property-setting>
                            <config-property-setting 
name="LoginTimeout"></config-property-setting>
                            <connectionmanager>
                                <xa-transaction>
                                    <transaction-caching/>
                                </xa-transaction>
                                <single-pool>
                                    <max-size>100</max-size>
                                    <min-size>0</min-size>
                                    
<blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
                                    
<idle-timeout-minutes>30</idle-timeout-minutes>
                                    <match-one />
                                </single-pool>
                            </connectionmanager>
                        </connectiondefinition-instance>
                        <connectiondefinition-instance>
                            <name>MyPool</name>
                            <config-property-setting 
name="Password"></config-property-setting>
                            <config-property-setting 
name="UserName"></config-property-setting>
                            <config-property-setting 
name="PortNumber"></config-property-setting>
                            <config-property-setting 
name="DatabaseName"></config-property-setting>
                            <config-property-setting 
name="ServerName"></config-property-setting>
                            <config-property-setting 
name="LoginTimeout"></config-property-setting>
                            <connectionmanager>
                                <no-transaction/>
                                <single-pool>
                                    <max-size>10</max-size>
                                    <min-size>0</min-size>
                                    
<blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
                                    
<idle-timeout-minutes>30</idle-timeout-minutes>
                                    <match-one/>
                                </single-pool>
                            </connectionmanager>
                        </connectiondefinition-instance>
                    </connection-definition>
                </outbound-resourceadapter>
            </resourceadapter>   
        </connector>
    </ext-module>
</application>

and persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence 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_1_0.xsd" version="1.0">
    <persistence-unit name="MyAppDB" transaction-type="JTA">
        
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
        <jta-data-source>MyXAPool</jta-data-source>
          <non-jta-data-source>MyPool</non-jta-data-source>
        <class>myapp.Customer</class>
        <properties>
            <property name="openjpa.Sequence" 
value="class-table(Table=_SEQ_GENERATOR, UseAliases=true)"/>
             <property name="openjpa.jdbc.SynchronizeMappings" 
value="buildSchema(ForeignKeys=true)" />
             <property name="openjpa.jdbc.DBDictionary" value="postgres"/>
             <property name="openjpa.Multithreaded" value="true" />
            <property name="openjpa.TransactionMode" value="managed" />
            <property name="openjpa.NontransactionalRead" value="true" />
            <property name="openjpa.RestoreState" value="all" />        
            <property name="openjpa.Optimistic" value="false"/>   
        </properties>
    </persistence-unit>
 
</persistence>


and no use separated deployment plan.

When I try to deploy application, I get exception:
13:16:12,406 ERROR [GBeanInstanceState] Error while starting; GBean is 
now in the FAILED state: abstractName="myapp/MyApp/0.1/ear?
J2EEApplication=myapp/MyApp/0.1/ear,JCAConnectionFactory=MyXAPool,JCAResource=MyPool,ResourceAdapter=MyPoo
l,ResourceAdapterModule=FonBsaCorePool,j2eeType=JCAManagedConnectionFactory,name=MyXAPool"
java.lang.ClassNotFoundException: 
org.tranql.connector.postgresql.EmbeddedXAMCF in classloader 
myapp/MyApp/0.1/ear
        at 
org.apache.geronimo.kernel.config.MultiParentClassLoader.loadOptimizedClass(MultiParentClassLoader.java:428)
        at 
org.apache.geronimo.kernel.config.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:278)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at 
org.apache.geronimo.connector.outbound.ManagedConnectionFactoryWrapper.<init>(ManagedConnectionFactoryWrapper.java:114)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
Method)
        at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
        at 
org.apache.geronimo.gbean.runtime.GBeanInstance.createInstance(GBeanInstance.java:946)
        at 
org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:268)
        at 
org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:102)
        at 
org.apache.geronimo.gbean.runtime.GBeanInstance.start(GBeanInstance.java:539)
        at 
org.apache.geronimo.gbean.runtime.GBeanDependency.attemptFullStart(GBeanDependency.java:111)
        at 
org.apache.geronimo.gbean.runtime.GBeanDependency.addTarget(GBeanDependency.java:146)
        at 
org.apache.geronimo.gbean.runtime.GBeanDependency$1.running(GBeanDependency.java:120)
        at 
org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.fireRunningEvent(BasicLifecycleMonitor.java:176)
        at 
org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.access$300(BasicLifecycleMonitor.java:44)
        at 
org.apache.geronimo.kernel.basic.BasicLifecycleMonitor$RawLifecycleBroadcaster.fireRunningEvent(BasicLifecycleMonitor.java:254)
        at 
org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:294)
        at 
org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:102)
        at 
org.apache.geronimo.gbean.runtime.GBeanInstanceState.startRecursive(GBeanInstanceState.java:124)
        at 
org.apache.geronimo.gbean.runtime.GBeanInstance.startRecursive(GBeanInstance.java:553)
        at 
org.apache.geronimo.kernel.basic.BasicKernel.startRecursiveGBean(BasicKernel.java:379)
        at 
org.apache.geronimo.kernel.config.ConfigurationUtil.startConfigurationGBeans(ConfigurationUtil.java:448)
        at 
org.apache.geronimo.kernel.config.KernelConfigurationManager.start(KernelConfigurationManager.java:187)
        at 
org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:530)
        at 
org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:511)
        at 
org.apache.geronimo.kernel.config.SimpleConfigurationManager$$FastClassByCGLIB$$ce77a924.invoke(<generated>)
        at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
        at 
org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
        at 
org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:124)
        at 
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:865)
        at 
org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:239)
        at 
org.apache.geronimo.kernel.KernelGBean.invoke(KernelGBean.java:342)
        at 
org.apache.geronimo.kernel.KernelGBean$$FastClassByCGLIB$$1cccefc9.invoke(<generated>)
        at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
        at 
org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
        at 
org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:124)
        at 
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:865)
        at 
org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:239)
        at 
org.apache.geronimo.system.jmx.MBeanGBeanBridge.invoke(MBeanGBeanBridge.java:168)
        at 
com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:213)
        at 
com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:220)
        at 
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:815)
        at 
com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:784)
        at 
javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1408)
        at 
javax.management.remote.rmi.RMIConnectionImpl.access$100(RMIConnectionImpl.java:81)
        at 
javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1245)
        at java.security.AccessController.doPrivileged(Native Method)
        at 
javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1348)
        at 
javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:782)
        at sun.reflect.GeneratedMethodAccessor287.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at 
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
        at sun.rmi.transport.Transport$1.run(Transport.java:153)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
        at 
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
        at 
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
        at java.lang.Thread.run(Thread.java:595)
2007-09-05 13:16:18 org.apache.cxf.bus.spring.BusApplicationContext 
getConfigResources
INFO: Could not find the configuration file cxf.xml on the classpath.
2007-09-05 13:16:24 
org.apache.cxf.service.factory.ReflectionServiceFactoryBean 
buildServiceFromClass
INFO: Creating Service {http://jws.services.myapp/}MyApp from class 
myapp.services.jws.MyAppService
13:16:27,203 ERROR [[/MyApp/MyAppService]] "Restricted listeners 
property file not found
13:16:27,296 ERROR [GBeanInstanceState] Error while starting; GBean is 
now in the FAILED state: abstractName="myapp/MyApp/0.1/ear?
J2EEApplication=myapp/MyApp/0.1/ear,JCAConnectionFactory=MyXAPool,JCAResource=MyPool,ResourceAdapter=MyPoo
l,ResourceAdapterModule=MyPool,j2eeType=JCAManagedConnectionFactory,name=MyXAPool"
java.lang.ClassNotFoundException: 
org.tranql.connector.postgresql.EmbeddedXAMCF in classloader 
myapp/MyApp/0.1/ear
        at 
org.apache.geronimo.kernel.config.MultiParentClassLoader.loadOptimizedClass(MultiParentClassLoader.java:428)
        at 
org.apache.geronimo.kernel.config.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:278)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at 
org.apache.geronimo.connector.outbound.ManagedConnectionFactoryWrapper.<init>(ManagedConnectionFactoryWrapper.java:114)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
Method)
        at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
        at 
org.apache.geronimo.gbean.runtime.GBeanInstance.createInstance(GBeanInstance.java:946)
        at 
org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:268)
        at 
org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:102)
        at 
org.apache.geronimo.gbean.runtime.GBeanInstanceState.startRecursive(GBeanInstanceState.java:124)
        at 
org.apache.geronimo.gbean.runtime.GBeanInstance.startRecursive(GBeanInstance.java:553)
        at 
org.apache.geronimo.kernel.basic.BasicKernel.startRecursiveGBean(BasicKernel.java:379)
        at 
org.apache.geronimo.kernel.config.ConfigurationUtil.startConfigurationGBeans(ConfigurationUtil.java:448)
        at 
org.apache.geronimo.kernel.config.KernelConfigurationManager.start(KernelConfigurationManager.java:187)
        at 
org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:530)
        at 
org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:511)
        at 
org.apache.geronimo.kernel.config.SimpleConfigurationManager$$FastClassByCGLIB$$ce77a924.invoke(<generated>)
        at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
        at 
org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
        at 
org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:124)
        at 
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:865)
        at 
org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:239)
        at 
org.apache.geronimo.kernel.KernelGBean.invoke(KernelGBean.java:342)
        at 
org.apache.geronimo.kernel.KernelGBean$$FastClassByCGLIB$$1cccefc9.invoke(<generated>)
        at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
        at 
org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
        at 
org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:124)
        at 
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:865)
        at 
org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:239)
        at 
org.apache.geronimo.system.jmx.MBeanGBeanBridge.invoke(MBeanGBeanBridge.java:168)
        at 
com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:213)
        at 
com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:220)
        at 
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:815)
        at 
com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:784)
        at 
javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1408)
        at 
javax.management.remote.rmi.RMIConnectionImpl.access$100(RMIConnectionImpl.java:81)
        at 
javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1245)
        at java.security.AccessController.doPrivileged(Native Method)
        at 
javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1348)
        at 
javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:782)
        at sun.reflect.GeneratedMethodAccessor287.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at 
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
        at sun.rmi.transport.Transport$1.run(Transport.java:153)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
        at 
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
        at 
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
        at java.lang.Thread.run(Thread.java:595)
13:16:28,015 ERROR [GBeanInstanceState] Error while starting; GBean is 
now in the FAILED state: abstractName="myapp/MyApp/0.1/ear?
J2EEApplication=myapp/MyApp/0.1/ear,JCAConnectionFactory=MyPool,JCAResource=MyPool,ResourceAdapter=MyPool,
ResourceAdapterModule=MyPool,j2eeType=JCAManagedConnectionFactory,name=MyPool"
java.lang.ClassNotFoundException: 
org.tranql.connector.postgresql.EmbeddedXAMCF in classloader 
myapp/MyApp/0.1/ear
        at 
org.apache.geronimo.kernel.config.MultiParentClassLoader.loadOptimizedClass(MultiParentClassLoader.java:428)
        at 
org.apache.geronimo.kernel.config.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:278)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at 
org.apache.geronimo.connector.outbound.ManagedConnectionFactoryWrapper.<init>(ManagedConnectionFactoryWrapper.java:114)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
Method)
        at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
        at 
org.apache.geronimo.gbean.runtime.GBeanInstance.createInstance(GBeanInstance.java:946)
        at 
org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:268)
        at 
org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:102)
        at 
org.apache.geronimo.gbean.runtime.GBeanInstance.start(GBeanInstance.java:539)
        at 
org.apache.geronimo.gbean.runtime.GBeanDependency.attemptFullStart(GBeanDependency.java:111)
        at 
org.apache.geronimo.gbean.runtime.GBeanDependency.addTarget(GBeanDependency.java:146)
        at 
org.apache.geronimo.gbean.runtime.GBeanDependency$1.running(GBeanDependency.java:120)
        at 
org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.fireRunningEvent(BasicLifecycleMonitor.java:176)
        at 
org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.access$300(BasicLifecycleMonitor.java:44)
        at 
org.apache.geronimo.kernel.basic.BasicLifecycleMonitor$RawLifecycleBroadcaster.fireRunningEvent(BasicLifecycleMonitor.java:254)
        at 
org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:294)
        at 
org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:102)
        at 
org.apache.geronimo.gbean.runtime.GBeanInstanceState.startRecursive(GBeanInstanceState.java:124)
        at 
org.apache.geronimo.gbean.runtime.GBeanInstance.startRecursive(GBeanInstance.java:553)
        at 
org.apache.geronimo.kernel.basic.BasicKernel.startRecursiveGBean(BasicKernel.java:379)
        at 
org.apache.geronimo.kernel.config.ConfigurationUtil.startConfigurationGBeans(ConfigurationUtil.java:448)
        at 
org.apache.geronimo.kernel.config.KernelConfigurationManager.start(KernelConfigurationManager.java:187)
        at 
org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:530)
        at 
org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:511)
        at 
org.apache.geronimo.kernel.config.SimpleConfigurationManager$$FastClassByCGLIB$$ce77a924.invoke(<generated>)
        at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
        at 
org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
        at 
org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:124)
        at 
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:865)
        at 
org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:239)
        at 
org.apache.geronimo.kernel.KernelGBean.invoke(KernelGBean.java:342)
        at 
org.apache.geronimo.kernel.KernelGBean$$FastClassByCGLIB$$1cccefc9.invoke(<generated>)
        at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
        at 
org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
        at 
org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:124)
        at 
org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:865)
        at 
org.apache.geronimo.kernel.basic.BasicKernel.invoke(BasicKernel.java:239)
        at 
org.apache.geronimo.system.jmx.MBeanGBeanBridge.invoke(MBeanGBeanBridge.java:168)
        at 
com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:213)
        at 
com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:220)
        at 
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:815)
        at 
com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:784)
        at 
javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1408)
        at 
javax.management.remote.rmi.RMIConnectionImpl.access$100(RMIConnectionImpl.java:81)
        at 
javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1245)
        at java.security.AccessController.doPrivileged(Native Method)
        at 
javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1348)
        at 
javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:782)
        at sun.reflect.GeneratedMethodAccessor287.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at 
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
        at sun.rmi.transport.Transport$1.run(Transport.java:153)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
        at 
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
        at 
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
        at java.lang.Thread.run(Thread.java:595)

What I've done wrong, or where is cause of this exception. I didn't find 
EmbededXAMCF class in jar/rar archives

Tomasz Mazan vel. Beniamin

Re: Two phase commit - JPA + JMS

Posted by Matt Hogstrom <ma...@hogstrom.org>.
Great news !!!

So the updated RARs work correctly ?  (or at least the XA one)

Let us know if you have other issues and good luck.


On Sep 5, 2007, at 8:44 AM, Tomasz Mazan wrote:

> I've moved resourceadapter configuration to independent deployment  
> plan and deploy DatabasePools - successfully.
> persistence.xml
>
> <?xml version="1.0" encoding="UTF-8"?>
> <persistence 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_1_0.xsd"  
> version="1.0">
>    <persistence-unit name="MyDB" transaction-type="JTA">
>         
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</ 
> provider>
>        <jta-data-source>MyXAPool</jta-data-source>
>          <non-jta-data-source>MyPool</non-jta-data-source>
>        <class>myapp.Customer</class>
>        <properties>
>            <property name="openjpa.Sequence" value="class-table 
> (Table=_SEQ_GENERATOR, UseAliases=true)"/>
>             <property name="openjpa.jdbc.SynchronizeMappings"  
> value="buildSchema(ForeignKeys=true)" />
>             <property name="openjpa.jdbc.DBDictionary"  
> value="postgres"/>
>             <property name="openjpa.Multithreaded" value="true" />
>            <property name="openjpa.TransactionMode" value="managed" />
>            <property name="openjpa.NontransactionalRead"  
> value="true" />
>            <property name="openjpa.RestoreState" value="all" / 
> >                   <property name="openjpa.Optimistic"  
> value="false"/>          </properties>
>    </persistence-unit>
> </persistence>
>
> And my application works :))
> Thanks for your help
>
> Beniamin
>


Re: Two phase commit - JPA + JMS

Posted by Tomasz Mazan <wi...@wp.pl>.
I've moved resourceadapter configuration to independent deployment plan 
and deploy DatabasePools - successfully.
persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence 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_1_0.xsd" version="1.0">
    <persistence-unit name="MyDB" transaction-type="JTA">
        
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
        <jta-data-source>MyXAPool</jta-data-source>
          <non-jta-data-source>MyPool</non-jta-data-source>
        <class>myapp.Customer</class>
        <properties>
            <property name="openjpa.Sequence" 
value="class-table(Table=_SEQ_GENERATOR, UseAliases=true)"/>
             <property name="openjpa.jdbc.SynchronizeMappings" 
value="buildSchema(ForeignKeys=true)" />
             <property name="openjpa.jdbc.DBDictionary" value="postgres"/>
             <property name="openjpa.Multithreaded" value="true" />
            <property name="openjpa.TransactionMode" value="managed" />
            <property name="openjpa.NontransactionalRead" value="true" />
            <property name="openjpa.RestoreState" value="all" />        
            <property name="openjpa.Optimistic" value="false"/>   
        </properties>
    </persistence-unit>
 
</persistence>

And my application works :))
Thanks for your help

Beniamin

Re: Two phase commit - JPA + JMS

Posted by Matt Hogstrom <ma...@hogstrom.org>.
Tomasz,

Here is a sample  derived from DayTrader where we setup XA and non-XA  
datasources.  I created new RA's for PostgreSQL, but haven't tested  
them, that should work but hopefully you can tell me if there are  
issues.

You'll need this jar for PostgreSQL 8.2 http://jdbc.postgresql.org/ 
download/postgresql-8.2-506.jdbc3.jar and need to place it in the  
Geronimo repo and place a dependency element in your plan.

You'll also need the rars which you can find at:

http://snapshots.repository.codehaus.org/org/tranql/tranql-connector- 
postgresql-xa/8.2-SNAPSHOT/tranql-connector-postgresql- 
xa-8.2-20070905.015528-1.rar
http://snapshots.repository.codehaus.org/org/tranql/tranql-connector- 
postgresql-local/8.2-SNAPSHOT/tranql-connector-postgresql- 
local-8.2-20070905.015528-1.rar

rename these to 8.2-SNAPSHOT and place them in the Geronimo repo.

     <ext-module>
         <connector>YourDataSource</connector>
         <external-path xmlns:dep="http://geronimo.apache.org/xml/ns/ 
deployment-1.2">
             <dep:groupId>org.tranql</dep:groupId>
             <dep:artifactId>tranql-connector-postgresql-xa</ 
dep:artifactId>
             <dep:version>8-2.SNAPSHOT</dep:version>
             <dep:type>rar</dep:type>
         </external-path>
         <connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/ 
connector-1.2">
             <resourceadapter>
                 <outbound-resourceadapter>
                     <connection-definition>
                         <connectionfactory- 
interface>javax.sql.DataSource</connectionfactory-interface>
                         <connectiondefinition-instance>
                             <name>jdbc/YourXADataSource</name>
                             <config-property-setting  
name="DatabaseName">YourDatabaseName</config-property-setting>
                             <config-property-setting  
name="Description"></config-property-setting>
                             <config-property-setting  
name="UserName"></config-property-setting>
                             <config-property-setting  
name="Password"></config-property-setting>
                             <config-property-setting  
name="PortNumber"></config-property-setting>
                             <config-property-setting  
name="ServerName"></config-property-setting>
                             <config-property-setting  
name="LoginTimeout"></config-property-setting>
                             <connectionmanager>
                                 <xa-transaction>
                                     <transaction-caching/>
                                 </xa-transaction>
                                 <single-pool>
                                     <max-size>100</max-size>
                                     <min-size>0</min-size>
                                     <blocking-timeout- 
milliseconds>5000</blocking-timeout-milliseconds>
                                     <idle-timeout-minutes>30</idle- 
timeout-minutes>
                                     <match-one/>
                                 </single-pool>
                             </connectionmanager>
                         </connectiondefinition-instance>
                         <connectiondefinition-instance>
                             <name>jdbc/NoTxYourDataSource</name>
                             <config-property-setting  
name="DatabaseName">YourDatabaseName</config-property-setting>
                             <config-property-setting  
name="Description"></config-property-setting>
                             <config-property-setting  
name="UserName"></config-property-setting>
                             <config-property-setting  
name="Password"></config-property-setting>
                             <config-property-setting  
name="PortNumber"></config-property-setting>
                             <config-property-setting  
name="ServerName"></config-property-setting>
                             <config-property-setting  
name="LoginTimeout"></config-property-setting>
                             <connectionmanager>
                                 <no-transaction/>
                                 <single-pool>
                                     <max-size>10</max-size>
                                     <min-size>0</min-size>
                                     <blocking-timeout- 
milliseconds>5000</blocking-timeout-milliseconds>
                                     <idle-timeout-minutes>30</idle- 
timeout-minutes>
                                     <match-one/>
                                 </single-pool>
                             </connectionmanager>
                         </connectiondefinition-instance>
                     </connection-definition>
                 </outbound-resourceadapter>
             </resourceadapter>
         </connector>
     </ext-module>


On Sep 3, 2007, at 6:55 PM, Tomasz Mazan wrote:

>
>> Basically yes.  Geronimo won't prevent you from using non-xa  
>> datasources and jms connection factories in JTA transactions, but  
>> if anything goes wrong your data may be left in an inconsistent  
>> state.
>>
>> If you find that xa is too slow there may be ways of using non-xa  
>> jms connection factories as long as the messages are idempotent,  
>> that is sending the same message multiple times has the same  
>> effect as sending it once.  I'm not an expert on this but I think  
>> there's periodic discussion on the activemq lists.  I would start  
>> with xa everywhere and see if there are problems.
>>
>> thanks
>> david jencks
>
> David, I currently try to configure deployment plan to create  
> XADataSource for my application.
> Could you tell me how looks Geronimo-Postgresql deployment plan for  
> XA ?
>
> TIA
> Tomasz Mazan
>


Re: Two phase commit - JPA + JMS

Posted by Tomasz Mazan <wi...@wp.pl>.
> Basically yes.  Geronimo won't prevent you from using non-xa 
> datasources and jms connection factories in JTA transactions, but if 
> anything goes wrong your data may be left in an inconsistent state.
>
> If you find that xa is too slow there may be ways of using non-xa jms 
> connection factories as long as the messages are idempotent, that is 
> sending the same message multiple times has the same effect as sending 
> it once.  I'm not an expert on this but I think there's periodic 
> discussion on the activemq lists.  I would start with xa everywhere 
> and see if there are problems.
>
> thanks
> david jencks

David, I currently try to configure deployment plan to create 
XADataSource for my application.
Could you tell me how looks Geronimo-Postgresql deployment plan for XA ?

TIA
Tomasz Mazan

Re: Two phase commit - JPA + JMS

Posted by David Jencks <da...@yahoo.com>.
On Aug 30, 2007, at 5:21 PM, Tomasz Mazan wrote:

> David Jencks pisze:
>>
>> On Aug 30, 2007, at 8:05 AM, Tomasz Mazan wrote:
>>
>>>
>>> My application uses JPA to persist data and JMS destinations to  
>>> send requests
>>> to external systems. I want to make transaction using both JPA  
>>> and JMS
>>> technologies. Over these I use SessionBeans as WebServices and  
>>> this layer
>>> should manage transaction.
>>>
>>> Could you advice the best solution and point out documentation  
>>> which could
>>> be helpful?
>>
>> As long as you use CMT or BMT with UserTransaction with your  
>> session beans and container managed persistence with your JPA  
>> beans this should all work with no additional configuration.  Is  
>> something not working?
>>
>> At the moment there's a problem with message driven beans not  
>> participating in recovery but it doesn't sound like you are using  
>> MDBs?  In any case 2phase commit should still work with mdbs as  
>> long as nothing crashes :-)
>>
>> thanks
>> david jencks
> I've just started developing transactions within our application,  
> so I've not found any problems yet. The only thing I need (and i  
> must) is using XA for DataSources, Jms Connection factories - am I  
> right?
>
Basically yes.  Geronimo won't prevent you from using non-xa  
datasources and jms connection factories in JTA transactions, but if  
anything goes wrong your data may be left in an inconsistent state.

If you find that xa is too slow there may be ways of using non-xa jms  
connection factories as long as the messages are idempotent, that is  
sending the same message multiple times has the same effect as  
sending it once.  I'm not an expert on this but I think there's  
periodic discussion on the activemq lists.  I would start with xa  
everywhere and see if there are problems.

thanks
david jencks


> Tomasz Mazan
>


Re: Two phase commit - JPA + JMS

Posted by Tomasz Mazan <wi...@wp.pl>.
David Jencks pisze:
>
> On Aug 30, 2007, at 8:05 AM, Tomasz Mazan wrote:
>
>>
>> My application uses JPA to persist data and JMS destinations to send 
>> requests
>> to external systems. I want to make transaction using both JPA and JMS
>> technologies. Over these I use SessionBeans as WebServices and this 
>> layer
>> should manage transaction.
>>
>> Could you advice the best solution and point out documentation which 
>> could
>> be helpful?
>
> As long as you use CMT or BMT with UserTransaction with your session 
> beans and container managed persistence with your JPA beans this 
> should all work with no additional configuration.  Is something not 
> working?
>
> At the moment there's a problem with message driven beans not 
> participating in recovery but it doesn't sound like you are using 
> MDBs?  In any case 2phase commit should still work with mdbs as long 
> as nothing crashes :-)
>
> thanks
> david jencks
I've just started developing transactions within our application, so 
I've not found any problems yet. The only thing I need (and i must) is 
using XA for DataSources, Jms Connection factories - am I right?

Tomasz Mazan


Re: Two phase commit - JPA + JMS

Posted by David Jencks <da...@yahoo.com>.
On Aug 30, 2007, at 8:05 AM, Tomasz Mazan wrote:

>
> My application uses JPA to persist data and JMS destinations to  
> send requests
> to external systems. I want to make transaction using both JPA and JMS
> technologies. Over these I use SessionBeans as WebServices and this  
> layer
> should manage transaction.
>
> Could you advice the best solution and point out documentation  
> which could
> be helpful?

As long as you use CMT or BMT with UserTransaction with your session  
beans and container managed persistence with your JPA beans this  
should all work with no additional configuration.  Is something not  
working?

At the moment there's a problem with message driven beans not  
participating in recovery but it doesn't sound like you are using  
MDBs?  In any case 2phase commit should still work with mdbs as long  
as nothing crashes :-)

thanks
david jencks

>
> regards
> Tomasz Mazan
> -- 
> View this message in context: http://www.nabble.com/Two-phase- 
> commit---JPA-%2B-JMS-tf4354848s134.html#a12409188
> Sent from the Apache Geronimo - Users mailing list archive at  
> Nabble.com.
>