{"record":{"id":"f88ced49bee2cf35","repo":"MyCATApache/Mycat-Server","slug":"please-check-file-dnindex-properties-e","errorCode":null,"errorMessage":"please check file \"dnindex.properties\" {e}","messagePattern":"please check file \"dnindex\\.properties\" (.+?)","errorType":"exception","errorClass":"ConfigException","httpStatus":null,"severity":"error","filePath":"src/main/java/io/mycat/util/dataMigrator/ConfigComparer.java","lineNumber":259,"sourceCode":"\t\tif(!oldRC.getColumn().equalsIgnoreCase(newRC.getColumn())){\n\t\t\tthrow new ConfigException(schemaName+\":\"+tableName+\" old & new partition column is not same!\");\n\t\t}\n\t\tAbstractPartitionAlgorithm oldAlg = oldRC.getRuleAlgorithm();\n\t\tAbstractPartitionAlgorithm newAlg = newRC.getRuleAlgorithm();\n\t\t//判断路由算法前后是否一致\n\t\tif(!oldAlg.getClass().isAssignableFrom(newAlg.getClass())){\n\t\t\tthrow new ConfigException(schemaName+\":\"+tableName+\" old & new rule Algorithm is not same!\");\n\t\t}\n\t}\n\t\n\tprivate Properties loadDnIndexProps() {\n\t\tProperties prop = new Properties();\n\t\tInputStream is = null;\n\t\ttry {\n\t\t\tis = ConfigComparer.class.getResourceAsStream(DN_INDEX_FILE);\n\t\t\tprop.load(is);\n\t\t} catch (Exception e) {\n\t\t\tthrow new ConfigException(\"please check file \\\"dnindex.properties\\\" \"+e.getMessage());\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tif(is !=null){\n\t\t\t\t\tis.close();\n\t\t\t\t}\n\t\t\t} catch (IOException e) {\n\t\t\t\tthrow new ConfigException(e.getMessage());\n\t\t\t}\n\t\t}\n\t\treturn prop;\n\t}\n}\n","sourceCodeStart":241,"sourceCodeEnd":272,"githubUrl":"https://github.com/MyCATApache/Mycat-Server/blob/65f8d8beb752f935752f2a0eec0ab017facab9ef/src/main/java/io/mycat/util/dataMigrator/ConfigComparer.java#L241-L272","documentation":"loadDnIndexProps reads dnindex.properties from the classpath; this file records which data node index each node previously held, needed to map data during migration. Any failure loading it (missing resource, null stream, IO error) is wrapped in a ConfigException whose message includes the underlying exception text, telling the user to check the file.","triggerScenarios":"dnindex.properties absent from the classpath; getResourceAsStream returns null so prop.load(null) throws NullPointerException; file unreadable or malformed.","commonSituations":"Fresh deployment where dnindex.properties was never generated; file deleted between migrations; launching the migrator without the directory containing dnindex.properties on the classpath.","solutions":["Ensure dnindex.properties exists in the conf directory and that directory is on the classpath.","Read the appended underlying message (e.getMessage()) to identify the exact cause (null stream vs IO error).","If migrating from scratch without prior data node layout, generate or provide an empty/valid dnindex.properties.","Restore the file from backup if it was deleted after a previous migration."],"exampleFix":"// before\njava -cp mycat.jar ...DataMigrator   # dnindex.properties missing\n// after\njava -cp mycat.jar:conf ...DataMigrator   # conf/dnindex.properties present","handlingStrategy":"validation","validationCode":"String res = \"/dnindex.properties\";\nif (ConfigComparer.class.getResource(res) == null) {\n    throw new IllegalStateException(\"dnindex.properties missing from classpath\");\n}\ntry (InputStream in = ConfigComparer.class.getResourceAsStream(res)) {\n    new Properties().load(in); // fail fast with real cause\n}","typeGuard":null,"tryCatchPattern":"try {\n    comparer.compare();\n} catch (ConfigException e) {\n    if (e.getMessage().contains(\"dnindex.properties\")) {\n        // inspect appended cause; restore file to conf/ and ensure it is on -cp\n    }\n    throw e;\n}","preventionTips":["Back up dnindex.properties after every successful migration","Ship it alongside schema.xml/rule.xml in the conf directory","Verify classpath includes the conf directory before launching the migrator"],"tags":["java","data-migration","configuration","classpath"],"backgroundTag":"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"}