How to enable JMX with Jenkins?

2,999 views
Skip to first unread message

Brian J. Murrell

unread,
Apr 11, 2015, 3:28:40 PM4/11/15
to jenkins...@googlegroups.com
Hi.

I would like to enable JMX with the Jenkins Java process but I seem to
get errors such as the following when I add any of the JMX options to
the "$JENKINS_ARGS" on a Linux machine startup:

Running from: /usr/lib/jenkins/jenkins.war
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:622)
at Main._main(Main.java:293)
at Main.main(Main.java:98)
Caused by: java.lang.IllegalArgumentException: Multiple command line argument specified: -Dcom.sun.management.jmxremote.port=9010
at winstone.cmdline.CmdLineParser.parse(CmdLineParser.java:68)
at winstone.Launcher.getArgsFromCommandLine(Launcher.java:361)
at winstone.Launcher.main(Launcher.java:334)
... 6 more

Ultimately my Jenkins java command line ends up being:

/etc/alternatives/java -Dcom.sun.akuma.Daemon=daemonized -Xmx3G
-Dhttp.proxyHost=proxy.rr.intel.com -Dhttp.proxyPort=911
-DJENKINS_HOME=/var/lib/jenkins -jar /usr/lib/jenkins/jenkins.war
--logfile=/var/log/jenkins/jenkins.log --webroot=/var/cache/jenkins/war
--daemon -Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=9010
-Dcom.sun.management.jmxremote.local.only=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false --webroot=/var/lib/jenkins/war
--httpsPort=8080 --httpPort=-1 --ajp13Port=-1

But that then dies pretty quickly with the above error. The errors will
happen with any of the "-Dcom.sun.management.jmxremote arguments", not
just the "port" one.

Even if you might not know why the above is going wrong, if you have a
recipe for enabling JMX, I'd appreciate hearing about it.

Cheers,
b.

signature.asc

Daniel Beck

unread,
Apr 11, 2015, 6:17:45 PM4/11/15
to jenkins...@googlegroups.com
Java system properties (-Dsomething=foo) need to be set before the -jar argument.
> --
> You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/1428766102.17324.11.camel%40interlinx.bc.ca.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages