Getting JMX remote from my desktop to a Vagrant machine took a few tries.
Vagrant file configuration to add more memory and forward the HTTP and JMX ports
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.box = "ubuntu/xenial64" config.vm.network "forwarded_port", guest: 8080, host: 8080 config.vm.network "forwarded_port", guest: 9010, host: 9010 config.vm.provider "virtualbox" do |vb| vb.customize ["modifyvm", :id, "--memory", "2048"] end end
Application Start script needs to be modified to setup remote access
java \ -Dcom.sun.management.jmxremote \ -Dcom.sun.management.jmxremote.port=9010 \ -Dcom.sun.management.jmxremote.rmi.port=9010 \ -Djava.rmi.server.hostname=127.0.0.1 \ -Dcom.sun.management.jmxremote.authenticate=false \ -Dcom.sun.management.jmxremote.ssl=false \ -jar "${SOURCE_DIR}/bin/myjar.jar"
Connection is now possible by running:
jconsole 127.0.0.1:9010