{"record":{"id":"1c26343062178362","repo":"MyCATApache/Mycat-Server","slug":"tablesfile-properties-read-fail","errorCode":null,"errorMessage":"tablesFile.properties read fail!","messagePattern":"tablesFile\\.properties read fail!","errorType":"exception","errorClass":"ConfigException","httpStatus":null,"severity":"error","filePath":"src/main/java/io/mycat/util/dataMigrator/ConfigComparer.java","lineNumber":109,"sourceCode":"\t\t\tnewDataHosts = newLoader.getDataHosts();\n\t\t\tnewDataNodes = newLoader.getDataNodes();\n\t\t\tnewSchemas = newLoader.getSchemas();\n\t\t}catch(Exception e){\n\t\t\tthrow new ConfigException(\" new config for migrate read fail!please check newSchema.xml or  newRule.xml  \"+e);\n\t\t}\n\t\t\n\t}\n\t\n\t\n\tprivate void loadTablesFile() throws Exception{\n\t\tProperties pro = new Properties();\n\t\tif(!isAwaysUseMaster){\n\t\t\tdnIndexProps = loadDnIndexProps();\n\t\t}\n\t\ttry{\n\t\t\tpro.load(ConfigComparer.class.getResourceAsStream(TABLES_FILE));\n\t\t}catch(Exception e){\n\t\t\tthrow new ConfigException(\"tablesFile.properties read fail!\");\n\t\t}\n\t\tIterator<Entry<Object, Object>> it = pro.entrySet().iterator();\n\t\twhile(it.hasNext()){\n\t\t\tEntry<Object, Object> entry  = it.next();\n\t\t\tString schemaName = entry.getKey().toString();\n\t\t\tString tables = entry.getValue().toString();\n\t\t\tloadMigratorTables(schemaName,getTables(tables));\n\t\t}\n\t}\n\t\n\tprivate String[] getTables(String tables){\n\t\tif(tables.equalsIgnoreCase(\"all\") || tables.isEmpty()){\n\t\t\treturn new String[]{};\n\t\t}else{\n\t\t\treturn tables.split(\",\");\n\t\t}\n\t}\n\t","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/MyCATApache/Mycat-Server/blob/65f8d8beb752f935752f2a0eec0ab017facab9ef/src/main/java/io/mycat/util/dataMigrator/ConfigComparer.java#L91-L127","documentation":"ConfigComparer loads tablesFile.properties from the classpath during data migration setup. If the resource stream is null or Properties.load() throws for any reason, it wraps the failure in a ConfigException with this generic message. It signals the migration tool cannot read its table list configuration.","triggerScenarios":"Calling the MyCat data migration tool (DataMigrator) when tablesFile.properties is missing from the classpath, is not readable, has malformed content (e.g. stray backslashes or invalid escapes causing IllegalArgumentException), or the classloader returns null for getResourceAsStream(TABLES_FILE).","commonSituations":"Running the migration utility from a jar/classpath that omits the properties file; file renamed or moved after edits; properties file contains a malformed unicode escape (e.g. \\uxxxx) that makes Properties.load throw.","solutions":["Verify tablesFile.properties exists on the classpath at the expected resource path (same package/location as TABLES_FILE constant).","If it was null due to a missing resource, restore the file or pass the correct classpath (-cp) when launching the migrator.","Validate the properties file syntax: no invalid \\u escapes, proper key=value lines.","Run with the working directory/classpath matching where the file lives, or place it in src/main/resources so it is packaged."],"exampleFix":"// before (file missing on classpath)\njava -cp mycat.jar io.mycat.util.dataMigrator.DataMigrator ...\n// after\njava -cp mycat.jar:conf io.mycat.util.dataMigrator.DataMigrator ...  # conf/ contains tablesFile.properties","handlingStrategy":"validation","validationCode":"String res = \"/tablesFile.properties\";\nif (ConfigComparer.class.getResource(res) == null) {\n    throw new IllegalStateException(\"tablesFile.properties not found on classpath: \" + res);\n}\nProperties pro = new Properties();\ntry (InputStream in = ConfigComparer.class.getResourceAsStream(res)) {\n    pro.load(in); // surfaces exact parse errors\n}","typeGuard":"boolean tablesFileReadable() {\n    try (InputStream in = ConfigComparer.class.getResourceAsStream(\"/tablesFile.properties\")) {\n        return in != null;\n    } catch (IOException e) { return false; }\n}","tryCatchPattern":"try {\n    loadMigrationConfig();\n} catch (ConfigException e) {\n    if (e.getMessage().contains(\"tablesFile.properties read fail\")) {\n        // verify classpath contains conf/, restore file, then retry\n    }\n    throw e;\n}","preventionTips":["Keep tablesFile.properties in src/main/resources so it is packaged with the jar","Always launch the migrator with the conf directory on the classpath","Lint the properties file for invalid \\u escapes before running migration","Version-control the migrator config files to avoid accidental deletion"],"tags":["java","configuration","data-migration","classpath"],"backgroundTag":"config-file-not-found","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"}