Bug #95990 mysql-connector-java 8.0.16 can't used xdevapi
Submitted: 26 Jun 2019 3:18 Modified: 9 Jul 2019 12:54
Reporter: xd l Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:8.0.16 OS:Windows (win10)
Assigned to: CPU Architecture:x86

[26 Jun 2019 3:18] xd l
Description:
Exception in thread "main" com.mysql.cj.protocol.x.XProtocolError: ASSERTION FAILED: Unknown message type: 10 (server messages mapping: null)
	at com.mysql.cj.protocol.x.XProtocol.readServerCapabilities(XProtocol.java:787)
	at com.mysql.cj.protocol.x.XProtocol.beforeHandshake(XProtocol.java:262)
	at com.mysql.cj.protocol.x.XProtocol.connect(XProtocol.java:368)
	at com.mysql.cj.MysqlxSession.<init>(MysqlxSession.java:70)
	at com.mysql.cj.xdevapi.SessionImpl.<init>(SessionImpl.java:72)
	at com.mysql.cj.xdevapi.SessionFactory.getSession(SessionFactory.java:78)
	at com.mysql.cj.xdevapi.SessionFactory.getSession(SessionFactory.java:97)
	at com.tengwow.cloud.uniqueaccount.UniqueAccountProgram.main(UniqueAccountProgram.java:19)
Caused by: com.mysql.cj.exceptions.AssertionFailedException: ASSERTION FAILED: Unknown message type: 10 (server messages mapping: null)
	at com.mysql.cj.exceptions.AssertionFailedException.shouldNotHappen(AssertionFailedException.java:73)
	at com.mysql.cj.protocol.x.MessageConstants.getMessageClassForType(MessageConstants.java:187)
	at com.mysql.cj.protocol.x.SyncMessageReader.readMessage(SyncMessageReader.java:151)
	at com.mysql.cj.protocol.x.SyncMessageReader.readMessage(SyncMessageReader.java:54)
	at com.mysql.cj.protocol.x.XProtocol.readServerCapabilities(XProtocol.java:784)
	... 7 more

How to repeat:
every times used this api,always throw this exception
[26 Jun 2019 8:38] MySQL Verification Team
Hello!

Thank you for the report.

regards,
Umesh
[2 Jul 2019 8:31] Alexander Soklakov
Hi,

It looks like you just use a wrong port for connecting to xdevapi. Please not that  X Protocol is listening on 33060 by default, while the classic protocol is on 3306. Check the mysqlx_port sysvar value and use it's value in a xdevapi connection string.
[5 Jul 2019 2:34] xd l
Hello!

    I has used 33060 port,but thorw execptions too.

    Example:new SessionFactory().getSession("mysqlx://localhost:33060/lj?user=root&password=xxxxxxx").getSchema("lj").getCollection("test_json");

    Exception:

Exception in thread "main" com.mysql.cj.exceptions.WrongArgumentException: Unexpected message class. Expected 'Capabilities' but actually received 'Frame'
	at com.mysql.cj.protocol.x.SyncMessageReader.readMessage(SyncMessageReader.java:144)
	at com.mysql.cj.protocol.x.SyncMessageReader.readMessage(SyncMessageReader.java:52)
	at com.mysql.cj.protocol.x.XProtocol.readServerCapabilities(XProtocol.java:588)
	at com.mysql.cj.protocol.x.XProtocol.beforeHandshake(XProtocol.java:231)
	at com.mysql.cj.protocol.x.XProtocol.connect(XProtocol.java:284)
	at com.mysql.cj.MysqlxSession.<init>(MysqlxSession.java:67)
	at com.mysql.cj.xdevapi.SessionImpl.<init>(SessionImpl.java:73)
	at com.mysql.cj.xdevapi.SessionFactory.getSession(SessionFactory.java:78)
	at com.mysql.cj.xdevapi.SessionFactory.getSession(SessionFactory.java:97)
	at com.tengwow.cloud.edi.EdiProgram.main(EdiProgram.java:26)
[5 Jul 2019 8:32] xd l
Sorry!

    I test version is 8.0.13,the version 8.0.16 no problem

Thanks