Bug #79240 Connection error while testing fabric configuration
Submitted: 11 Nov 2015 18:40 Modified: 16 Sep 2016 19:57
Reporter: Nerijus Baliunas Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Documentation Severity:S2 (Serious)
Version:5.1.37 OS:Red Hat
Assigned to: CPU Architecture:Any
Tags: fabric

[11 Nov 2015 18:40] Nerijus Baliunas
Description:
Similar to bug 72850. I try to add fabric datasource to WildFly 9.0.1.
Connection string:
jdbc:mysql:fabric://127.0.0.1:32274/mysql?fabricUsername=admin&fabricPassword=passwo+rd&fabricServerGroup=my_group

WildFly log:

2015-11-11 20:32:41,320 INFO  [org.jboss.as.controller.management-deprecated] (XNIO-1 task-2) WFLYCTL0028: Attribute 'enabled' in the resource at address '/subsystem=datasources/data-source=MySqlDS' is deprecated, and may be removed in future version. See the attribute description in the output of the read-resource-description operation to learn more about the deprecation.
2015-11-11 20:32:41,331 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-6) WFLYJCA0001: Bound data source [java:/MySqlDS]
2015-11-11 20:32:41,557 WARN  [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (XNIO-1 task-6) IJ000604: Throwable while attempting to get a new connection: null: javax.resource.ResourceException: IJ031084: Unable to create connection
	at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:336)
	at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:343)
	at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:278)
	at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:1224)
	at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:484)
	at org.jboss.jca.core.connectionmanager.pool.AbstractPool.internalTestConnection(AbstractPool.java:1056)
	at org.jboss.jca.core.connectionmanager.pool.strategy.OnePool.testConnection(OnePool.java:91)
	at org.jboss.as.connector.subsystems.common.pool.PoolOperations$TestConnectionInPool.invokeCommandOn(PoolOperations.java:232)
	at org.jboss.as.connector.subsystems.common.pool.PoolOperations$1.execute(PoolOperations.java:88)
	at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:803)
	at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:601)
	at org.jboss.as.controller.AbstractOperationContext.completeStepInternal(AbstractOperationContext.java:354)
	at org.jboss.as.controller.AbstractOperationContext.executeOperation(AbstractOperationContext.java:330)
	at org.jboss.as.controller.OperationContextImpl.executeOperation(OperationContextImpl.java:1183)
	at org.jboss.as.controller.ModelControllerImpl.internalExecute(ModelControllerImpl.java:362)
	at org.jboss.as.controller.ModelControllerImpl.execute(ModelControllerImpl.java:218)
	at org.jboss.as.domain.http.server.DomainApiHandler.handleRequest(DomainApiHandler.java:208)
	at io.undertow.server.handlers.encoding.EncodingHandler.handleRequest(EncodingHandler.java:72)
	at org.jboss.as.domain.http.server.security.SubjectDoAsHandler$1.run(SubjectDoAsHandler.java:72)
	at org.jboss.as.domain.http.server.security.SubjectDoAsHandler$1.run(SubjectDoAsHandler.java:68)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.security.auth.Subject.doAs(Subject.java:415)
	at org.jboss.as.controller.AccessAuditContext.doAs(AccessAuditContext.java:92)
	at org.jboss.as.domain.http.server.security.SubjectDoAsHandler.handleRequest(SubjectDoAsHandler.java:68)
	at org.jboss.as.domain.http.server.security.SubjectDoAsHandler.handleRequest(SubjectDoAsHandler.java:63)
	at io.undertow.server.handlers.BlockingHandler.handleRequest(BlockingHandler.java:56)
	at org.jboss.as.domain.http.server.DomainApiCheckHandler.handleRequest(DomainApiCheckHandler.java:95)
	at io.undertow.security.handlers.AuthenticationCallHandler.handleRequest(AuthenticationCallHandler.java:52)
	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:199)
	at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:774)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.sql.SQLException: Unable to establish connection to the Fabric server
	at com.mysql.fabric.jdbc.FabricMySQLDriver.connect(FabricMySQLDriver.java:80)
	at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:312)
	... 32 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Unable to establish connection to the Fabric server
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
	at com.mysql.jdbc.Util.getInstance(Util.java:387)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:919)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:898)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:887)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:862)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:879)
	at com.mysql.fabric.jdbc.FabricMySQLConnectionProxy.<init>(FabricMySQLConnectionProxy.java:183)
	at com.mysql.fabric.jdbc.JDBC4FabricMySQLConnectionProxy.<init>(JDBC4FabricMySQLConnectionProxy.java:90)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
	at com.mysql.fabric.jdbc.FabricMySQLDriver.connect(FabricMySQLDriver.java:78)
	... 33 more
Caused by: com.mysql.fabric.FabricCommunicationException: Error during call to `dump.servers' (args=[0, ])
	at com.mysql.fabric.proto.xmlrpc.InternalXmlRpcMethodCaller.call(InternalXmlRpcMethodCaller.java:116)
	at com.mysql.fabric.proto.xmlrpc.AuthenticatedXmlRpcMethodCaller.call(AuthenticatedXmlRpcMethodCaller.java:72)
	at com.mysql.fabric.proto.xmlrpc.XmlRpcClient.errorSafeCallMethod(XmlRpcClient.java:149)
	at com.mysql.fabric.proto.xmlrpc.XmlRpcClient.getServerGroups(XmlRpcClient.java:198)
	at com.mysql.fabric.proto.xmlrpc.XmlRpcClient.getServerGroups(XmlRpcClient.java:218)
	at com.mysql.fabric.FabricConnection.refreshState(FabricConnection.java:68)
	at com.mysql.fabric.FabricConnection.<init>(FabricConnection.java:43)
	at com.mysql.fabric.jdbc.FabricMySQLConnectionProxy.<init>(FabricMySQLConnectionProxy.java:181)
	... 40 more
Caused by: java.io.IOException: Server returned HTTP response code: 400 for URL: http://127.0.0.1:32274
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1628)
	at com.mysql.fabric.xmlrpc.Client.execute(Client.java:90)
	at com.mysql.fabric.proto.xmlrpc.InternalXmlRpcMethodCaller.call(InternalXmlRpcMethodCaller.java:113)
	... 47 more

2015-11-11 20:32:41,560 ERROR [org.jboss.as.controller.management-operation] (XNIO-1 task-6) WFLYCTL0013: Operation ("test-connection-in-pool") failed - address: ([
    ("subsystem" => "datasources"),
    ("data-source" => "MySqlDS")
]) - failure description: "WFLYJCA0040: failed to invoke operation: WFLYJCA0047: Connection is not valid"
2015-11-11 20:32:41,598 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-4) WFLYJCA0010: Unbound data source [java:/MySqlDS]

How to repeat:
Try to add the datasource in WildFly server.
[10 Dec 2015 18:23] Filipe Silva
Hi Nerijus,

Thank you for this bug report.

You are getting a connection failure when establishing the connection to your Fabric server. My guess is that there is a problem with your password. I see in your connection string that you are setting the password as "fabricPassword=passwo+rd". Mind that the plus sign will be converted to space after the url decoding process. If you really want to use the plus sign in your password you'll have to write it in the url encoded form instead: "fabricPassword=passwo%2Brd".

Please check if it helps and give us your feedback. Thanks.
[11 Jan 2016 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[23 May 2016 14:01] Nerijus Baliunas
Using "fabricPassword=passwo%2Brd" works, thank you.

Could you please update the docs (add Note in https://dev.mysql.com/doc/mysql-utilities/1.5/en/connector-j-fabric-connect.html) with the info that some characters should be url encoded?
[16 Sep 2016 19:57] Daniel So
Posted by developer:
 
Added the following to the documentation (https://dev.mysql.com/doc/mysql-utilities/1.5/en/connector-j-fabric-connect.html):

"Special characters like + or % in the username or password should be URL encoded."