JMXBrowser

From jPOS.org

Jump to: navigation, search

Integrating JMX Browser (Version 1.1.2) with Q2 Version (1.0)

/by Hitesh Sharma extracted from jpos-dev/

JMX Browser comes in two flavours.

  • Swing based Application which can be integrated with any J2EE Compliant Application. This can be integrated as a local application as well as a Remote Application
  • Web-based Application which can be integrated with Application/Web Server, as a seperate web context.

In order to integrate JMX Browser with Q2, we will be using the first option. (i.e. swing based application).

Configuration Requirements on Q2 end

  • Create a jndi.properties file with following entries
 java.naming.factory.initial=com.sun.jndi.rmi.registry.~RegistryContextFactory
 java.naming.provider.url=rmi://localhost
  • Make sure that this properties file is available to Q2 Application in the Classpath.
    I included the working directory in classpath in q2.bat file, and placed jndi.properties file in working directory so that Q2 Application can resolve the jndi.properties file.
  • Run Q2 Application by Running following command
 cd %Q2_INSTALL_DIRECTORY%
 bin\q2
  • change the name of rmi adaptor available in %Q2_INSTALL_DIRECTORY%/examples/rmiadaptor.xml to say jrmp
       <rmi-adaptor class="org.jpos.q2.qbean.RMIAdaptor" name="jrmp" >
                  <attr name="jndiName">jrmp</attr>
       </rmi-adaptor>

We will be using the name provided to the rmi-adaptor here (in our case "jrmp") to get connected from JMX Browser.

  • Deploy RMI Adaptor in Q2 Application by putting rmiadaptor.xml file in %Q2_INSTALL_DIRECTORY%/deploy directory.

Configuration Requirement on JMX Browser end

  • Unzip jmx.browser-1.1.2.zip in a folder say JMX_BrowserIt will create following folder structure
    • bin (contains scripts to start jmx browser)
    • conf (contains the configuration files. We need to modify jmx.connection.properties file
    • lib
    • logs
  • Comment all the contect in the jmx.connection.properties file and place following configuration.
       ## Start Config for Integratin JMX Browser with JPOS ##
       connection.1.name=JPOS (JRMP)
       connection.1.classname=org.ejtools.jmx.browser.model.connector.~MX4J111JRMPConnectionService
       connection.1.factory=com.sun.jndi.rmi.registry.~RegistryContextFactory
       connection.1.packages=com.sun.jndi.rmi.registry
       connection.1.context=jrmp
       connection.1.url=rmi://localhost:1099
       connection.1.principal=
       connection.1.credentials=
       ## End Config for Integratin JMX Browser with JPOS ##

This suggests that we are using JRMP protocol. org.ejtools.jmx.browser.model.connector.~MX4J111JRMPConnectionService is the Connection implementation for JRMP protocal with the help of mx4j library. and we will be connecting to rmi-adaptor with context name provided as "jrmp".

In this config. we are connecting to the local host on 1099 port, but we can also connect to any other port on remote machine by changing the url.

  • jmx.browser-1.1.2.zip doesn't include mx4j-jmx.jar and mx4j-tools.jar file in the distribution. But this files are needed so copy this files from jPOS's lib directory and place it in jmx.browser's lib directory. JMX browser will load all the jar files in the lib directory at start-up.
  • Start the JMX browser with the help of run.bat or run.sh (whatever is applicable)
  • Select File -> New
  • Click on the connect to jmx server and that's it now you can manage the q2 application throgh JMX Browser.
Personal tools