一、前言
关于通过mycat配置mysql分库分表配置(详细配置教程参考其他文章页面)时启动,打开logs/wrapper.log日志报"WrapperSimpleApp: Encountered an error running main: java.lang.ExceptionInInitializerError...Caused by: io.mycat.config.util.ConfigException: SelfCheck### schema TESTDB refered by user user is not exist!"错误异常,详情日志如下>>
STATUS | wrapper | 2019/05/12 17:23:16 | --> Wrapper Started as Daemon@b@STATUS | wrapper | 2019/05/12 17:23:16 | Launching a JVM...@b@INFO | jvm 1 | 2019/05/12 17:23:17 | Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=64M; support was removed in 8.0@b@INFO | jvm 1 | 2019/05/12 17:23:18 | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org@b@INFO | jvm 1 | 2019/05/12 17:23:18 | Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.@b@INFO | jvm 1 | 2019/05/12 17:23:18 | @b@INFO | jvm 1 | 2019/05/12 17:23:19 | @b@INFO | jvm 1 | 2019/05/12 17:23:19 | WrapperSimpleApp: Encountered an error running main: java.lang.ExceptionInInitializerError@b@INFO | jvm 1 | 2019/05/12 17:23:19 | java.lang.ExceptionInInitializerError@b@INFO | jvm 1 | 2019/05/12 17:23:19 | at io.mycat.MycatStartup.main(MycatStartup.java:53)@b@INFO | jvm 1 | 2019/05/12 17:23:19 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)@b@INFO | jvm 1 | 2019/05/12 17:23:19 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)@b@INFO | jvm 1 | 2019/05/12 17:23:19 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)@b@INFO | jvm 1 | 2019/05/12 17:23:19 | at java.lang.reflect.Method.invoke(Method.java:498)@b@INFO | jvm 1 | 2019/05/12 17:23:19 | at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)@b@INFO | jvm 1 | 2019/05/12 17:23:19 | at java.lang.Thread.run(Thread.java:748)@b@INFO | jvm 1 | 2019/05/12 17:23:19 | Caused by: io.mycat.config.util.ConfigException: SelfCheck### schema TESTDB refered by user user is not exist!@b@INFO | jvm 1 | 2019/05/12 17:23:19 | at io.mycat.config.ConfigInitializer.selfChecking0(ConfigInitializer.java:142)@b@INFO | jvm 1 | 2019/05/12 17:23:19 | at io.mycat.config.ConfigInitializer.<init>(ConfigInitializer.java:118)@b@INFO | jvm 1 | 2019/05/12 17:23:19 | at io.mycat.config.MycatConfig.<init>(MycatConfig.java:72)@b@INFO | jvm 1 | 2019/05/12 17:23:19 | at io.mycat.MycatServer.<init>(MycatServer.java:158)@b@INFO | jvm 1 | 2019/05/12 17:23:19 | at io.mycat.MycatServer.<clinit>(MycatServer.java:101)@b@INFO | jvm 1 | 2019/05/12 17:23:19 | ... 7 more@b@STATUS | wrapper | 2019/05/12 17:23:21 | <-- Wrapper Stopped
二、解决方法
因mycat的conf目录下schema.xml中schema name="TESTDB"对于server.xml数据库用户user不存在,可以注释掉name="user" 实际不存在该用户(详细完整配置过程请参见其他文章页面)
server.xml
<?xml version="1.0" encoding="UTF-8"?>@b@<!-- - - Licensed under the Apache License, Version 2.0 (the "License"); @b@ - you may not use this file except in compliance with the License. - You @b@ may obtain a copy of the License at - - @b@<!DOCTYPE mycat:server SYSTEM "server.dtd">@b@<mycat:server xmlns:mycat="http://io.mycat/">@b@ @b@ ... @b@ @b@<!--@b@ <user name="user">@b@ <property name="password">user</property>@b@ <property name="schemas">mytest1</property>@b@ <property name="readOnly">true</property>@b@ </user>@b@ @b@-->@b@ @b@</mycat:server>