4 Replies Latest reply on Dec 20, 2013 5:29 AM by wdfink

    Creating XA Datasource from the CLI fails

    mylos78

      Hi all !

      I'd need to create an XA Datasource for MySQL Database using the CLI. The module and drive installation works ok:

       

      [standalone@localhost:9990 /] module add --name=com.mysql --resources=/usr/share/libs/mysql-connector-java-5.1.24-bin.jar --dependencies=javax.api,javax.transaction.api

       

       

      [standalone@localhost:9990 /] /subsystem=datasources/jdbc-driver=mysql:add(driver-name=mysql,driver-module-name=com.mysql)

      {"outcome" => "success"}

       

      Unfortunately when I try to register the XA-Datasource it fails:

       

      [standalone@localhost:9990 /] /subsystem=datasources/xa-data-source="MySqlDSXA":add(xa-datasource-class=com.mysql.jdbc.jdbc2.optional.MysqlXADataSource,jndi-name="java:/MySqlDSXA",driver-name="mysql")

      {

          "outcome" => "failed",

          "failure-description" => "JBAS010469: At least one xa-datasource-property is

      required for an xa-datasource",

          "rolled-back" => true

      }

       

      I could see this error also in AS7 forums but I could not find a workaround for it. Did anybody manage to create an XA Datasource from the CLI?

      Thanks

      Mylos

        • 1. Re: Creating XA Datasource from the CLI fails
          wdfink

          That sounds like a bug to me.

          the xa-datasource-property is a sub-element of xa-datasource.

          A xa-datasource look like this:

            <xa-datasource jndi-name="java:/MySqlDSXA" pool-name="MySqlDSXA">

              <driver>mysql</driver>

               <xa-datasource-property name="ServerName">localhost</xa-datasource-property>

               <xa-datasource-property name="DatabaseName">mydb</xa-datasource-property>

               <security>

                 <user-name>admin</user-name>

                 <password>admin</password>

               </security>

            </xa-datasource>


          which WildFly version do you use? Is it the latest?

          • 2. Re: Creating XA Datasource from the CLI fails
            mylos78

            Hi , thanks for your reply. Well the above test was run against the Beta1 release, but I remember hitting the same issue on the Beta2 Snapshot.....

            Any workaround ?

            Thanks

            Mylos

            • 3. Re: Creating XA Datasource from the CLI fails
              wdfink

              You can add the xa-datasource by editing the xml.

               

              Another option is to use the operation in CLI

              xa-data-source add --name=MySqlDSXA --jndi-name="java:/test" --driver-name=mysql --xa-datasource-class=com.mysql.jdbc.jdbc2.optional.MysqlXADataSource --xa-datasource-properties=[{ServerName=localhost}]

              • 4. Re: Creating XA Datasource from the CLI fails
                wdfink

                If you try to use your approach you need to handle it as a batch

                 

                batch

                /subsystem=datasources/xa-data-source="MySqlDSXA":add(xa-datasource-class=com.mysql.jdbc.jdbc2.optional.MysqlXADataSource,jndi-name="java:/MySqlDSXA",driver-name="mysql")

                /subsystem=datasources/xa-data-source="MySqlDSXA"/xa-datasource-properties=ServerName:add(value="localhost")

                /subsystem=datasources/xa-data-source="MySqlDSXA"/xa-datasource-properties=DatabaseName:add(value="mydb")

                run-batch

                 

                In that case it works