0 Replies Latest reply on Oct 20, 2002 12:59 PM by Uri

    Mssql xa problem

    Uri Newbie

      I?ve configured a simple XA datasource for mssql server. After installing the XA procedures on the server and making sure that the user supplied in the connection properties has permission to run them, I ran a simple example in which a session bean updates an entity bean. When I run the program, it works fine the first time. But when I run it again it systematically fails. I?ve seen someone with a similar problem in my searches, but apparently he didn?t have an answer to it as well. The exception I get on the second time is:

      17:26:45,308 WARN [TxCapsule] XAException: tx=XidImpl [FormatId=257, GlobalId=uri//3, BranchQual=] errorCode=XAER_RMERR
      javax.transaction.xa.XAException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]xa_end (4000000) returns -6
      at com.microsoft.jdbcx.sqlserver.SQLServerImplXAResource.executeXaRpc(Unknown Source)
      at com.microsoft.jdbcx.sqlserver.SQLServerImplXAResource.end(Unknown Source)
      at com.microsoft.jdbcx.base.BaseXAResource.end(Unknown Source)
      at org.jboss.tm.TxCapsule.endResource(TxCapsule.java:1257)
      at org.jboss.tm.TxCapsule.delistResource(TxCapsule.java:588)
      at org.jboss.tm.TransactionImpl.delistResource(TransactionImpl.java:92)
      at org.jboss.resource.connectionmanager.XATxConnectionManager$XAConnectionEventListener.delist(XATxConnectionManager.java:284)
      at org.jboss.resource.connectionmanager.XATxConnectionManager$XAConnectionEventListener.connectionClosed(XATxConnectionManager.java:331)
      at org.jboss.resource.adapter.jdbc.BaseManagedConnection.fireConnectionEvent(BaseManagedConnection.java:152)
      at org.jboss.resource.adapter.jdbc.xa.XAManagedConnection.fireConnectionEvent(XAManagedConnection.java:215)
      at org.jboss.resource.adapter.jdbc.xa.XAManagedConnection$1.connectionClosed(XAManagedConnection.java:127)
      at com.microsoft.jdbcx.base.BasePooledConnection.connectionClosed(Unknown Source)
      at com.microsoft.jdbcx.base.BaseXAConnection.reset(Unknown Source)
      at com.microsoft.jdbcx.base.BasePooledConnectionWrapper.close(Unknown Source)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCUtil.safeClose(JDBCUtil.java:61)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractQueryCommand.execute(JDBCAbstractQueryCommand.java:151)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCFindEntityCommand.execute(JDBCFindEntityCommand.java:44)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.findEntity(JDBCStoreManager.java:541)
      at org.jboss.ejb.plugins.CMPPersistenceManager.findEntity(CMPPersistenceManager.java:336)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.findEntity(CachedConnectionInterceptor.java:301)
      at org.jboss.ejb.EntityContainer.findLocal(EntityContainer.java:634)
      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:324)
      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1116)
      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:73)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:209)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:215)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:88)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:79)
      at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:44)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:111)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:178)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:52)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:105)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:129)
      at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:487)
      at org.jboss.ejb.plugins.local.BaseLocalContainerInvoker.invokeHome(BaseLocalContainerInvoker.java:230)
      at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:110)
      at $Proxy51.findByPrimaryKey(Unknown Source)
      at com.proficiency.test.TestSessionBean.updateTaskFields(TestSessionBean.java:182)
      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:324)
      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:660)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:77)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:107)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:178)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:60)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:130)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:203)
      at org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:313)
      at org.jboss.ejb.Container.invoke(Container.java:720)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:370)
      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:324)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
      at sun.rmi.transport.Transport$1.run(Transport.java:148)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      at java.lang.Thread.run(Thread.java:536)

      Here is my mssql-xa-service.xml:

      <?xml version="1.0" encoding="UTF-8"?>
      <!-- ===================================================================== -->
      <!-- -->
      <!-- JBoss Server Configuration -->
      <!-- -->
      <!-- ===================================================================== -->

      <!-- ==================================================================== -->
      <!-- ConnectionManager setup for xa Microsoft SQL Server 2000, using -->
      <!-- Microsoft's JDBC driver. -->
      <!-- Thanks to Benjamin Geer <benjamin.geer@misys.com> -->
      <!-- Be sure to set the JndiName property to the name you want to look up -->
      <!-- the datasource under and set the location of your database in -->
      <!-- the ManagedConnectionFactoryProperties. -->
      <!-- ==================================================================== -->

      <!-- For optional container managed security, include a login module
      configuration named MSSQLXaDbRealm in conf/login-conf.xml.
      Here is an example login module configuration for a ConfiguredIdentityLoginModule:

      <application-policy name = "MSSQLXaDbRealm">

      <login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule" flag ="required">
      <module-option name = "principal">yourprincipal</module-option>
      <module-option name = "userName">yourusername</module-option>
      <module-option name = "password">yourpassword</module-option>
      <module-option name = "managedConnectionFactoryName">jboss.jca:service=XATxCM,name=cgDS</module-option>
      </login-module>

      </application-policy>

      NOTE: the application-policy name attribute must match SecurityDomainJndiName, and the
      module-option name = "managedConnectionFactoryName"
      must match the object name of the ConnectionManager you are configuring here.
      -->
      <!--uncomment this line if you are using the MSSQLXaDbRealm above
      MSSQLXaDbRealm
      -->
      <depends optional-attribute-name="ManagedConnectionFactoryName">
      <!--embedded mbean-->

      cgDS
      <!--real attributes-->


      <config-property name="XADataSourceProperties" type="java.lang.String">ServerName=server3;DatabaseName=URI;SelectMethod=cursor;User=uri;Password=uri</config-property>
      <config-property name="XADataSourceClass" type="java.lang.String">com.microsoft.jdbcx.sqlserver.SQLServerDataSource</config-property>


      <!--hack-->
      <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=Minerva JDBC XATransaction ResourceAdapter


      <depends optional-attribute-name="ManagedConnectionPool">
      <!--embedded mbean-->

      0
      50
      5000
      15
      <!--criteria indicates if Subject (from security domain) or app supplied
      parameters (such as from getConnection(user, pw)) are used to distinguish
      connections in the pool. Choices are
      ByContainerAndApplication (use both),
      ByContainer (use Subject),
      ByApplication (use app supplied params only),
      ByNothing (all connections are equivalent, usually if adapter supports
      reauthentication)-->
      ByContainer


      <depends optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager
      <depends optional-attribute-name="JaasSecurityManagerService">jboss.security:service=JaasSecurityManager
      java:/TransactionManager
      <!--make the rar deploy! hack till better deployment-->
      jboss.jca:service=RARDeployer



      Can anyone point out what I'm doing wrong?