6 Accessing Custom MBeans

Besides programmatic JMX access to your custom MBeans, you can use any JMX-compliant management system to access your MBeans. For information, see the Oracle Technology Network Web site, which provides links to books, white papers, and other information on JMX: http://www.oracle.com/technetwork/java/javase/tech/javamanagement-140525.html.

The following sections describe additional ways to access your custom MBeans:

Accessing Custom MBeans from JConsole

The JDK includes JConsole, a Swing-based JMX client that you can use to browse MBeans. You can browse the MBeans in any WebLogic Server MBean server and in the JVM platform MBean server. Oracle recommends that you use JConsole only in a development environment; it consumes significant amounts of resources. See Using JConsole to Monitor Applications at http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html.

To access custom MBeans from JConsole:

  1. If wljmxclient.jar and wlclient.jar are not in the JConsole classpath:

    1. Enable the IIOP protocol for the WebLogic Server instance that hosts your MBeans.

    2. Configure the default IIOP user to be a WebLogic Server user with Administrator privileges. In this scenario, the login and password you provide in Step 5d or Step 6d is irrelevant, and the default IIOP user will be associated with each request.

    See "Enable and Configure IIOP" in Administration Console Online Help.

    If wljmxclient.jar and wlclient.jar are in the JConsole classpath, there is no need to enable the default IIOP user. Go to Step 2.

    Notes:

    wlclient.jar is included in wljmxclient.jar's MANIFEST ClassPath entry, so wlclient.jar and wljmxclient.jar need to be in the same directory, or both jars need to be specified on the classpath.

    Ensure that weblogic.jar or wlfullclient.jar is not included in the classpath if wljmxclient.jar is included. Only the thin client wljmxclient.jar/wlclient.jar or the thick client wlfullclient.jar should be used, but not a combination of both.

  2. From a command prompt, make sure that JDK 6 or its equivalent is on the path.

  3. At the command prompt, enter the following command:

    jconsole -J-Djava.class.path=$JAVA_HOME/lib/jconsole.jar:$JAVA_HOME/
    lib/tools.jar:$WLS_HOME/lib/wljmxclient.jar 
    -J-Djmx.remote.protocol.provider.pkgs=weblogic.management.remote
    

    Note:

    If your configuration is as described in Step 4, you can start JConsole simply by executing the command jconsole. If you start JConsole this way, however, only the user who started the WLS process will be able to connect locally.
  4. If your custom MBeans are registered in the JVM platform MBean server (or if you have configured the WebLogic Server Runtime MBean Server to be the JVM platform MBean server):

    1. In the JConsole window, select Connection > New Connection.

    2. In the New Connection window, select the Local Process tab, select the WebLogic.Server, and click Connect.

  5. If your custom MBeans are registered in the WebLogic Server Runtime MBean Server, and if you have not configured the Runtime MBean Server to be the platform MBean server:

    1. In the JConsole window, select Connection > New Connection.

    2. In the New Connection window, select the Remote Process option.

    3. In the Remote Process JMX URL text box, enter:

      service:jmx:rmi:///jndi/iiop://host:port/weblogic.management.mbeanservers.runtime 
      

      where host:port is the host name and port of the WebLogic Server instance that hosts your MBeans.

      For example:

      service:jmx:rmi:///jndi/iiop://localhost:7001/weblogic.management.mbeanservers.runtime 
      
    4. In the User Name and Password fields, enter the user name and password of any user account that is assigned the admin role. This login will be used to authenticate the client and create the Subject that will be associated with each JMX request coming from the client.

    5. Click Connect.

  6. If your custom MBeans are registered in the WebLogic Server Domain Runtime MBean Server:

    1. In the Console window, select Connection > New Connection.

    2. In the New Connection window, select the Remote Process option.

    3. In the Remote Process JMX URL text box, enter:

      service:jmx:rmi:///jndi/iiop://host:port/weblogic.management.mbeanservers.domainRuntime 
      

      where host:port is the host name and port of the Administration Server.

      For example:

      service:jmx:rmi///jndi/iiop://localhost:9002/weblogic.management.mbeanservers.domainRuntime
      
    4. In the User Name and Password fields, enter the user name and password of any user account that is assigned the admin role. This login will be used to authenticate the client and create the Subject that will be associated with each JMX request coming from the client.

    5. Click Connect.

Accessing Custom MBeans from WebLogic Scripting Tool

If you register your MBeans in the Runtime MBean Server or Domain Runtime MBean Server, you can use WebLogic Scripting Tool to access your custom MBeans. See "Accessing Other WebLogic MBeans and Custom MBeans" in Oracle WebLogic Scripting Tool.

Accessing Custom MBeans from an Administration Console Extension

You can extend the WebLogic Server Administration Console by creating Java Server Pages (JSPs) that conform to a specific template. Your JSP can include JMX code that connects to the JVM platform MBean server, the WebLogic Server Runtime MBean Server, or the Domain Runtime MBean Server and looks up your MBeans.

For more information, see Extending the Administration Console for Oracle WebLogic Server.