0 Replies Latest reply on Aug 5, 2011 4:02 PM by Tim Haley

    MySQL XA Datasource - "No matching credentials in Subject!"

    Tim Haley Newbie

      I am working with JBoss AS 6.0.0.Final and 6.1.0-SNAPSHOT-68, they both have the same issue:

      I have a MySQL database running on the localhost at port 56838

      I configured an xa-datasource.

      When I test the datasource via the Admin Console, or when my application attemts to access the datasources, I get the following error:

       

      {noformat}
      13:54:53,996 WARN  [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Throwable while attempting to get a new connection: null: org.jboss.resource.JBossResourceException: No matching credentials in Subject!
              at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnectionFactory.getConnectionProperties(BaseWrapperManagedConnectionFactory.java:506) [:6.0.0-Final]
              at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:191) [:6.0.0-Final]
              at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:648) [:6.0.0-Final]
              at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:272) [:6.0.0-Final]
              at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:690) [:6.0.0-Final]
              at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:403) [:6.0.0-Final]
              at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:380) [:6.0.0-Final]
              at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:496) [:6.0.0-Final]
              at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:941) [:6.0.0-Final]
              at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:89) [:6.0.0-Final]

      {noformat}

       

      The Admin Console reports that a connection was obtained, but the exception above appears in the console output. My application is not expecting this exception, so it fails when it receives this exception.

      My configuration is as follows:

       

      MySQL-ds.xml:

      {code:xml}

       

      <?xml version="1.0" encoding="UTF-8"?>

      <!DOCTYPE datasources

          PUBLIC "-//JBoss//DTD JBOSS JCA Config 6.0//EN"

          "http://www.jboss.org/j2ee/dtd/jboss-ds_6_0.dtd">   

      <datasources>

          <xa-datasource>

              <jndi-name>test/jdbc/XADataSource</jndi-name>

              <use-java-context>false</use-java-context>

              <track-connection-by-tx/>

              <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>

              <xa-datasource-property name="URL">jdbc:mysql://localhost:56838/testjboss</xa-datasource-property>

              <isSameRM-override-value>false</isSameRM-override-value>

              <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>

              <user-name>test</user-name>

              <password>test</password>

              <security-domain>XaTxDb</security-domain>

              <min-pool-size>1</min-pool-size>

              <max-pool-size>120</max-pool-size>

              <blocking-timeout-millis>30000</blocking-timeout-millis>

              <background-validation>false</background-validation>

              <background-validation-millis>0</background-validation-millis>

              <idle-timeout-minutes>30</idle-timeout-minutes>

              <allocation-retry>0</allocation-retry>

              <allocation-retry-wait-millis>5000</allocation-retry-wait-millis>

              <validate-on-match>true</validate-on-match>

              <no-tx-separate-pools/>

              <xa-resource-timeout>0</xa-resource-timeout>

              <track-statements/>

              <prefill>false</prefill>

              <type-mapping>MySQL</type-mapping>

          </xa-datasource> 

      </datasources>

      {code}

       

      My login-config.xml file contains the following application-policy:

       

      {code:xml}
      <application-policy name = "XaTxDb">

         <authentication>

           <login-module code="org.jboss.resource.security.ConfiguredIdentityLoginModule"

                         flag="required">

      <module-option name="principal">test</module-option>

      <module-option name="userName">test</module-option>

      <module-option name="password">test</module-option>

      <module-option name="managedConnectionFactoryName">jboss.jca:service=XATxCM,name=test/jdbc/XADataSource</module-option>

           </login-module>

         </authentication>

      </application-policy>

      {code}

      If I remove the user-name and password tags from the datasource, I get the same exception but I also get an error message from mysql:
          Access denied for user ''@'localhost' to database 'testjboss'


      If restore the credentials in the datasource and remove the security-domain tag from the datasource and remove the corresponding application policy from login-config.xml, I get the same exception and the admin console reports that a connection was not obtained, but I don't get the mysql exception.

       

      I can get a no-transaction datasource to work, but only if I have both credentials in the datasource and a valid security-domain.

       

      Isn't the security-domain supposed to replace the credentials in the datasource?
      If I have credentials in the datasource I shouldn't need a security domain, should I?
      And what does "No matching credentials in Subject!" mean?

       

      I have been going around in circles for a couple of days now and any help would be greatly appreciated.