MyCATApache/Mycat-Server · error · io.mycat.config.ConfigException
SelfCheck### schema dbnode is empty!
Error message
SelfCheck### schema dbnode is empty!
What it means
Thrown by ConfigInitializer.selfChecking0 when a schema references a dataNode name that does not exist in the loaded dataNodes map (dataNode/dbnode definitions from schema.xml). MyCat validates every dataNode referenced by each schema resolves to a defined PhysicalDBNode; an unresolvable reference means the schema's data cannot be routed, so startup fails with ConfigException.
Solutions
- Read the schema name from the failed startup context and list its dataNode references in schema.xml.
- Ensure each referenced name has a matching <dataNode name="..." dataHost="..." database="..."> definition.
- Fix typos/case mismatches between schema references and dataNode definitions.
- Verify the referenced dataHost also exists in the dataHosts definitions.
Example fix
// before (schema.xml) <schema name="testdb" dataNode="dn2" /> // after (matching dataNode exists) <dataNode name="dn2" dataHost="host1" database="db2" /> <schema name="testdb" dataNode="dn2" />
Defensive patterns
Strategy: validation
Validate before calling
// Verify every schema dataNode reference resolves before init
for (SchemaConfig sc : schemas.values()) {
for (String dn : sc.getAllDataNodes()) {
if (!dataNodes.containsKey(dn)) {
throw new IllegalArgumentException("schema " + sc.getName() + " references missing dataNode " + dn);
}
}
} Try / catch
try {
new ConfigInitializer(...);
} catch (ConfigException e) {
if (e.getMessage().contains("schema dbnode is empty")) {
LOGGER.error("Schema references undefined dataNode: {}", e.getMessage());
// roll back schema.xml change
} else { throw e; }
} Prevention
- Keep schema dataNode attributes and <dataNode> definitions in sync; review both files in one change.
- Use consistent lowercase naming for dataNodes to avoid case-mismatch bugs.
- Run an XML-lint/reference checker on schema.xml in CI.
- When deleting a dataNode, first grep schema.xml for remaining references.
When it happens
Trigger: ConfigInitializer constructor where sc.getAllDataNodes() returns a name absent from this.dataNodes — i.e. a <schema> or its tables reference a dataNode not defined in schema.xml, or the name is misspelled/case-mismatched (only checked when dataNodes and dataHosts are both non-null).
Common situations: dataNode attribute in <schema name="..." dataNode="dn1"> with no <dataNode name="dn1"> definition; typos in table-level dataNode attributes; removing a dataNode definition while schemas still reference it; case mismatch (DN1 vs dn1).
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- SelfCheck### user all node is empty!
- SelfCheck### users node within the item is empty!
- SelfCheck### user refered schemas is empty!
- SelfCheck### schema
- SelfCheck### schema all node is empty!
AI-assisted analysis of MyCATApache/Mycat-Server@65f8d8beb7 (2026-09-11).
Data as JSON: /api/errors/e3f69e1175d1f674.
Report an issue: GitHub.
Appendix: source
Thrown at src/main/java/io/mycat/config/ConfigInitializer.java:162
}
}
}
// schema 配置检测
for (SchemaConfig sc : schemas.values()) {
if (null == sc) {
throw new ConfigException("SelfCheck### schema all node is empty!");
} else {
// check dataNode / dataHost 节点
if ( this.dataNodes != null && this.dataHosts != null ) {
Set<String> dataNodeNames = sc.getAllDataNodes();
for(String dataNodeName: dataNodeNames) {
PhysicalDBNode node = this.dataNodes.get(dataNodeName);
if ( node == null ) {
throw new ConfigException("SelfCheck### schema dbnode is empty!");
}
}
}
}
}
}
public void testConnection() {
// 实际链路的连接测试
if ( this.dataNodes != null && this.dataHosts != null ) {
Map<String, Boolean> map = new HashMap<String, Boolean>();
for(PhysicalDBNode dataNode: dataNodes.values() ) {
String database = dataNode.getDatabase(); View on GitHub (pinned to 65f8d8beb7)