Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to access objects exposed via JMX Monitoring plugin for JIRA using a Java client?

Juha Siltanen September 17, 2012

I am running a standalone JIRA instance using the Atlassian JDK on a Windows machine.

The executed command is: atlas-run --product jira

By using the Administration UI, I succesfully installed the 'JMX Monitoring plugin for JIRA".

Using JConsole, I was able to see the objects and their respective attributes that are exposed by this plugin.

I need to access this same data using a Java client.

How can I discover the port/url where these JMX objects are exposed to?

I tried to open a connection using javax.management.remote.JMXConnectorFactory, but was unable to succesfully do this. I was able to determine the port by using such proprietary programs as JConsole and TCPView and provided JMXConnectorFactory with the URL of "service:jmx:rmi:///jndi/rmi://localhost:54835/jmxrmi" which is wrapped inside an instance of javax.management.remote.JMXServiceURL.

The execution fails in an exception on this line:

JMXConnector connect = JMXConnectorFactory.connect(jmxServiceUrl);

==> Caused by: java.net.ConnectException: Connection refused: connect

I guess the main question is: how to fetch the JIRA JMX attributesexposed by the JMX Monitoring Pugin from a Java client? Is there a sample program or tutorial for this available?

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Answer accepted
Juha Siltanen September 23, 2012

I was unable to get the Tomcat configurations working for the SDK standalone JIRA. When using the distribution package, the configurations were applied and the JMX was pretty straightforward to access.

For the Tomcat conf in server.xml, I added the following config under 'Server' element:

<Listener className="org.apache.catalina.mbeans.JMXAdaptorLifecycleListener" namingPort="8083" port="8999" host="localhost" />

Into the Tomcat startup script 'catalina'. I added the following options as JVM arguments:

-Dcom.sun.management.jmxremote 
-Dcom.sun.management.jmxremote.port=8999 
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.authenticate=false 
-Djava.rmi.server.hostname=localhost 
-Djava.rmi.server.logCalls=true

After that, the JMX attributes were available at URL:

service:jmx:rmi:///jndi/rmi://:8999/jmxrmi

0 votes
Matthew Blancett August 17, 2014

I assume it's because I'm on standalone build; but getting classpath error for listener defined above. Anyone solved this on standalone? confirmed that catalina jmx jar is present in lib/

TAGS
AUG Leaders

Atlassian Community Events