5 Replies Latest reply on Dec 2, 2011 8:52 AM by jesper.pedersen

    How to configure XA datasources for automatic recovery

    mmusgrov

      Starting from AS7 it is now possible to have automatic recovery of XA datasources. However, I am not seeing this happening:

       

      I configured two H2 xa datasources, started a transaction which accessed both datasources and killed the AS during the commit of the second datasource (this generates a recovery record for the second XA resource). On restart the transaction recovery system invokes the JCA recovery helper asking it for an XAResource on which to perform recovery. The JCA helper returns null because there is no security domain associated with the datasource, hence the transaction never completes. I'd appreciate any hints for how I should be configuring the datasource for recovery.

       

      My datasource configuration is in a related post (http://community.jboss.org/thread/175065). The command shell reports the following config:

       

                  "java:jboss/datasources/ExampleDS2" => {
                      "allocation-retry" => undefined,
                      "allocation-retry-wait-millis" => undefined,
                      "background-validation" => undefined,
                      "background-validation-millis" => undefined,
                      "blocking-timeout-wait-millis" => undefined,
                      "check-valid-connection-sql" => undefined,
                      "driver-name" => "h2",
                      "exception-sorter-class-name" => undefined,
                      "exception-sorter-properties" => undefined,
                      "flush-strategy" => undefined,
                      "idle-timeout-minutes" => undefined,
                      "interleaving" => "false",
                      "jndi-name" => "java:jboss/datasources/ExampleDS2",
                      "max-pool-size" => undefined,
                      "min-pool-size" => undefined,
                      "new-connection-sql" => undefined,
                      "no-recovery" => undefined,
                      "no-tx-separate-pool" => "false",
                      "pad-xid" => "false",
                      "password" => "sa",
                      "pool-name" => "H2XADS2",
                      "pool-prefill" => undefined,
                      "pool-use-strict-min" => undefined,
                      "prepared-statements-cache-size" => undefined,
                      "query-timeout" => undefined,
                      "reauth-plugin-class-name" => undefined,
                      "reauth-plugin-properties" => undefined,
                      "recovery-password" => undefined,
                      "recovery-plugin-class-name" => undefined,
                      "recovery-plugin-properties" => undefined,
                      "recovery-security-domain" => undefined,
                      "recovery-username" => undefined,
                      "same-rm-override" => "false",
                      "security-domain" => undefined,
                      "set-tx-query-timeout" => "false",
                      "share-prepared-statements" => "false",
                      "spy" => false,
                      "stale-connection-checker-class-name" => undefined,
                      "stale-connection-checker-properties" => undefined,
                      "track-statements" => "\"NOWARN\"",
                      "transaction-isolation" => undefined,
                      "url-delimiter" => undefined,
                      "url-selector-strategy-class-name" => undefined,
                      "use-ccm" => true,
                      "use-fast-fail" => "false",
                      "use-java-context" => true,
                      "use-try-lock" => undefined,
                      "user-name" => "sa",
                      "valid-connection-checker-class-name" => undefined,
                      "valid-connection-checker-properties" => undefined,
                      "validate-on-match" => "false",
                      "wrap-xa-resource" => "true",
                      "xa-datasource-class" => "org.h2.jdbcx.JdbcDataSource",
                      "xa-resource-timeout" => undefined,
                      "xa-datasource-properties" => {"URL" => {"value" => "jdbc:h2:mem:test2"}}
                  }