{"record":{"id":"8d7a0073030fd57c","repo":"alibaba/DataX","slug":"file-not-found-name-8d7a00","errorCode":null,"errorMessage":"File not found: ${name}","messagePattern":"File not found: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"gdbwriter/src/main/java/com/alibaba/datax/plugin/writer/gdbwriter/util/ConfigHelper.java","lineNumber":60,"sourceCode":"     * @return the target configuration object of type T\n     */\n    static <T> T getConfig(final Configuration conf, final String key, final Class<T> cls) {\n        final JSONObject j = (JSONObject)conf.get(key);\n        return JSON.toJavaObject(j, cls);\n    }\n\n    /**\n     * Create a configuration from the specified file on the classpath.\n     * \n     * @param name\n     *            file name\n     * @return Configuration instance.\n     */\n    static Configuration fromClasspath(final String name) {\n        try (final InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(name)) {\n            return Configuration.from(is);\n        } catch (final IOException e) {\n            throw new IllegalArgumentException(\"File not found: \" + name);\n        }\n    }\n}\n","sourceCodeStart":42,"sourceCodeEnd":64,"githubUrl":"https://github.com/alibaba/DataX/blob/80ec23d5c5328eb90ca364d2749e92dfaf44541e/gdbwriter/src/main/java/com/alibaba/datax/plugin/writer/gdbwriter/util/ConfigHelper.java#L42-L64","documentation":"IllegalArgumentException thrown by ConfigHelper.fromClasspath when Configuration.from(is) raises IOException while loading a resource from the thread-context classloader. In practice this fires both when the resource name is not found (getResourceAsStream returns null, causing a NullPointerException/IOException downstream) and when the stream cannot be read.","triggerScenarios":"Calling fromClasspath(name) where 'name' is not present on the plugin classpath — e.g. a mapper/template file expected inside the gdbwriter plugin jar or plugin directory that is missing, misnamed, or not copied during packaging.","commonSituations":"Custom plugin build that forgot to include a resources file; deploying only the compiled jar without the resources directory; typo in the resource file name; running tests where the thread-context classloader differs from the plugin classloader.","solutions":["Verify the exact resource name (case-sensitive, no leading slash mismatch) matches what is packaged.","Ensure the file is included in the plugin distribution: check the jar contents (jar tf) or the plugin resources directory next to the jar.","If running inside a container/test, confirm the thread-context classloader can see the resource; try the plugin's own classloader as a fallback."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (Thread.currentThread().getContextClassLoader().getResource(name) == null) {\n    throw new FileNotFoundException(\"resource not on classpath: \" + name);\n}","typeGuard":null,"tryCatchPattern":"try {\n    cfg = ConfigHelper.fromClasspath(name);\n} catch (IllegalArgumentException e) {\n    // surface which jar/dir was searched; fail fast with packaging hint\n}","preventionTips":["Add a packaging test asserting required resources exist in the built jar (jar tf check in CI).","Keep resource names in one constant class to avoid typos.","Test plugins by loading them through the same classloader DataX uses in production."],"tags":["datax","classpath","resource-loading","packaging"],"backgroundTag":null,"analyzedSha":"80ec23d5c5328eb90ca364d2749e92dfaf44541e","analyzedAt":"2026-08-14T15:33:51.187Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}