{"record":{"id":"3672bde031ae82bf","repo":"testcontainers/testcontainers-java","slug":"hivemq-config-file-mountableconfig-getfilesystempath-does","errorCode":null,"errorMessage":"HiveMQ config file '${mountableConfig.getFilesystemPath()}' does not exist.","messagePattern":"HiveMQ config file '(.+?)' does not exist\\.","errorType":"exception","errorClass":"ContainerLaunchException","httpStatus":null,"severity":"error","filePath":"modules/hivemq/src/main/java/org/testcontainers/hivemq/HiveMQContainer.java","lineNumber":342,"sourceCode":"        }\n        final String containerPath = \"/opt/hivemq/license/\" + licenseFile.getName();\n        withCopyFileToContainer(cloneWithFileMode(mountableLicense), containerPath);\n        LOGGER.info(\"Putting license '{}' into '{}'.\", licenseFile.getAbsolutePath(), containerPath);\n        return self();\n    }\n\n    /**\n     * Overwrites the HiveMQ configuration in '/opt/hivemq/conf/' inside the container.\n     * <p>\n     * Must be called before the container is started.\n     *\n     * @param mountableConfig the config file on the host machine\n     * @return self\n     */\n    public @NotNull HiveMQContainer withHiveMQConfig(final @NotNull MountableFile mountableConfig) {\n        final File config = new File(mountableConfig.getResolvedPath());\n        if (!config.exists()) {\n            throw new ContainerLaunchException(\n                \"HiveMQ config file '\" + mountableConfig.getFilesystemPath() + \"' does not exist.\"\n            );\n        }\n        final String containerPath = \"/opt/hivemq/conf/config.xml\";\n        withCopyFileToContainer(cloneWithFileMode(mountableConfig), containerPath);\n        LOGGER.info(\"Putting '{}' into '{}'.\", config.getAbsolutePath(), containerPath);\n        return self();\n    }\n\n    /**\n     * Puts the given file into the root of the extension's home '/opt/hivemq/temp-extensions/{extensionId}/'.\n     * <p>\n     * Must be called before the container is started.\n     * <p>\n     * The contents of the '/opt/hivemq/temp-extensions/' directory are copied to '/opt/hivemq/extensions/' before the container is started.\n     *\n     * @param file        the file on the host machine\n     * @param extensionId the extension","sourceCodeStart":324,"sourceCodeEnd":360,"githubUrl":"https://github.com/testcontainers/testcontainers-java/blob/8e549514e3f01c57d70546fbb8599d138f3903e5/modules/hivemq/src/main/java/org/testcontainers/hivemq/HiveMQContainer.java#L324-L360","documentation":"withHiveMQConfig(MountableFile) resolves the given config file path on the host and requires it to exist before copying it into the container as /opt/hivemq/conf/config.xml. If the resolved path does not exist, a ContainerLaunchException is thrown before container start.","triggerScenarios":"Calling container.withHiveMQConfig(MountableFile.forHostPath(...)) with a path that does not exist on the host machine.","commonSituations":"Config file generated by a previous build step that did not run; path typo; relative path resolved from a different working directory; test resources not copied in CI checkout.","solutions":["Check that the config file path exists on the host before calling withHiveMQConfig.","Use an absolute path (e.g. resolved from classpath: Paths.get(getClass().getResource(...).toURI())).","Ensure the config.xml is included as a test resource and present in the CI environment.","Fix relative-path resolution issues by anchoring to the project root."],"exampleFix":"// before\ncontainer.withHiveMQConfig(MountableFile.forHostPath(\"config.xml\")); // relative, missing\n// after\nPath cfg = Paths.get(\"src/test/resources/config.xml\").toAbsolutePath();\ncontainer.withHiveMQConfig(MountableFile.forHostPath(cfg.toString()));","handlingStrategy":"validation","validationCode":"File cfg = Paths.get(configPath).toAbsolutePath().toFile();\nif (!cfg.exists()) throw new IllegalStateException(\"HiveMQ config not found: \" + cfg);","typeGuard":null,"tryCatchPattern":"try { container.withHiveMQConfig(MountableFile.forHostPath(cfg.getAbsolutePath())); } catch (ContainerLaunchException e) { log.error(\"Config missing: {}\", e.getMessage()); throw e; }","preventionTips":["Store config.xml under src/test/resources and resolve via classpath to an absolute path.","Verify the resource exists in a @BeforeAll setup step."],"tags":["hivemq","config","file-not-found","testcontainers"],"backgroundTag":"file-not-found","analyzedSha":"8e549514e3f01c57d70546fbb8599d138f3903e5","analyzedAt":"2026-09-12T14:56:41.227Z","contentChangedAt":"2026-09-12T14:56:41.227Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}