Bug #73901 | An exception has occurred when I use connection object connect to mysql fabric | ||
---|---|---|---|
Submitted: | 12 Sep 2014 2:02 | Modified: | 26 Sep 2014 8:01 |
Reporter: | liu tao | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / J | Severity: | S3 (Non-critical) |
Version: | OS: | Any | |
Assigned to: | Jess Balint | CPU Architecture: | Any |
[12 Sep 2014 2:02]
liu tao
[19 Sep 2014 7:14]
Karthik Arulappan
Hi.. I am also getting the same error. please help me. Below is my error stacktrace.. java.sql.SQLException: Unable to establish connection to the Fabric server at com.mysql.fabric.jdbc.FabricMySQLDriver.connect(FabricMySQLDriver.java:80) at java.sql.DriverManager.getConnection(DriverManager.java:571) at java.sql.DriverManager.getConnection(DriverManager.java:215) at com.cts.fabric.FabricTest.main(FabricTest.java:32) 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:408) at com.mysql.jdbc.Util.getInstance(Util.java:383) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1023) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:997) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:983) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:928) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:959) at com.mysql.fabric.jdbc.FabricMySQLConnectionProxy.<init>(FabricMySQLConnectionProxy.java:187) at com.mysql.fabric.jdbc.JDBC4FabricMySQLConnectionProxy.<init>(JDBC4FabricMySQLConnectionProxy.java:92) 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:408) at com.mysql.fabric.jdbc.FabricMySQLDriver.connect(FabricMySQLDriver.java:77) ... 3 more Caused by: com.mysql.fabric.FabricCommunicationException: Unknown protocol version: 0 at com.mysql.fabric.Response.<init>(Response.java:45) at com.mysql.fabric.proto.xmlrpc.XmlRpcClient.errorSafeCallMethod(XmlRpcClient.java:153) at com.mysql.fabric.proto.xmlrpc.XmlRpcClient.getServerGroups(XmlRpcClient.java:201) at com.mysql.fabric.proto.xmlrpc.XmlRpcClient.getServerGroups(XmlRpcClient.java:221) at com.mysql.fabric.FabricConnection.refreshState(FabricConnection.java:70) at com.mysql.fabric.FabricConnection.<init>(FabricConnection.java:43) at com.mysql.fabric.jdbc.FabricMySQLConnectionProxy.<init>(FabricMySQLConnectionProxy.java:185) ... 10 more
[19 Sep 2014 7:18]
Karthik Arulappan
my fabric connection url is.. jdbc:mysql:fabric://54.186.39.194:32274/diujsftesting?fabricServerGroup=testgroup&fabricUsername=admin&fabricPassword=pass my fabric config properties were.. [protocol.xmlrpc] address = :32274 threads = 5 user = admin password = disable_authentication = no realm = MySQL Fabric ssl_ca = ssl_cert = ssl_key =
[23 Sep 2014 14:53]
Lorenzo Luconi Trombacchi
I think the problem is due to a compatibility problem between MySQL-utilities 1.4.4 and Connector/J 5.1.32. In Response.java in Connector/J 5.1.32 these lines were added: // parser of protocol version 1 as defined by WL#7760 this.protocolVersion = (Integer) responseData.get(0); if (this.protocolVersion != 1) { throw new FabricCommunicationException("Unknown protocol version: " + this.protocolVersion); } The WL#7760 is listed in (not yet released) MySQL utilities 1.5.1 change log. To solve the problem you can try to install MySQL-utilities 1.5.1, but probably this probably requires a new mysql-connector-python 2.0 (alpha) or you can use MySQL-connector-j 5.1.31.
[23 Sep 2014 15:25]
Lorenzo Luconi Trombacchi
MySQL-Connector-J 5.1.31 doen't work too, for another problem! It tries to convert an int, the port number, in a String in class com.mysql.fabric.proto.xmlrpc.XmlRpcClient.java: ... int port = Integer.valueOf((String)serverData.get(3)); ... and: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String at com.mysql.fabric.proto.xmlrpc.XmlRpcClient.unmarshallServer(XmlRpcClient.java:83) Probably is a protocol change of latest mysql-fabric versions. With connector-python, fabric works out of the box, but with java is a nightmare.
[24 Sep 2014 7:43]
Karthik Arulappan
Hi Lorenzo Luconi Trombacchi , Thank you so much.. connector/J version 5.1.30 is working fine with Mysql utilities 1.4.4.. After that I dint get that protocol version error...
[24 Sep 2014 14:35]
Lorenzo Luconi Trombacchi
Hi Karthik Arulappan, I just tried connector-java 5.1.30 but I found the same problem of 5.1.31 about cast exception for port address (using fabric 1.4.4). The configuration that seems to work for me (I didn't try older version of fabric) is connector/j 5.1.32 with fabric 1.5.1-rc (and connector python 2.0-alpha for fabric). I didn't do many tests but I can get a connection and this is a huge step forward :-) Fabric 1.5.1 is a lot different in the commands output and requires a new configuration section called "protocol.mysql" for a new communication protocol (named MySQL-RPC) that probably can be used as substitute of xmlrpc. Anyway I don't think mysql-fabric is ready for production and we need a compatibility matrix between fabric and connector versions.
[25 Sep 2014 7:23]
Lorenzo Luconi Trombacchi
Hi, I found a workaround for cast exception of port. See: http://bugs.mysql.com/bug.php?id=72850 So I can use 5.1.30 e 5.1.31 with fabric 1.4.4.
[26 Sep 2014 8:01]
liu tao
tanks Karthik Arulappan and Lorenzo Luconi Trombacchi. I had solved this problem,I think this is a compatibility problem. below is my test list: mysql-connector-python-commercial-1.2.2-1.el6.noarch.rpm mysql-utilities-1.4.3-1.el6.noarch.rpm mysql-connector-java-5.1.30-bin connect sucessful mysql-connector-python-commercial-1.2.2-1.el6.noarch.rpm mysql-utilities-1.4.3-1.el6.noarch.rpm mysql-connector-java-5.1.31-bin connect sucessful mysql-connector-python-commercial-1.2.2-1.el6.noarch.rpm mysql-utilities-1.4.3-1.el6.noarch.rpm mysql-connector-java-5.1.32-bin connect fail mysql-connector-python-commercial-1.2.2-1.el6.noarch.rpm mysql-utilities-commercial-1.4.4-1.el6.noarch.rpm mysql-connector-java-5.1.30-bin connect fail mysql-connector-python-commercial-1.2.2-1.el6.noarch.rpm mysql-utilities-commercial-1.4.4-1.el6.noarch.rpm mysql-connector-java-5.1.31-bin connect fail mysql-connector-python-commercial-1.2.2-1.el6.noarch.rpm mysql-utilities-commercial-1.4.4-1.el6.noarch.rpm mysql-connector-java-5.1.32-bin connect fail error information like: Exception in thread "main" java.sql.SQLException: Unable to establish connection to the Fabric server at com.mysql.fabric.jdbc.FabricMySQLDriver.connect(FabricMySQLDriver.java:80) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at test.main(test.java:17) 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(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:408) at com.mysql.jdbc.Util.getInstance(Util.java:383) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1023) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:997) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:983) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:928) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:959) at com.mysql.fabric.jdbc.FabricMySQLConnectionProxy.<init>(FabricMySQLConnectionProxy.java:187) at com.mysql.fabric.jdbc.JDBC4FabricMySQLConnectionProxy.<init>(JDBC4FabricMySQLConnectionProxy.java:92) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:408) at com.mysql.fabric.jdbc.FabricMySQLDriver.connect(FabricMySQLDriver.java:77) ... 3 more Caused by: com.mysql.fabric.FabricCommunicationException: Unknown protocol version: 0 at com.mysql.fabric.Response.<init>(Response.java:45) at com.mysql.fabric.proto.xmlrpc.XmlRpcClient.errorSafeCallMethod(XmlRpcClient.java:153) at com.mysql.fabric.proto.xmlrpc.XmlRpcClient.getServerGroups(XmlRpcClient.java:201) at com.mysql.fabric.proto.xmlrpc.XmlRpcClient.getServerGroups(XmlRpcClient.java:221) at com.mysql.fabric.FabricConnection.refreshState(FabricConnection.java:70) at com.mysql.fabric.FabricConnection.<init>(FabricConnection.java:43) at com.mysql.fabric.jdbc.FabricMySQLConnectionProxy.<init>(FabricMySQLConnectionProxy.java:185) ... 10 more
[14 Oct 2014 21:54]
Jess Balint
All, Thanks for your attention to this. The ChangeLog for Connector/J 5.1.32 states: "Connector/J now supports Fabric 1.5. Older versions of Fabric are no longer supported." (c.f. http://dev.mysql.com/doc/relnotes/connector-j/en/news-5-1-32.html) Some changes were made to the Fabric protocol to prevent issues like this from arising in the future.
[11 Jul 2016 5:51]
Chiranjeevi Battula
http://bugs.mysql.com/bug.php?id=72850 marked as duplicate of this one.