起因:配置了mycat的分片,然后发现生成了ruledate文件,且里面分片规则也换成了3片,但是启动mycat,启动成功了,但是一启动2秒后自动关闭了。导致在navicat中测试的数据库链接不上
navicat报错:2003-Can’t connect to MySQL server on ‘192.168.41.14’(10061 “Unknown error”)
然后去mycat的日志中查看报错信息:如下:
STATUS | wrapper | 2019/10/14 04:59:59 | --> Wrapper Started as Daemon
STATUS | wrapper | 2019/10/14 04:59:59 | Launching a JVM…
INFO | jvm 1 | 2019/10/14 04:59:59 | Java HotSpot™ 64-Bit Server VM warning: ignoring option MaxPermSize=64M; support was removed in 8.0
INFO | jvm 1 | 2019/10/14 05:00:00 | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
INFO | jvm 1 | 2019/10/14 05:00:00 | Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.
INFO | jvm 1 | 2019/10/14 05:00:00 |
INFO | jvm 1 | 2019/10/14 05:00:00 |
INFO | jvm 1 | 2019/10/14 05:00:00 | WrapperSimpleApp: Encountered an error running main: java.lang.ExceptionInInitializerError
INFO | jvm 1 | 2019/10/14 05:00:00 | java.lang.ExceptionInInitializerError
INFO | jvm 1 | 2019/10/14 05:00:00 | at io.mycat.MycatStartup.main(MycatStartup.java:53)
INFO | jvm 1 | 2019/10/14 05:00:00 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO | jvm 1 | 2019/10/14 05:00:00 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
INFO | jvm 1 | 2019/10/14 05:00:00 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
INFO | jvm 1 | 2019/10/14 05:00:00 | at java.lang.reflect.Method.invoke(Method.java:483)
INFO | jvm 1 | 2019/10/14 05:00:00 | at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)
INFO | jvm 1 | 2019/10/14 05:00:00 | at java.lang.Thread.run(Thread.java:745)
INFO | jvm 1 | 2019/10/14 05:00:00 | Caused by: io.mycat.config.util.ConfigException: java.lang.NullPointerException
INFO | jvm 1 | 2019/10/14 05:00:00 | at io.mycat.config.loader.xml.XMLSchemaLoader.load(XMLSchemaLoader.java:126)
INFO | jvm 1 | 2019/10/14 05:00:00 | at io.mycat.config.loader.xml.XMLSchemaLoader.(XMLSchemaLoader.java:83)
INFO | jvm 1 | 2019/10/14 05:00:00 | at io.mycat.config.loader.xml.XMLSchemaLoader.(XMLSchemaLoader.java:87)
INFO | jvm 1 | 2019/10/14 05:00:00 | at io.mycat.config.ConfigInitializer.(ConfigInitializer.java:74)
INFO | jvm 1 | 2019/10/14 05:00:00 | at io.mycat.config.MycatConfig.(MycatConfig.java:72)
INFO | jvm 1 | 2019/10/14 05:00:00 | at io.mycat.MycatServer.(MycatServer.java:144)
INFO | jvm 1 | 2019/10/14 05:00:00 | at io.mycat.MycatServer.(MycatServer.java:96)
INFO | jvm 1 | 2019/10/14 05:00:00 | … 7 more
INFO | jvm 1 | 2019/10/14 05:00:00 | Caused by: java.lang.NullPointerException
INFO | jvm 1 | 2019/10/14 05:00:00 | at io.mycat.config.loader.xml.XMLSchemaLoader.getDbType(XMLSchemaLoader.java:458)
INFO | jvm 1 | 2019/10/14 05:00:00 | at io.mycat.config.loader.xml.XMLSchemaLoader.loadTables(XMLSchemaLoader.java:387)
INFO | jvm 1 | 2019/10/14 05:00:00 | at io.mycat.config.loader.xml.XMLSchemaLoader.loadSchemas(XMLSchemaLoader.java:173)
INFO | jvm 1 | 2019/10/14 05:00:00 | at io.mycat.config.loader.xml.XMLSchemaLoader.load(XMLSchemaLoader.java:122)
INFO | jvm 1 | 2019/10/14 05:00:00 | … 13 more
STATUS | wrapper | 2019/10/14 05:00:03 | <-- Wrapper Stopped
以上重点关注就在schema.xml文件,然后就去看了一下配置:
发现了此处,用了中文的逗号
果然,修改完后运行正常了
navicat也可以连接了,开心