Configuring xsbt-web-plugin to open JMX and allow MBean inspection with JConsole/VisualVM

StackOverflow https://stackoverflow.com/questions/17487394

  •  02-06-2022
  •  | 
  •  

문제

How can I configure xsbt-web-plugin to open JMX port so I can inspect MBeans with Jconsole or VisualVM?

With my current setup VisualVM displays no MBean saying "the JMX connection could not be established".

I'm guessing the desired result would be xsbt-web-plugin invokes jetty in the lines of:

java
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.authenticate=false 
-Dcom.sun.management.jmxremote.port=1099 
-jar start.jar etc/jetty-jmx.xml etc/jetty.xml
도움이 되었습니까?

해결책

Because xsbt-web-plugin does not fork a Java process when you run container:start, there's no way to use sbt's javaOptions to do this. Instead, you'll have to instrument the sbt process itself to see any JMX info.

To do this, add the following line to your ~/.sbtconfig file:

SBT_OPTS="$SBT_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=1099"
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top