Linux – Jetty JMX setup for remote access

centos6javajettyjmxlinux

I am having some issues getting JMX working on Jetty(9.1.3.v20140225), so I have had a read over the Jetty doco on this.

So I have added the following to the jetty.conf

# ========================================================
# jetty.conf Configuration for jetty.sh script
# --------------------------------------------------------
# This file is used by the jetty.sh script to provide
# extra configuration arguments for the start.jar command
# created by that script.
#
# Each line in this file becomes an arguement to start.jar
# in addition to those found in the start.ini file
# =======================================================
jetty-logging.xml
jetty-started.xml
etc/jetty.xml
etc/jetty-jmx.xml
etc/jetty-jmx-remote.xml

and I added jmx as part of the start.jar –add-to-start command as the doco told me as part of getting Jconsole connected to Jetty

http://www.eclipse.org/jetty/documentation/current/jetty-jconsole.html

[mybase]$ java /opt/jetty-dist/start.jar --add-to-start=jmx
INFO: jmx-remote      initialised in ${jetty.base}/start.ini (appended)
INFO: jmx             initialised transitively

Granted when I did this, it only added jmx and not jmx-remote, not sure why but I am hoping someone can let me know why.

In saying all of this from the documentation I have read I have covered off what they want to get this going.

http://www.eclipse.org/jetty/documentation/current/jmx-chapter.html

But again what it states is not completely right as far as what I see in the package, hence the reason I have added jetty-jmx-remote in, as that has what the doco is saying should be in jetty-jmx.xml.

In anycase when I fire up Jetty I am seeing in the log file that it is starting

INFO:oejj.ConnectorServer:main: JMX Remote URL: service:jmx:rmi://host:1099/jndi/rmi://host:1099/jmxrmi

I can telnet to 1099 from the server, from my client, I have used nmap just to double check that the port is listen and also seen it in netstat. When I use VisualVM to connect I just get an error.

I have make sure that I have opened up all ports between my network and the location of the Jetty.

Can anyone point me in the right direction to get this going.

Thanks

Best Answer

Sorted it, needed to manually add this in into the start.ini

--module=jmx-remote
## JMX Configuration
## Enable for an open port accessible by remote machines
jetty.jmxrmihost=localhost
jetty.jmxrmiport=1099
## Strictly speaking you shouldn't need --exec to use this in most environments.
## If this isn't working, make sure you enable --exec as well
-Dcom.sun.management.jmxremote

And updated this in the jetty-jmx.xml.

<Call class="java.lang.System" name="setProperty">
    <Arg>java.rmi.server.hostname</Arg>
    <Arg>IP-Address</Arg>
  </Call>

Plus did not need to do what I did to the jetty.conf.