12-10 Oracle Complex Event Processing Administrators Guide
nameexportedJNDIname rmi-service-nameRMIrmi-service-name
exported-jndi-context jmx
jndi-service-nameJNDIjndi-service-name rmi-service-nameRMIrmi-service-name
jmx config
12.3 Managing With JMX
This section describes detailed examples of managing Oracle CEP components using JMX, including:
■
Section 12.3.1, How to Programmatically Connect to the Oracle CEP JMX Server From a Non-Oracle CEP Client
■
Section 12.3.2, How to Programmatically Connect to the Oracle CEP JMX Server From an Oracle CEP Client
■
Section 12.3.3, How to Programmatically Configure an Oracle CEP Component Using JMX APIs
■
Section 12.3.4, How to Programmatically Monitor the Throughput and Latency of an Oracle CEP Component Using JMX APIs
■
Section 12.3.5, How to Connect to a Local or Remote Oracle CEP JMX Server Using JConsole With Security Enabled
■
Section 12.3.6, How to Connect to a Local or Remote Oracle CEP JMX Server Using JConsole With Security Disabled
For more information, see:
■
Section 12.1.1, Understanding JMX Configuration
■
Section 12.1.2, Understanding JMX Management
12.3.1 How to Programmatically Connect to the Oracle CEP JMX Server From a Non-Oracle CEP Client
This section describes how to write Java code using the JMX API http:java.sun.comjavasetechnologiescoremntr-mgmtjavamana
gement to connect to the Oracle CEP JMX server from a non-Oracle CEP client. This
is the first step to all programmatic JMX management. For information on connecting to the Oracle CEP JMX server from another Oracle CEP
server, see Section 12.3.2, How to Programmatically Connect to the Oracle CEP JMX
Server From an Oracle CEP Client .
To programmatically connect to the Oracle CEP JMX server from a non-Oracle CEP client:
1.
Be sure that the JMX service is configured for your domain. For details see
Section 12.2, Configuring JMX .
Note: When using JConsole, you must start it with the Oracle CEP
wlevsjconsole.cmd or wlevsjconsole.sh script. You cannot start jconsole directly.
Configuring JMX for Oracle CEP 12-11
2.
Write the http:java.sun.comjavasetechnologiescoremntr-mgmtjavama
nagement Java code to configure the component using the appropriate MBean.
Consider the following JMX programming hints. One of the first things you must do in your JMX program is to establish a
connection to the JMX server running in the Oracle CEP server as Example 12–2
shows.
Example 12–2 Establishing a Connection to the Oracle CEP JMX Server
public static void initConnectionString hostname, int port, String username, char[] password
throws IOException,MalformedURLException { MapString,Object env = makeSecureEnv;
env.putjmx.remote.protocol.provider.pkgs,com.bea.core.jmx.remote.provider; env.putmx4j.remote.resolver.pkgs,com.bea.core.jmx.remote.resolver;
env.putjava.naming.factory.initial,com.bea.core.jndi.context.ContextFactory;
JMXServiceURL serviceUrl = new JMXServiceURL MSARMI,localhost,9002,jndijmxconnector
; System.out.printlnService: + serviceURL.toString;
JMXConnector connector = JMXConnectorFactory.connectserviceUrl,env; MBeanServerConnection connection = connector.getMBeanServerConnection;
} The JMXConnectorFactory.connect method’s second parameter is a Map object that sets up a
secure environment using the makeSecureEnv method, which looks like the following: private static MapString,Object makeSecureEnv {
MapString,Object env = new HashMapString,Object; String username = wlevs ;
char[] password = { w,l,e,v,s }; env.putJMXConnector.CREDENTIALS, new Serializable[]{username,password};
env.putjmx.remote.authenticator, com.bea.core.jmx.server.CEAuthenticator; System.setPropertyjmx.remote.authenticator,
com.bea.core.jmx.server.CEAuthenticator; return env;
}
12.3.2 How to Programmatically Connect to the Oracle CEP JMX Server From an Oracle CEP Client
This section describes how to write Java code using the JMX API http:java.sun.comjavasetechnologiescoremntr-mgmtjavamana
gement to connect to the Oracle CEP JMX server from another Oracle CEP server.
This is the first step to all programmatic JMX management. For information on connecting to the Oracle CEP JMX server from a non-Oracle CEP
client, see Section 12.3.1, How to Programmatically Connect to the Oracle CEP JMX
Server From a Non-Oracle CEP Client .
To programmatically connect to the Oracle CEP JMX server from an Oracle CEP client:
1.
Be sure that the JMX service is configured for your domain.