MyCATApache/Mycat-Server · error · ConfigException
old config for migrate read fail!please check schema.xml or…
Error message
old config for migrate read fail!please check schema.xml or rule.xml {e} What it means
ConfigComparer.loadOldConfig loads the pre-migration sharding configuration using XMLSchemaLoader over the default schema.xml/rule.xml. Any parsing or validation failure in those XML files is wrapped as ConfigException(' old config for migrate read fail!please check schema.xml or rule.xml <cause>').
Solutions
- Open the wrapped cause in the message — it names the actual XML parse or validation failure
- Validate schema.xml and rule.xml are present in the expected location and well-formed XML (xmllint)
- Ensure every <table> rule reference exists in rule.xml and all dataNode/dataHost names resolve
- Run the migration with a config known to work: start Mycat normally first to confirm the old config loads
Example fix
// before <!-- rule.xml missing rule="mod-rule" referenced by schema.xml --> // after add <tableRule name="mod-rule"> ... </tableRule> to rule.xml
Defensive patterns
Strategy: validation
Validate before calling
static boolean oldConfigReadable(String schemaXml, String ruleXml){
try {
javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new java.io.File(schemaXml));
javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new java.io.File(ruleXml));
return true;
} catch (Exception e) { return false; }
} Try / catch
try { comparer.loadOldConfig(); }
catch (ConfigException e) { LOG.error("old schema.xml/rule.xml unreadable: " + e.getMessage(), e); throw e; } Prevention
- Lint schema.xml and rule.xml (xmllint) before running migration
- Verify every referenced rule/dataNode/dataHost exists in the pair of files
- Keep old configs in version control so migrations use known-good copies
- Boot Mycat with the same config first to prove it loads
When it happens
Trigger: Running the dataMigrator flow (MigrateRunner/ConfigComparer) when schema.xml or rule.xml is missing, malformed XML, references nonexistent dataHost/dataNode, or violates Mycat's schema rules.
Common situations: Old cluster configs copied incompletely to the migration working directory; hand-edited XML with unbalanced tags; DTD/xsd references broken; table/rule names mismatched between schema.xml and rule.xml.
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- new config for migrate read fail!please check newSchema.xml…
- CachePoolFactory not defined for type
- can't find cache pool
- table rule duplicated!
- only one rule can defined
AI-assisted analysis of MyCATApache/Mycat-Server@65f8d8beb7 (2026-09-11).
Data as JSON: /api/errors/35a175a0f1e4e513.
Report an issue: GitHub.
Appendix: source
Thrown at src/main/java/io/mycat/util/dataMigrator/ConfigComparer.java:83
public ConfigComparer(boolean isAwaysUseMaster) throws Exception{
this.isAwaysUseMaster = isAwaysUseMaster;
loadOldConfig();
loadNewConfig();
loadTablesFile();
}
public List<TableMigrateInfo> getMigratorTables(){
return migratorTables;
}
private void loadOldConfig(){
try{
oldLoader = new XMLSchemaLoader();
oldDataHosts = oldLoader.getDataHosts();
oldDataNodes = oldLoader.getDataNodes();
oldSchemas = oldLoader.getSchemas();
}catch(Exception e){
throw new ConfigException(" old config for migrate read fail!please check schema.xml or rule.xml "+e);
}
}
private void loadNewConfig(){
try{
newLoader = new XMLSchemaLoader(NEW_SCHEMA, NEW_RULE);
newDataHosts = newLoader.getDataHosts();
newDataNodes = newLoader.getDataNodes();
newSchemas = newLoader.getSchemas();
}catch(Exception e){
throw new ConfigException(" new config for migrate read fail!please check newSchema.xml or newRule.xml "+e);
}
}
private void loadTablesFile() throws Exception{View on GitHub (pinned to 65f8d8beb7)