This section describes the RIB JMX infrastructure. JMX is a specification that provides capability for runtime management of java components. Each of the RIB's software components (PublisherEjb, SubscriberEjb, TafrEjb, HospitalRetryEjb, and so on) provides its own management facility by implementing management beans.
The RIB's MBean components use uniform registration, deployment, and communication mechanisms provided by the RIB JMX infrastructure.
RIB uses log4j to log business and system events in the RIB runtime system. The definitions of the loggers are statically defined and come from a configuration file (log4j.xml). As logging is an expensive process we need to provide capability to manage log levels dynamically. The RIB Administration UI Log Manager MBean registers itself through the standard RIB JMX registration process at application startup. It provides an API to access current RIB loggers and change the log levels.
The AlertPublisherFactory is a factory that allows the user to select what alerting mechanism they want. A new JMX alerting mechanism will be added to the system. The JmxAlertPublisher class extends NotificationBroadcasterSupport and provides JMX notification capability. The JMX alerting capability is only available when running inside a container. A message type attribute will be added to the Alert class to provide the message filtering capability.
Any third party JMX console compatible with the Java EE container can be used to manage RIB components. RDMT uses the JMX command line interface provided by this design.
The RIB provides a command line interface to the RIB JMX system. The client is shipped as java classes in the jmx-cmd-line-ui.jar. The entry point is JmxClientMain and allows the user to either execute a single JMX command or run JMX commands in an interactive shell. There is a menu selection that invokes the interactive shell feature. See Chapter 9, "Diagnostic and Monitoring Tools", for examples of how to interface to this utility.
JMXClient> help Executing command : JmxCommand(help). exit Example: exit info objectName Example: info oc4j:j2eeType=JVM,name=single,J2EEServer=standalone setattribs ObjectName attributeName1 attributeValue1 [attributeName2 attributeValue2]... setattribs will only work with attribute types that have a constructor with java.lang.String argument. Example: setattribs oc4j:j2eeType=JTAResource,name="oc4j-tm",J2EEServer=standalone transactionTimeout 31 getattribs ObjectName [attribute1] [attribute2].. Example: getattribs oc4j:j2eeType=JVM,name=single,J2EEServer=standalone javaVersion freeMemory help [command] invoke ObjectName methodName pramType1 paramValue1 [pramType2 paramValue2]... Example: invoke oc4j:j2eeType=JNDINamespace,name=JNDINamespace,J2EEServer=standalone getAllBindingsAsXMLString Example: invoke oc4j:j2eeType=JVM,name=single,J2EEServer=standalone getproperty java.lang.String java.library.path list objectName Example: list *:* close Example: close connect jmxServiceUrl jmxUser jmxPassword jmxConnectionProtocolProviderPackage Example: connect service:jmx:rmi://localhost:23791/oc4j oc4jadmin oc4jadmin oracle.oc4j.admin.jmx.remote Previous command successful: JmxCommand(help). JMXClient>
For clients like RDMT that might issue "single" JMX commands from shell scripts, the JmxClientMain class provides a user interface that is similar to the JMX commands above, with additional connection options for each command.
This example is for Sun JConsole tool.
See: http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html
http://java.sun.com/j2se/1.5.0/docs/guide/management/jconsole.htm
Install the oc4j_admin_client_101330 on a client system.
Create a startup file that sets the properties and classpath:
set JAVA_HOME=D:\Java\ jdk1.6.0_02 set CLASSPATH=D:\oc4jjmxadmin\oc4j_admin_client_101330\j2ee\home\admin_client.jar rem Add the JConsole libraries to the CLASSPATH environment variable: set CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\jconsole.jar set CLASSPATH=%CLASSPATH%;%JAVA_HOME%\lib\tools.jar rem Configure the JMX connector to use the OC4J ORMI protocol: set PROPS=jmx.remote.protocol.provider.pkgs=oracle.oc4j.admin.jmx.remote rem Run jconsole: %JAVA_HOME%\bin\jconsole -J-Djava.class.path=%CLASSPATH% -J-D%PROPS%
Start the JConsole and login into MBean server using a connect URL (e.g. service:jmx:ormi:///opmn://linux1:6003/rib-rms-oc4j-instance).
Select and open any one of the MBean. It opens a window with four tabs Attributes, Operations, Notifications, and Info.
The Attributes tab gives the information about the attributes of the MBean.
The Operations tab gives the list of operations supported by that MBean.
The Notifications tab gives the list of notifications captured on that MBean. (You have to subscribe for capturing the notifications.) Subscribing, unsubscribing, and clearing of notifications can be done from this tab.
The Info tab gives the details of the MBean.
Once an MBean is subscribed for notifications, you can see the list of notifications that occurred for that MBean. The default is zero.
When some operations of the subscribed MBean are executed/invoked, notifications are captured under the Notifications tab.