MyCATApache/Mycat-Server · critical · io.mycat.config.ConfigException

SelfCheck### users node within the item is empty!

Error message

SelfCheck### users node within the item is empty!

What it means

selfChecking0 iterates the configured users and throws ConfigException if any individual UserConfig entry is null. This means the users map contains a key whose value failed to be built during config parsing (malformed user XML block), leaving an empty item. It guards against half-parsed user definitions causing NPEs later during authentication.

Solutions

  1. Inspect server.xml user blocks for malformed XML or missing required properties (password, schemas) and fix them
  2. Remove the broken <user> entry entirely if it is not needed, leaving only valid users
  3. Compare your user config with the default template for your Mycat version and correct property names
  4. Check earlier startup logs for a warning/exception during user config parsing that explains the null entry

Example fix

<!-- before: malformed user -->
<user name="root">
  <property name="pass">123456</property>
</user>
// after
<user name="root">
  <property name="password">123456</property>
  <property name="schemas">TESTDB</property>
</user>
Defensive patterns

Strategy: validation

Validate before calling

// validate each user block has required properties before startup (shell)
// every <user> must contain password and schemas properties
grep -A3 '<user ' conf/server.xml | grep -E 'password|schemas' || echo 'malformed user block'

Try / catch

try {
    new ConfigInitializer(isLoadMysql);
} catch (ConfigException e) {
    if (e.getMessage() != null && e.getMessage().contains("users node within the item is empty")) {
        LOG.error("A <user> block in server.xml is malformed and produced a null user config");
    }
    throw e;
}

Prevention

When it happens

Trigger: A <user> block in server.xml is present but so malformed that UserConfig construction fails or yields null while the key is still registered — e.g. missing required password/schema properties causing a parse path that stores a null entry.

Common situations: Hand-edited server.xml with an unclosed tag or missing <property> children; wrong property names so the user object cannot be constructed; version upgrades where user config format changed and old files parse to null entries.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of MyCATApache/Mycat-Server@65f8d8beb7 (2026-09-11). Data as JSON: /api/errors/9cdaf96d540985f9. Report an issue: GitHub.

Appendix: source

Thrown at src/main/java/io/mycat/config/ConfigInitializer.java:131

		}
		
		/**
		 * 配置文件初始化, 自检
		 */
		this.selfChecking0();
	}
	
	private void selfChecking0() throws ConfigException {
		
		// 检查user与schema配置对应以及schema配置不为空
		if (users == null || users.isEmpty()) {
			throw new ConfigException("SelfCheck### user all node is empty!");
			
		} else {
			
			for (UserConfig uc : users.values()) {
				if (uc == null) {
					throw new ConfigException("SelfCheck### users node within the item is empty!");
				}
				
				Set<String> authSchemas = uc.getSchemas();
				if (authSchemas == null) {
					throw new ConfigException("SelfCheck### user " + uc.getName() + "refered schemas is empty!");
				}
				
				for (String schema : authSchemas) {
					if ( !schemas.containsKey(schema) ) {
						String errMsg = "SelfCheck###  schema " + schema + " refered by user " + uc.getName() + " is not exist!";
						throw new ConfigException(errMsg);
					}
				}
			}
		}	
		
		
		// schema 配置检测		

View on GitHub (pinned to 65f8d8beb7)