Question

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
Was it helpful?

Solution

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"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top