Loading

MUnit tests fail in Azure DevOps with "CgroupInfo.getMountPoint() because anyController is null" and "Could not initialize class com.ibm.mq.jms.MQConnectionFactory"

Data pubblicazione: Oct 20, 2026
Descrizione

A Mule application builds and runs its MUnit tests successfully on a local machine (Anypoint Studio or Maven from a terminal), but the same code fails when the build runs in a Linux-based CI/CD pipeline (for example, a Microsoft-hosted Azure DevOps agent). The failure can also appear in a pipeline that previously passed, without any change to the project.

The Maven build ends in:

[ERROR] Failed to execute goal com.mulesoft.munit.tools:munit-maven-plugin:<version>:test (test)
        on project <app>: Build Failed: MUnit Tests Failed
[INFO] BUILD FAILURE

Only the test suites that start an IBM MQ connector configuration fail (one error per suite); suites that do not touch IBM MQ pass. In the build log, the first failure is:

Caused by: org.mule.runtime.api.exception.MuleFatalException: java.lang.ExceptionInInitializerError
...
Caused by: java.lang.ExceptionInInitializerError
...
Caused by: java.lang.NullPointerException: Cannot invoke "jdk.internal.platform.CgroupInfo.getMountPoint()" because "anyController" is null
    at java.base/jdk.internal.platform.cgroupv2.CgroupV2Subsystem.getInstance(CgroupV2Subsystem.java:81)
    at java.base/jdk.internal.platform.CgroupSubsystemFactory.create(CgroupSubsystemFactory.java:113)
    at java.base/jdk.internal.platform.CgroupMetrics.getInstance(CgroupMetrics.java:167)
    at java.base/jdk.internal.platform.SystemMetrics.instance(SystemMetrics.java:29)
    at java.base/jdk.internal.platform.Metrics.systemMetrics(Metrics.java:58)
    at java.base/jdk.internal.platform.Container.metrics(Container.java:43)
    at jdk.management/com.sun.management.internal.OperatingSystemImpl.<init>(OperatingSystemImpl.java:50)
    ...
    at java.management/java.lang.management.ManagementFactory.getPlatformMBeanServer(ManagementFactory.java:489)
    ...
    at com.ibm.msg.client.commonservices.monitor.MonitorAgent.initialize(MonitorAgent.java:101)
    at com.ibm.msg.client.commonservices.monitor.MonitorAgent.<clinit>(MonitorAgent.java:74)

and, in every later suite that uses the same connector:

java.lang.NoClassDefFoundError: Could not initialize class com.ibm.mq.jms.MQConnectionFactory

Changing the MUnit version, the Mule Maven Plugin version, or the IBM MQ connector version does not resolve it.

 

Cause

This is a known OpenJDK defect, JDK-8287073 ("NPE from CgroupV2Subsystem.getInstance()"), fixed in JDK 17.0.5. On some cgroup v2 Linux hosts, the JDK's container-detection code throws a NullPointerException. It can start without any project change, for example when a hosted agent image moves to a newer Linux kernel (6.14 and later, see JDK-8349988).

The IBM MQ Java client triggers this code when it initialises (it calls ManagementFactory.getPlatformMBeanServer()). Because the error occurs during class initialisation, the IBM MQ client class stays unusable for the rest of the test run, so later suites fail with NoClassDefFoundError. The IBM MQ connector is not the root cause, which is why changing connector, MUnit or plugin versions does not help.

 

Risoluzione

Run the CI pipeline build on a current, supported JDK 17 update release instead of the original JDK 17 GA build. The minimum version is 17.0.5, which avoids the NullPointerException (JDK-8287073). The latest 17.0.x (17.0.20 or later) is recommended, as it also detects the cgroup configuration correctly on newer kernels (JDK-8349988).

  1. Identify which JDK the pipeline uses. In the build log, check the mvn -version / java -version output. If it prints Java version: 17 with no update number (or any version below 17.0.5), it is affected.

  2. Point the build at a current JDK 17 update. Choose whichever fits your pipeline:

    • Use a tool-installer / JDK-selection step. For example, in Azure DevOps add a JavaToolInstaller task (or set the Maven task's JDK option) to select the agent's pre-installed JDK 17:

      `PreInstalled` uses the JDK 17 that is installed on the agent image (`JAVA_HOME_17_X64`), which on Microsoft-hosted agents is a current 17.0.x update.
    • Or point JAVA_HOME at a pre-installed current JDK 17 on the agent instead of a JDK bundled in the repository:

      export JAVA_HOME="<path-to-jdk-17.0.x>"
      export PATH="$JAVA_HOME/bin:$PATH"
    • Or upgrade the bundled/base-image JDK if your pipeline ships its own JDK (for example, replace a repository-committed jdk-17 folder or update the container base image to a current JDK 17.0.x).

  3. Confirm the change: the pipeline log for mvn -version must now show Java version: 17.0.x, where x is 5 or later (20 or later recommended).

  4. Re-run the pipeline. The MUnit suites that initialise the IBM MQ configuration now pass.

 

Numero articolo Knowledge

005462353

 
Caricamento
Salesforce Help | Article