testcontainers/testcontainers-java · error · ContainerLaunchException
License file ' ' does not end wit '.lic' or '.elic'.
Error message
License file '${mountableLicense.getFilesystemPath()}' does not end wit '.lic' or '.elic'. What it means
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).
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.
Example fix
// before
container.withLicense(MountableFile.forHostPath("/licenses/hivemq.txt"));
// after
container.withLicense(MountableFile.forHostPath("/licenses/hivemq.lic")); Defensive patterns
Strategy: validation
Validate before calling
String name = new File(licensePath).getName();
if (!name.endsWith(".lic") && !name.endsWith(".elic")) throw new IllegalStateException("License must be .lic/.elic: " + name); Try / catch
try { container.withLicense(lic); } catch (ContainerLaunchException e) { log.error("Invalid license file: {}", e.getMessage()); throw e; } Prevention
- Keep HiveMQ license files with their original .lic/.elic extensions.
- Never rename licenses to .txt when storing them in repos or CI caches.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- extension id must not be null or empty
- License file ' ' does not exist.
- pathInHomeFolder must not be empty
- anyOthers parameter must be non-empty
- Bucket quota cannot be less than 100MB!
AI-assisted analysis of testcontainers/testcontainers-java@8e549514e3 (2026-09-12).
Data as JSON: /api/errors/0c8363cf84ca7e77.
Report an issue: GitHub.
Appendix: source
Thrown at modules/hivemq/src/main/java/org/testcontainers/hivemq/HiveMQContainer.java:321
/**
* Puts the given license into '/opt/hivemq/license/' inside the container.
* It must end with '.lic' or '.elic'.
* <p>
* Must be called before the container is started.
*
* @param mountableLicense the license file on the host machine
* @return self
*/
public @NotNull HiveMQContainer withLicense(final @NotNull MountableFile mountableLicense) {
final File licenseFile = new File(mountableLicense.getResolvedPath());
if (!licenseFile.exists()) {
throw new ContainerLaunchException(
"License file '" + mountableLicense.getFilesystemPath() + "' does not exist."
);
}
if (!licenseFile.getName().endsWith(".lic") && !licenseFile.getName().endsWith(".elic")) {
throw new ContainerLaunchException(
"License file '" + mountableLicense.getFilesystemPath() + "' does not end wit '.lic' or '.elic'."
);
}
final String containerPath = "/opt/hivemq/license/" + licenseFile.getName();
withCopyFileToContainer(cloneWithFileMode(mountableLicense), containerPath);
LOGGER.info("Putting license '{}' into '{}'.", licenseFile.getAbsolutePath(), containerPath);
return self();
}
/**
* Overwrites the HiveMQ configuration in '/opt/hivemq/conf/' inside the container.
* <p>
* Must be called before the container is started.
*
* @param mountableConfig the config file on the host machine
* @return self
*/
public @NotNull HiveMQContainer withHiveMQConfig(final @NotNull MountableFile mountableConfig) {View on GitHub (pinned to 8e549514e3)