MyCATApache/Mycat-Server · error · ConfigException
new config for migrate read fail!please check newSchema.xml…
Error message
new config for migrate read fail!please check newSchema.xml or newRule.xml {e} What it means
ConfigComparer.loadNewConfig loads the post-migration target configuration from NEW_SCHEMA/newSchema.xml and NEW_RULE/newRule.xml via XMLSchemaLoader. Any exception is wrapped as ConfigException(' new config for migrate read fail!please check newSchema.xml or newRule.xml <cause>').
Solutions
- Confirm newSchema.xml and newRule.xml exist in the migration working directory with exactly those names
- Validate the new XML files parse cleanly (xmllint) and match Mycat's schema DTD
- Fix the underlying error reported in the wrapped cause (missing file vs. semantic reference error)
- Regenerate newSchema.xml/newRule.xml with the migration tooling or copy verified templates from a working cluster
Example fix
// before java ... ConfigComparer // newSchema.xml absent in workdir // after cp newSchema.xml newRule.xml /path/to/migrator/workdir && rerun
Defensive patterns
Strategy: validation
Validate before calling
static boolean newConfigPresent(String dir){
return new java.io.File(dir, "newSchema.xml").canRead()
&& new java.io.File(dir, "newRule.xml").canRead();
} Try / catch
try { comparer.loadNewConfig(); }
catch (ConfigException e) { LOG.error("newSchema.xml/newRule.xml unreadable: " + e.getMessage(), e); throw e; } Prevention
- Generate newSchema.xml/newRule.xml with the migration tooling before running
- Validate the new XML parses and all dataHost/dataNode references resolve
- Use exact file names expected by the migrator (newSchema.xml, newRule.xml)
- Smoke-test the new config in a staging Mycat instance before migration
When it happens
Trigger: Running the dataMigrator export/compare when newSchema.xml or newRule.xml is absent from the working directory, malformed, or internally inconsistent (dangling dataNode/rule references).
Common situations: User forgot to generate or copy newSchema.xml/newRule.xml before running migration; template configs edited with syntax errors; new config referencing dataHosts that do not exist in the new cluster.
Related errors
- old config for migrate read fail!please check schema.xml or…
- 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/029ce5edaf0a5507.
Report an issue: GitHub.
Appendix: source
Thrown at src/main/java/io/mycat/util/dataMigrator/ConfigComparer.java:95
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{
Properties pro = new Properties();
if(!isAwaysUseMaster){
dnIndexProps = loadDnIndexProps();
}
try{
pro.load(ConfigComparer.class.getResourceAsStream(TABLES_FILE));
}catch(Exception e){
throw new ConfigException("tablesFile.properties read fail!");
}
Iterator<Entry<Object, Object>> it = pro.entrySet().iterator();
while(it.hasNext()){
Entry<Object, Object> entry = it.next();View on GitHub (pinned to 65f8d8beb7)