+

Search Tips   |   Advanced Search

Create a Java Management Extensions client program using the Java Management Extensions Remote application programming interface

We can develop and build a JMX client program that is compliant with JMX Remote application programming interface (JSR 160). After we have a working JMX client program, we can use it to manage WebSphere Application Server or non-WAS systems.

This task assumes a basic familiarity with JSR 160 and JMX API programming. For information on JSR 160, see http://www.jcp.org/en/jsr/detail?id=160. For information on the Java APIs, view the application programming interfaces documentation.

When we develop and run JMX clients that use various JMX connectors and that have security enabled, use the following guidelines. When we follow these guidelines, you guarantee the behavior among different implementations of JMX connectors. Any programming model that strays from these guidelines is unsupported.

  1. Create and use a single JMX client before creating and use another JMX client.

  2. Create and use a JMX client on the same thread.

  3. Using one of the following ways to specify a user ID and password to create a new JMX client:

    • Specify a default user ID and password in the property file.

    • Specify a user ID and password other than the default. After creating a JMX client with a nondefault user ID and password, specify the nondefault user ID and password when we create subsequent JMX clients.


Tasks

  1. Develop a JMX client program.

  2. (iSeries) Build and run the JMX client program.

    The steps required to build and run your program depend on the kind of application environment that your code runs. Refer to the Using application clients topic for details on how to build and run your JMX client program.

  3. Build the JMX remote client program.

    Compile the program with the javac command and provide the location of the ibm.admin.thinclient.jar file in the classpath argument.

    For example, if your ibm.admin.thinclient.jar file is in the /opt/resources/ibm.admin.thinclient.jar path, and we want to compile the JMXRemoteClientApp.java file in the current directory, use the following settings and commands:

    CLASSPATH=/opt/resources/ibm.ws.admin.thinclient.jar:${CLASSPATH}
    export CLASSPATH
    ${JAVA_HOME}/bin/javac JMXRemoteClientApp.java
    

  4. Run the JMX client program.

    Run the JMX client program by setting up the runtime environment so that the program can find all of the prerequisites. Many of the batch or script files in the bin directory under the installation root perform a similar function. The following example is a batch file that runs the JMXRemoteClientApp JMX client program:

    #!/bin/sh
    CONNECTORPROPS=-Dcom.ibm.CORBA.configURL=<location of sas.client.props>
    JAVA_HOME=<location of Java>
    TAC_CLASSPATH=<location of ibm.admin.thinclient.jar>
    
    
    "${JAVA_HOME}/bin/java"  \
    -Djava.ext.dirs="${JAVA_HOME}/jre/lib/ext"  \
    -classpath "${TAC_CLASSPATH}"  ${CONNECTORPROPS}  JMXRemoteClientApp $@
    

    (The contents of the previous batch file are split on multiple lines for publication.)

We have developed, built, and run a JMX client program that is JSR 160 compliant.


Subtopics


Related:

  • Additional Application Programming Interfaces (APIs)
  • Use application clients