mycat初识启动遇到的问题总结

1.Mycat 使用版本1.6.4,JDK使用1.7.0_79,启动时wrapper.log日志报错:Unable to locate the class io.mycat.MycatStartup

STATUS | wrapper  | 2021/02/09 15:34:54 | --> Wrapper Started as Daemon

STATUS | wrapper  | 2021/02/09 15:34:54 | Launching a JVM...

INFO   | jvm 1    | 2021/02/09 15:34:54 | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org

INFO   | jvm 1    | 2021/02/09 15:34:54 |   Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.

INFO   | jvm 1    | 2021/02/09 15:34:54 |

INFO   | jvm 1    | 2021/02/09 15:34:54 | WrapperSimpleApp: Unable to locate the class io.mycat.MycatStartup: java.lang.UnsupportedClassVersionError:

 io/mycat/MycatStartup : Unsupported major.minor version 52.0

INFO   | jvm 1    | 2021/02/09 15:34:54 |

INFO   | jvm 1    | 2021/02/09 15:34:54 | WrapperSimpleApp Usage:

INFO   | jvm 1    | 2021/02/09 15:34:54 |   java org.tanukisoftware.wrapper.WrapperSimpleApp {app_class} [app_arguments]

INFO   | jvm 1    | 2021/02/09 15:34:54 |

INFO   | jvm 1    | 2021/02/09 15:34:54 | Where:

INFO   | jvm 1    | 2021/02/09 15:34:54 |   app_class:      The fully qualified class name of the application to run.

INFO   | jvm 1    | 2021/02/09 15:34:54 |   app_arguments:  The arguments that would normally be passed to the

INFO   | jvm 1    | 2021/02/09 15:34:54 |                   application.

STATUS | wrapper  | 2021/02/09 15:34:57 | <-- Wrapper Stopped

解决措施:下载使用jdk1.8.0_281,再启动就正常了。

2.启动时wrapper.log报错:Unable to start JVM: No such file or directory (2)

是因为:/mycat/conf/wrapper.conf文件里配置wrapper.java.command路径有问题

# Java Application

#wrapper.java.command=/usr/java/jdk1.8.0_281/bin/java

wrapper.java.command=%JAVA_HOME%/bin/java

可以使用绝对路径,也可以用%%取环境变量,不能用$JAVA_HOME取环境变量,我开始配成

wrapper.java.command=$JAVA_HOME/bin/java就报错。

 3.启动wrapper.log报错Encountered an error running main: java.lang.ExceptionInInitializerError

WrapperSimpleApp: Encountered an error running main: java.lang.ExceptionInInitializerError

INFO   | jvm 1    | 2021/02/09 18:01:22 | java.lang.ExceptionInInitializerError

INFO   | jvm 1    | 2021/02/09 18:01:22 | at io.mycat.MycatStartup.main(MycatStartup.java:53)

INFO   | jvm 1    | 2021/02/09 18:01:22 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

INFO   | jvm 1    | 2021/02/09 18:01:22 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

INFO   | jvm 1    | 2021/02/09 18:01:22 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

INFO   | jvm 1    | 2021/02/09 18:01:22 | at java.lang.reflect.Method.invoke(Method.java:498)

INFO   | jvm 1    | 2021/02/09 18:01:22 | at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)

INFO   | jvm 1    | 2021/02/09 18:01:22 | at java.lang.Thread.run(Thread.java:748)

INFO   | jvm 1    | 2021/02/09 18:01:22 | Caused by: io.mycat.config.util.ConfigException: org.xml.sax.SAXParseException; lineNumber: 11; columnNumbe

r: 68; Attribute "parentKey" is required and must be specified for element type "childTable".

INFO   | jvm 1    | 2021/02/09 18:01:22 | at io.mycat.config.loader.xml.XMLSchemaLoader.load(XMLSchemaLoader.java:121)

INFO   | jvm 1    | 2021/02/09 18:01:22 | at io.mycat.config.loader.xml.XMLSchemaLoader.<init>(XMLSchemaLoader.java:78)

INFO   | jvm 1    | 2021/02/09 18:01:22 | at io.mycat.config.loader.xml.XMLSchemaLoader.<init>(XMLSchemaLoader.java:82)

INFO   | jvm 1    | 2021/02/09 18:01:22 | at io.mycat.config.ConfigInitializer.<init>(ConfigInitializer.java:76)

INFO   | jvm 1    | 2021/02/09 18:01:22 | at io.mycat.config.MycatConfig.<init>(MycatConfig.java:72)

INFO   | jvm 1    | 2021/02/09 18:01:22 | at io.mycat.MycatServer.<init>(MycatServer.java:178)

INFO   | jvm 1    | 2021/02/09 18:01:22 | at io.mycat.MycatServer.<clinit>(MycatServer.java:121)

INFO   | jvm 1    | 2021/02/09 18:01:22 | ... 7 more

INFO   | jvm 1    | 2021/02/09 18:01:22 | Caused by: org.xml.sax.SAXParseException; lineNumber: 11; columnNumber: 68; Attribute "parentKey" is requir

ed and must be specified for element type "childTable".

这个原因就是schema.xml配置文件书写的问题,我的这个问题是parentKey拼写错误,这个文件很重要,编辑时一定要注意。

 4.mycat能正常启动,wrapper.log显示启动成功,但是mycat.log里一直报错:

2021-02-10 10:30:03.414  WARN [$_NIOREACTOR-0-RW] (io.mycat.backend.mysql.nio.MySQLConnectionAuthenticator.handle(MySQLConnectionAuthenticator.java:91)) - can't connect to mysql server ,errmsg:Client does not support authentication protocol requested by server; consider upgrading MySQL client MySQLConnection@1591334450 [id=2, lastTime=1612924203222, user=root, schema=db01, old shema=db01, borrowed=false, fromSlaveDB=false, threadId=301, charset=utf8, txIsolation=3, autocommit=true, attachment=null, respHandler=null, host=192.0.2.105, port=3306, statusSync=null, writeQueue=0, modifiedSQLExecuted=false]

而前端连接时报错:

[root@ms1 conf]# mysql -utest -ptest123 -h192.0.2.105 -P8066 -DTESTDB

mysql: [Warning] Using a password on the command line interface can be insecure.

ERROR 1045 (HY000): Access denied for user 'test', because password is error

解决措施:

  1. ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456aA#'

按这种方式处理后,再启动mycatmycat.log不再不错,但是前端命令行登录时依旧报错:说password is error

  1. 更换mysql的客户端为5.6.51版本,再登录一切正常。

总结:mycat版本更新缓慢,跟mysql8存在一些不兼容的问题。

原文地址:https://www.cnblogs.com/JennyYu/p/14394504.html