3 Replies Latest reply on Apr 5, 2008 5:38 PM by William Woodman

    mysql XA config error causes SEAM to fail - any help on whats wrong

    William Woodman Master

      okay


      fell over this by accident.  Here goes.  The error is something to do with datasource config. 


      i've been trying to use an MYSQL xa config (eventally to go distributed).


      If i replace that with local resource only IT WORKS.  NO errors.


      here is the DS config.  The XA config (uncommented) is the one that causes my error.  The local resource version  works fine


      Question now is why does the XA config error ?



      Does any one know/can guess and let me know whats wrong


      
       
      
      <datasources>
      
      <!--
      
         <local-tx-datasource>
      
            <jndi-name>ForstersListDatasource</jndi-name>
      
            <connection-url>jdbc:mysql://localhost:3306/embed</connection-url>
      
            <driver-class>com.mysql.jdbc.Driver</driver-class>
      
            <user-name>embed</user-name>
      
            <password>embed</password>
      
       
      
            <exception-sorter-class-name>
      
               org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter
      
            </exception-sorter-class-name>
      
            <metadata>
      
               <type-mapping>mySQL</type-mapping>
      
            </metadata>
      
         </local-tx-datasource> 
      
       -->   
      
          <xa-datasource> 
      
           <jndi-name>ForstersListDatasource</jndi-name> 
      
           <track-connection-by-tx/> 
      
           <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class > 
      
           <xa-datasource-property name="URL">jdbc:mysql://localhost:3306/embed</xa-datasource-property> 
      
           <user-name>embed</user-name> 
      
           <password>embed</password> 
      
           <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation> 
      
           <max-pool-size>5</max-pool-size> 
      
           <min-pool-size>1</min-pool-size> 
      
           <blocking-timeout-millis>2000</blocking-timeout-millis> 
      
           <idle-timeout-minutes>2</idle-timeout-minutes> 
      
           <no-tx-separate-pools/> 
      
           <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name> 
      
           <metadata> 
      
               <type-mapping>mySQL</type-mapping> 
      
           </metadata> 
      
           </xa-datasource> 
      
           
      
      </datasources>
      
      
      
      



      here is the error trace


      
      
      21:15:23,607 WARN  [TxConnectionManager] Connection error occured: org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@bed7f2[state=NORMAL mc=org.jboss.resource.adapter.jdbc.xa.XAManagedConnection@fcb8d8 handles=1 lastUse=1207340116747 permit=true trackByTx=true mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@1cb7fe0 context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@1387200 xaResource=org.jboss.resource.connectionmanager.xa.JcaXAResourceWrapper@15391e0 txSync=null]
      
      java.lang.NullPointerException
      
           at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.setLong(WrappedPreparedStatement.java:130)
      
           at org.hibernate.type.LongType.set(LongType.java:42)
      
           at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:136)
      
           at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:107)
      
           at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:1997)
      
           at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:1974)
      
           at org.hibernate.persister.entity.AbstractEntityPersister$3.bindValues(AbstractEntityPersister.java:2152)
      
           at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:32)
      
           at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2158)
      
           at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2638)
      
           at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:48)
      
           at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
      
           at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:298)
      
           at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181)
      
           at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:107)
      
           at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131)
      
           at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87)
      
           at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38)
      
           at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618)
      
           at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
      
           at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
      
           at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:212)
      
           at org.jboss.seam.persistence.EntityManagerProxy.persist(EntityManagerProxy.java:135)
      
           at org.jboss.seam.framework.EntityHome.persist(EntityHome.java:84)
      
           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:585)
      
           at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
      
           at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
      
           at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      
           at org.jboss.seam.persistence.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:48)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      
           at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      
           at org.jboss.seam.core.ConversationInterceptor.aroundInvoke(ConversationInterceptor.java:65)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      
           at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:38)
      
           at org.jboss.seam.util.Work.workInTransaction(Work.java:40)
      
           at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:32)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      
           at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      
           at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
      
           at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
      
           at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
      
           at org.domain.ForstersList.session.NodeHome_$$_javassist_6.persist(NodeHome_$$_javassist_6.java)
      
           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:585)
      
           at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
      
           at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:342)
      
           at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
      
           at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
      
           at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
      
           at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
      
           at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
      
           at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
      
           at javax.faces.component.UICommand.broadcast(UICommand.java:383)
      
           at org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:61)
      
           at org.ajax4jsf.component.UIInclude.broadcast(UIInclude.java:138)
      
           at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:184)
      
           at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:162)
      
           at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:350)
      
           at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
      
           at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
      
           at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
      
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
      
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
      
           at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
      
           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
      
           at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
      
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      
           at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      
           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
      
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      
           at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
      
           at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
      
           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
      
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      
           at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
      
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
      
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      
           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      
           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
      
           at java.lang.Thread.run(Thread.java:595)
      
      21:15:23,627 INFO  [LongType] could not bind value '0' to parameter: 1; Error; - nested throwable: (java.lang.NullPointerException)
      
      21:15:23,637 FATAL [application] /node.xhtml @52,58 action="#{nodeHome.persist}": java.lang.NullPointerException
      
      javax.faces.el.EvaluationException: /node.xhtml @52,58 action="#{nodeHome.persist}": java.lang.NullPointerException
      
           at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:73)
      
           at com.sun.
      
      
      DOT DOT DOT 
      
      
      21:15:23,697 ERROR [XAManagedConnectionFactory] End transaction failed for XAResource
      
      com.mysql.jdbc.jdbc2.optional.MysqlXAException: No operations allowed after connection closed.
      
           at com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.mapXAExceptionFromSQLException(MysqlXAConnection.java:571)
      
           at com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.dispatchCommand(MysqlXAConnection.java:550)
      
           at com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.end(MysqlXAConnection.java:445)
      
           at org.jboss.resource.adapter.jdbc.xa.XAManagedConnection.end(XAManagedConnection.java:147)
      
           at org.jboss.resource.connectionmanager.xa.JcaXAResourceWrapper.end(JcaXAResourceWrapper.java:58)
      
           at com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord.topLevelAbort(XAResourceRecord.java:372)
      
           at com.arjuna.ats.arjuna.coordinator.BasicAction.doAbort(BasicAction.java:3222)
      
           at com.arjuna.ats.arjuna.coordinator.BasicAction.doAbort(BasicAction.java:3200)
      
           at com.arjuna.ats.arjuna.coordinator.BasicAction.Abort(BasicAction.java:1928)
      
           at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.cancel(TwoPhaseCoordinator.java:105)
      
           at com.arjuna.ats.arjuna.AtomicAction.abort(AtomicAction.java:201)
      
           at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.rollbackAndDisassociate(TransactionImple.java:1458)
      
           at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.rollback(BaseTransaction.java:163)
      
           at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.rollback(BaseTransactionManagerDelegate.java:126)
      
           at org.jboss.tm.usertx.client.ServerVMClientUserTransaction.rollback(ServerVMClientUserTransaction.java:148)
      
           at org.jboss.seam.transaction.UTTransaction.rollback(UTTransaction.java:66)
      
           at org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:597)
      
           at org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsAfterPhase(SeamPhaseListener.java:330)
      
           at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:231)
      
           at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:182)
      
           at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:280)
      
           at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
      
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
      
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
      
           at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
      
           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
      
           at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
      
           at org.jboss.s
      
      
      




        • 1. Re: mysql XA config error causes SEAM to fail - any help on whats wrong
          Dustin Norlander Apprentice

          I'm no expert, but I am successfully using XA data sources in trendrr.com.  My config is very similar to yours, but you are missing the following:


          <!-- This disables transaction interleaving (which BTW, most DB vendors don't support) -->
          <track-connection-by-tx>true</track-connection-by-tx>
          <no-tx-separate-pools>true</no-tx-separate-pools>
          



          hopefully that helps,


          Dustin

          • 2. Re: mysql XA config error causes SEAM to fail - any help on whats wrong
            William Woodman Master

            Thanks dustin - but it didnt fix it


            I went back and tried that, and also found a reference to aanother problem some one had on the mysql pages.


            my revised copy of the ds looks this.  However this fails also.


            I cant see any parse errors when i load the DS


            the ref i was read is at


            
            
            http://bugs.mysql.com/bug.php?id=17734
            
            
            


            and here is my revised DS


            
            ...
            
                <xa-datasource> 
            
                 <jndi-name>ForstersListDatasource</jndi-name> 
            
                 <track-connection-by-tx/> 
            
                 <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class > 
            
                 <xa-datasource-property name="URL">jdbc:mysql://localhost:3306/embed</xa-datasource-property> 
            
                 <user-name>embed</user-name> 
            
                 <password>embed</password> 
            
                 <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation> 
            
                 <max-pool-size>5</max-pool-size> 
            
                 <min-pool-size>1</min-pool-size> 
            
                 <blocking-timeout-millis>2000</blocking-timeout-millis> 
            
                 <idle-timeout-minutes>2</idle-timeout-minutes> 
            
                 <track-connection-by-tx>true</track-connection-by-tx>
            
                 <new-connection-sql>set autocommit=1</new-connection-sql>
            
                 <no-tx-separate-pools>true</no-tx-separate-pools>
            
                 <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name> 
            
                 <metadata> 
            
                     <type-mapping>mySQL</type-mapping> 
            
                 </metadata> 
            
                 </xa-datasource> 
            
                 ...
            
            



            • 3. Re: mysql XA config error causes SEAM to fail - any help on whats wrong
              William Woodman Master

              HOORAY - whoopee-


              did a general search and found something on the MYSQL pages -


              connector/J 5.1.5 had a bug somewhere when used in XA form with wrapped SQL


              Upgrade to 5.1.6 with declared fix and IT WORKS. 


              holy cow.  This one has had me pulling my hair out.


              Thanks for all help on this - for anyone else please dont use 5.1.5 connector J