I'm want to enable JMX for my spring boot application and tried everything but without success. I think, the problem is, that I'm using the repackage
option of the spring-boot-maven-plugin
.
At the moment I did the following:
export JAVA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=1617 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=127.0.0.1"
java -jar target/myapp-1.0.0.jar
But when I start the application, it does not listen on port 1617. I cannot connect from a JMX client and ss -tulpen
also does not list the port.
I also tried it by passing the -D...
parameters directly. I also tried it with --com.sun...
and thought Spring boot could handle them this way. I also tried many other things on multiple machines, without success.
Some further information:
- My application does not use any
spring-boot
parent. - I'm trying this on an ArchLinux system.
- I don't have any special iptables configuration, all ports should be available on the configured ip.
- Spring boot version: 1.4.1.RELEASE
- Java version:
openjdk version "1.8.0_112"
What am I doing wrong and where can I find a documentation with help on that?
UPDATE: I added some lines for reading and printing the passed JAVA_OPTS
(as explained here). When I start the application through IntelliJ and setting the VM options to the JAVA_OPTS
value from above, it works. The passed options are printed and the VM is listening on port 1617. When I start the application using java -jar my.jar -Dcom.sun....
the parameters are not printed and the VM is still not listening on port 1617.