{"record":{"id":"0c8363cf84ca7e77","repo":"testcontainers/testcontainers-java","slug":"license-file-mountablelicense-getfilesystempath-does-not-end","errorCode":null,"errorMessage":"License file '${mountableLicense.getFilesystemPath()}' does not end wit '.lic' or '.elic'.","messagePattern":"License file '(.+?)' does not end wit '\\.lic' or '\\.elic'\\.","errorType":"exception","errorClass":"ContainerLaunchException","httpStatus":null,"severity":"error","filePath":"modules/hivemq/src/main/java/org/testcontainers/hivemq/HiveMQContainer.java","lineNumber":321,"sourceCode":"\n    /**\n     * Puts the given license into '/opt/hivemq/license/' inside the container.\n     * It must end with '.lic' or '.elic'.\n     * <p>\n     * Must be called before the container is started.\n     *\n     * @param mountableLicense the license file on the host machine\n     * @return self\n     */\n    public @NotNull HiveMQContainer withLicense(final @NotNull MountableFile mountableLicense) {\n        final File licenseFile = new File(mountableLicense.getResolvedPath());\n        if (!licenseFile.exists()) {\n            throw new ContainerLaunchException(\n                \"License file '\" + mountableLicense.getFilesystemPath() + \"' does not exist.\"\n            );\n        }\n        if (!licenseFile.getName().endsWith(\".lic\") && !licenseFile.getName().endsWith(\".elic\")) {\n            throw new ContainerLaunchException(\n                \"License file '\" + mountableLicense.getFilesystemPath() + \"' does not end wit '.lic' or '.elic'.\"\n            );\n        }\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) {","sourceCodeStart":303,"sourceCodeEnd":339,"githubUrl":"https://github.com/testcontainers/testcontainers-java/blob/8e549514e3f01c57d70546fbb8599d138f3903e5/modules/hivemq/src/main/java/org/testcontainers/hivemq/HiveMQContainer.java#L303-L339","documentation":"After confirming the license file exists, withLicense validates the file name ends with '.lic' or '.elic' as required by HiveMQ licensing. Any other extension is rejected with a ContainerLaunchException (note the typo 'wit' in the message, from the library source).","triggerScenarios":"Calling container.withLicense(...) with a file whose name does not end in .lic or .elic, e.g. license.txt, license.pem, or a .lic renamed/copy without extension.","commonSituations":"Developer passes a text license key file instead of the binary HiveMQ license; CI stores the license under a generic name; test fixture renamed during copy pipeline losing the extension.","solutions":["Rename the license file so it ends with .lic (or .elic for encrypted licenses).","Confirm you are mounting the actual HiveMQ license file, not a text key or certificate.","If the file is generated in a test fixture, name the output file with the correct extension."],"exampleFix":"// before\ncontainer.withLicense(MountableFile.forHostPath(\"/licenses/hivemq.txt\"));\n// after\ncontainer.withLicense(MountableFile.forHostPath(\"/licenses/hivemq.lic\"));","handlingStrategy":"validation","validationCode":"String name = new File(licensePath).getName();\nif (!name.endsWith(\".lic\") && !name.endsWith(\".elic\")) throw new IllegalStateException(\"License must be .lic/.elic: \" + name);","typeGuard":null,"tryCatchPattern":"try { container.withLicense(lic); } catch (ContainerLaunchException e) { log.error(\"Invalid license file: {}\", e.getMessage()); throw e; }","preventionTips":["Keep HiveMQ license files with their original .lic/.elic extensions.","Never rename licenses to .txt when storing them in repos or CI caches."],"tags":["hivemq","license","file-extension","validation"],"backgroundTag":"invalid-argument-value","analyzedSha":"8e549514e3f01c57d70546fbb8599d138f3903e5","analyzedAt":"2026-09-12T14:56:41.227Z","contentChangedAt":"2026-09-12T14:56:41.227Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}