osgi - How to configure jmx port for karaf in docker container? -


i use visualvm check threads running in karaf in docker container.

what did:

  1. expose 44444 , 1099 docker
  2. in org.apache.karaf.management.cfg, tried setting rmiregistryhost , rmiserverhost several times different combination of docker container ip , docker inner ip doesn't work.
  3. tried change extra_java_opts="-djava.rmi.server.hostname=${docker-container-ip} -dcom.sun.management.jmxremote.local.only=false"

need help.

the problem rmi protocol, not handle scenario host offering rmi endpoint (the docker host) not the host of rmi server (the vm inside docker container).

the way got work

export extra_java_opts=="-dcom.sun.management.jmxremote.ssl=false -dcom.sun.management.jmxremote.authenticate=false -dcom.sun.management.jmxremote.rmi.port=$jmx_rmi_port -dcom.sun.management.jmxremote.port=$jmx_remote_port -djava.rmi.server.hostname=$host_hostname" 

i set environment docker-compose, can replace environment variables fixed values long run 1 container image on host. using 1097 , 1098 rmi , remote ports respectively. 2 things important here:

  • both rmi , remote ports have mapped docker host on same port number. e.g. if use 1097 rmi port in container, have publish port 1097 on host.
  • the java.rmi.server.hostname hostname or ip of docker host, not ip of container

assuming using ports above, connecting

service:jmx:rmi:///jndi/rmi://<your_docker_host>:1098/jmxrmi 

should work.

i never got karaf's jmx accecss control work though.

using jmxmp instead of rmi jmx might make things easier, not supported karaf out of box.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -