5 Replies Latest reply on Nov 13, 2011 1:38 PM by Rick Snyder

    Providing 'url-selector-strategy-class-name' in JBoss AS 5.1.0.GA does not work

    Rick Snyder Newbie

      I'd like to contribute a patch for an issue I recently discovered in JBoss AS 5.1.0.GA.

       

      I am running Windows 7, and am using the Oracle JDK, version 1.6.0_27.

       

      Here is an example of my data source configuration.

       

      <datasources>

        <local-tx-datasource>
          <jndi-name>as400/AS400-DS</jndi-name>
          <connection-url>jdbc:as400:primaryhost;prompt=false|jdbc:as400:secondaryhost;prompt=false</connection-url>
          <url-delimiter>|</url-delimiter>
          <url-selector-strategy-class-name>org.example.MyUrlSelectorStrategy</url-selector-strategy-class-name>
          <driver-class>com.ibm.as400.access.AS400JDBCDriver</driver-class>
          <user-name>my_user_name</user-name>
          <password>p4ssw0rd</password>
          <metadata>
             <type-mapping>DB2</type-mapping>
          </metadata>
          <background-validation-millis>15000</background-validation-millis>
          <min-pool-size>5</min-pool-size>
          <max-pool-size>5</max-pool-size>
          <blocking-timeout-millis>1000</blocking-timeout-millis>
          <idle-timeout-minutes>5</idle-timeout-minutes>
        </local-tx-datasource>

      </datasources>

       

      When providing the 'url-selector-strategy-class-name' attribute in a local-tx-datasource definition, the value specified is ignored, and the default implementation ends up being used instead.

       

      After digging around in the code, I noticed that in connector/src/main/org/jboss/resource/metadata/mcf/DataSourceDeploymentMetaData.java, the getManagedConnectionFactoryProperties method should call

       

      property.setName("UrlSelectorStrategyClassName");

       

      instead of

       

      property.setName("URLSelectorStrategyClassName");

       

      in order to properly set the property with the name 'urlSelectorStrategyClassName' on the class BaseWrapperManagedConnectionFactory.java.

       

      I've confirmed that, after making the change, the server reads in the property correctly and uses the associated class for URL selection strategy when connecting to the database with the configured URLs.