Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1182879

Summary: url-selector-strategy-class-name is ignored and default URLSelectorStrategy is being used
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Osamu Nagano <onagano>
Component: JCAAssignee: Jesper Pedersen <jpederse>
Status: CLOSED CURRENTRELEASE QA Contact: Martin Simka <msimka>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.3.0CC: jawilson, kkhan, myarboro
Target Milestone: ER3   
Target Release: EAP 6.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1184128    
Attachments:
Description Flags
customclass.zip
none
JDBC module patch none

Description Osamu Nagano 2015-01-16 05:57:14 UTC
Description of problem:
<url-selector-strategy-class-name> can be used to implement a custom strategy to choose the next database connection.  But this configuration is ignored and the default implementation is used always.


Version-Release number of selected component (if applicable):
IronJacamar 1.0.26.Final-redhat-1


How reproducible:
Always.


Steps to Reproduce:

1. Extract customclass.zip into $JBOSS_HOME/modules/system/layers/base/org/jboss/ironjacamar/jdbcadapters/main and edit module.xml like this:
~~~
    <resources>
        <resource-root path="customclass"/>
        <resource-root path="ironjacamar-jdbc-1.0.26.Final-redhat-1.jar"/>
~~~

2. Edit standalone.xml like this:
~~~
            <logger category="org.jboss.jca.adapters.jdbc">
                <level name="DEBUG"/>
            </logger>
    ...
                    <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE|jdbc:h2:mem:test2;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
                    <url-delimiter>|</url-delimiter>
                    <url-selector-strategy-class-name>com.example.MyURLSelector</url-selector-strategy-class-name>
~~~

3. Start the standalone server.


Actual results:
~~~
14:28:02,417 DEBUG [org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory] (MSC service thread 1-5) Default URLSelectorStrategy is being used : URLSelector@400aa57f[urls=[jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE, jdbc:h2:mem:test2;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE] currentUrl=null currentIndex=-1]
~~~


Expected results:
MyURLSelector specified should be used.


Additional info:
When you check "urlSelectorStrategyClassName" attribute of "jboss.as:subsystem=datasources,data-source=ExampleDS" mbean by JConsole, its value is correct one, "com.example.MyURLSelector".

In EAP 5, there was the same bug: https://issues.jboss.org/browse/JBPAPP-9384

Comment 1 Osamu Nagano 2015-01-16 05:57:53 UTC
Created attachment 980748 [details]
customclass.zip

Comment 2 Osamu Nagano 2015-01-19 08:07:33 UTC
Some observations:
1. WildFly 8.2 doesn't have this class.  It seems refactored drastically.
2. org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory#getURLDelimiter() returns "|" but #getUrlSelectorStrategyClassName() returns null, according to debugger.

Comment 4 Jesper Pedersen 2015-02-04 15:02:03 UTC
Created attachment 988142 [details]
JDBC module patch

Try with this JAR as the replacement for the JDBC module

Comment 5 Osamu Nagano 2015-02-05 05:20:53 UTC
It works as expected with the patched one.  Thanks.

~~~
14:13:59,268 DEBUG [org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory] (http-/127.0.0.1:8080-1) Customized URLSelectorStrategy is being used : MyURLSelector@33f7a992[urls=[jdbc:h2:mem:test;DB_CLOSE
_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE, jdbc:h2:mem:test2;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE] currentUrl=null currentIndex=-1]
~~~

Comment 6 JBoss JIRA Server 2015-02-05 13:14:25 UTC
Jesper Pedersen <jpederse> updated the status of jira JBJCA-1245 to Resolved

Comment 7 JBoss JIRA Server 2015-02-16 14:07:18 UTC
Jesper Pedersen <jpederse> updated the status of jira JBJCA-1245 to Closed

Comment 8 Martin Simka 2015-02-27 13:11:39 UTC
verified on EAP 6.4.0.ER3