{"record":{"id":"294fa0c814861521","repo":"MyCATApache/Mycat-Server","slug":"selfcheck-user-all-node-is-empty","errorCode":null,"errorMessage":"SelfCheck### user all node is empty!","messagePattern":"SelfCheck### user all node is empty!","errorType":"exception","errorClass":"io.mycat.config.ConfigException","httpStatus":null,"severity":"critical","filePath":"src/main/java/io/mycat/config/ConfigInitializer.java","lineNumber":125,"sourceCode":"\t\tif (system.getSequenceHandlerType() == SystemConfig.SEQUENCEHANDLER_ZK_DISTRIBUTED) {\n\t\t\tDistributedSequenceHandler.getInstance(system).load();\n\t\t}\n\t\t\n\t\tif (system.getSequenceHandlerType() == SystemConfig.SEQUENCEHANDLER_ZK_GLOBAL_INCREMENT) {\n\t\t\tIncrSequenceZKHandler.getInstance().load();\n\t\t}\n\t\t\n\t\t/**\n\t\t * 配置文件初始化， 自检\n\t\t */\n\t\tthis.selfChecking0();\n\t}\n\t\n\tprivate void selfChecking0() throws ConfigException {\n\t\t\n\t\t// 检查user与schema配置对应以及schema配置不为空\n\t\tif (users == null || users.isEmpty()) {\n\t\t\tthrow new ConfigException(\"SelfCheck### user all node is empty!\");\n\t\t\t\n\t\t} else {\n\t\t\t\n\t\t\tfor (UserConfig uc : users.values()) {\n\t\t\t\tif (uc == null) {\n\t\t\t\t\tthrow new ConfigException(\"SelfCheck### users node within the item is empty!\");\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tSet<String> authSchemas = uc.getSchemas();\n\t\t\t\tif (authSchemas == null) {\n\t\t\t\t\tthrow new ConfigException(\"SelfCheck### user \" + uc.getName() + \"refered schemas is empty!\");\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tfor (String schema : authSchemas) {\n\t\t\t\t\tif ( !schemas.containsKey(schema) ) {\n\t\t\t\t\t\tString errMsg = \"SelfCheck###  schema \" + schema + \" refered by user \" + uc.getName() + \" is not exist!\";\n\t\t\t\t\t\tthrow new ConfigException(errMsg);\n\t\t\t\t\t}","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/MyCATApache/Mycat-Server/blob/65f8d8beb752f935752f2a0eec0ab017facab9ef/src/main/java/io/mycat/config/ConfigInitializer.java#L107-L143","documentation":"During configuration initialization, selfChecking0 validates that at least one user is configured. If the users map from the Mycat config (server.xml user sections) is null or empty, it throws ConfigException 'SelfCheck### user all node is empty!'. Mycat refuses to start without any user definitions because clients could never authenticate.","triggerScenarios":"Starting Mycat when server.xml contains no <user> blocks, or the users collection parsed from config is empty/null — e.g. all user definitions commented out or a malformed config that failed to yield any users.","commonSituations":"Fresh install with a stripped server.xml; all <user> sections commented out during maintenance; XML typo (<users> instead of <user> or wrong namespace) so no users parse; failed config reload leaving users empty.","solutions":["Add at least one valid <user name=\"...\"><property name=\"password\">...</property>...</user> block to server.xml","Check the XML is well-formed and that <user> elements are direct children of the <mycat:server> root with correct namespace","Uncomment the user section you disabled and restart Mycat","Validate server.xml against the Mycat schema / compare with the default template shipped in conf"],"exampleFix":"<!-- before: no users in server.xml -->\n<mycat:server>\n  <system>...</system>\n</mycat:server>\n// after\n<mycat:server>\n  <user name=\"root\">\n    <property name=\"password\">123456</property>\n    <property name=\"schemas\">TESTDB</property>\n  </user>\n</mycat:server>","handlingStrategy":"validation","validationCode":"// before starting Mycat, check server.xml defines at least one user\n// (shell)\ngrep -c '<user name=' conf/server.xml || echo 'FATAL: no users configured'","typeGuard":null,"tryCatchPattern":"try {\n    new ConfigInitializer(isLoadMysql);\n} catch (ConfigException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"user all node is empty\")) {\n        LOG.error(\"server.xml has no <user> blocks; refusing to start\");\n    }\n    throw e;\n}","preventionTips":["Never ship or check in a server.xml without at least one <user> block","Validate server.xml against the Mycat XSD in CI before deployment","Keep the default root user block present (with changed password) even in stripped configs","After config edits, restart in a staging env to catch self-check failures early"],"tags":["config","startup","user","mycat"],"backgroundTag":"missing-required-config-field","analyzedSha":"65f8d8beb752f935752f2a0eec0ab017facab9ef","analyzedAt":"2026-09-11T00:12:21.696Z","contentChangedAt":"2026-09-11T00:12:21.696Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}