Hello.

I'm trying to configure remote JMX access to Karaf instances running
inside containers.

I've found a working configuration, but it produces some warning or
error logs at startup.

I've adapted the etc/org.apache.karaf.management.cfg to set 0.0.0.0
instead of 127.0.0.1 for both rmiRegistryHost and rmiServerHost.

When Karaf is launched, I've added this to JAVA_OPTS :
-Djava.rmi.server.hostname=localhost \
-Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.port=1089 \
-Dcom.sun.management.jmxremote.rmi.port=1099 \
-Dcom.sun.management.jmxremote.local.only=false \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false

The "java.rmi.server.hostname=localhost" is needed since I have to
access JMX through a ssh tunnel, and the name server must be
localhost. But I have this warning in the logs :

2023-04-25T16:11:23,244 | WARN  | activator-1-thread-1 | Activator
                   | 40 - org.apache.karaf.management.server - 4.4.3 |
 | java.rmi.server.hostname system property is already set to
localhost. Apache Karaf doesn't override it

I suppose that as a simple warning, it doesn't matter. Which name does
Karaf try to set without my property ?

In the Karaf's management cfg file, port 1099 for the RMI server seems
to be already defined, but if I don't add
"com.sun.management.jmxremote.rmi.port=1099", external access doesn't
work. But with my property, Karaf produces this log at startup :

2023-04-25T16:11:23,278 | ERROR | activator-1-thread-1 | Activator
                   | 40 - org.apache.karaf.management.server - 4.4.3 |
 | Can't init JMXConnectorServer: Port already in use: 1099; nested
exception is: \n java.net.BindException: Adresse déjà utilisée

How karaf handles JMX is not very clear for me... Somebody has a clearer idea ?

Thanks for your help.

Regards.

Reply via email to