Skip to content
Documentation
Updated 3 minutes to read
Markdown

This troubleshooting guide explains container monitoring for a container JVM so you can configure JMX remote access, container port mapping, and Docker network connectivity for the Nodinite JMX Monitoring Agent.

When a JVM runs inside a Docker container, the JMX port is bound inside the container and must be exposed to the host network using Docker port mapping. The Spring Boot Gateway then connects through the Docker network to the host IP on the mapped port.

graph LR subgraph "Docker Host" subgraph "Container: boomi-atom" JVM["fab:fa-java Boomi Atom JVM
port 5002 (internal)"] end subgraph "Host Network" PORT["Host port 5002"] end GW["fa Spring Boot Gateway"] end subgraph "Agent Host" AGENT["fa JMX Monitoring Agent (IIS)"] end JVM -->|JMX| PORT GW -->|5002| PORT AGENT -->|8080| GW style JVM fill:#2678BD style PORT fill:#FFD525

Diagram: JMX monitoring for a JVM in a Docker container, where the JMX port is mapped from the container to the host network for Spring Boot Gateway access.

Configuring JMX Remote for Docker Containers

Section titled “Configuring JMX Remote for Docker Containers”

Add JMX remote flags to the JVM startup command and expose the port in the Docker configuration:

Terminal window
java \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.port=5002 \
-Dcom.sun.management.jmxremote.rmi.port=5002 \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false \
-Djava.rmi.server.hostname=<DOCKER_HOST_IP> \
-jar myapp.jar

Step 2: Map the Port in Docker Run or Compose

Section titled “Step 2: Map the Port in Docker Run or Compose”

Docker Run:

Terminal window
docker run -p 5002:5002 my-java-app

Docker Compose:

services:
boomi-atom:
image: boomi/atom:latest
ports:
- "5002:5002"
environment:
- JAVA_OPTS=-Dcom.sun.management.jmxremote.port=5002 ...

In the JMX Monitoring Agent Configuration:

  • Address - The Docker host IP address, not the container IP
  • Port - The mapped host port, 5002 in the example above
  • Heap monitoring - Enable Heap Size thresholds for the target container JVM
  • CPU monitoring - Enable CPU thresholds for the target container JVM

For JVMs running in Kubernetes pods, JMX monitoring requires either:

  • Exposing the JMX port via a Kubernetes NodePort or LoadBalancer service
  • Running the Spring Boot Gateway as a sidecar container in the same pod

Spring Boot Gateway cannot connect to a containerized JVM

Section titled “Spring Boot Gateway cannot connect to a containerized JVM”

Cause: The -Djava.rmi.server.hostname value is not set or is set to localhost or the container IP.

Resolution: Set -Djava.rmi.server.hostname=<DOCKER_HOST_IP> where <DOCKER_HOST_IP> is the IP address reachable by the Spring Boot Gateway.

JMX connects successfully but heap metrics show zero

Section titled “JMX connects successfully but heap metrics show zero”

Cause: The JVM inside the container reports zero heap if the container has memory limits but the JVM is not configured to respect them.

Resolution: Add -XX:+UseContainerSupport in JDK 8u191+ and JDK 10+ to enable JVM container awareness. This allows the JVM to detect Docker memory limits and set heap accordingly.

JMX expose settings are correct but metrics still fail

Section titled “JMX expose settings are correct but metrics still fail”

Cause: The published port is not reachable from the Docker host or another Docker network segment.

Resolution: Verify the container port mapping, host firewall rules, and Docker network routing between the Spring Boot Gateway and the target container.

Enable JMX Remote Monitoring
Costs and Licensing

Multi-JVM Monitoring
OS vs JVM Monitoring
JMX Troubleshooting Overview

...

Version:
Release date: N/A
Loading...

Explore Nodinite for 30 days – completely free

  • Find out why this is the leading O&M software
  • Prove your business case
  • Test the self-service for the business side

Loading...

See how Nodinite resolves your technical issues, in a LIVE Demo!

Once you submit this request:

  • We will give you a short call to understand the issues you want to tackle.
  • Understand solutions you have tried and why were you not happy with them.
  • Book a convenient slot for a LIVE demo!

Loading...