Tivoli Directory Integrator, Version 7.1.1

The JMX layer

The Server API provides a JMX layer. It exposes all Server API calls through a JMX interface locally and remotely (through the JMX Remote API 1.0).

Please refer to the "Remote Server" chapter in the IBM Tivoli Directory Integrator V7.1.1 Installation and Administrator Guide for information on how to switch on and setup the JMX layer of the Server API for local and remote access.

Local access to the JMX layer

You can get a reference to the JMX MBeanServer object from the local Server JVM by calling

import com.ibm.di.api.jmx.JMXAgent;
import javax.management.MBeanServer;

...

MBeanServer jmxMBeanServer = JMXAgent.getMBeanServer();

The getMBeanServer() static method of the com.ibm.di.api.jmx.JMXAgent class will return an MBeanServer JMX object that represents an entry point to all MBeans provided by the JMX layer of the Server API. You can also register for JMX notifications with the MBeanServer object returned.

Note:
The getMBeanServer() method will throw an Exception if it is called and the JMX layer of the Server API is not initialized.

Remote access to the JMX layer

The remote JMX access to the Server API is implemented as per the JMX Remote API 1.0 specification.

You have to use the following JMX Service URL for remote access:

service:jmx:rmi://<TDI_Server_host>/jndi/rmi://<TDI_Server_host>:<TDI_Server_RMI_port>/jmxconnector

You need to replace <TDI_Server_host> and <TDI_Server_RMI_port> with the host and the RMI port of the TDI Server; for example, service:jmx:rmi://localhost/jndi/rmi://localhost:1099/jmxconnector

The sample code below demonstrates how a remote JMX connection can be established:

import javax.management.MBeanServerConnection;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;

...

JMXServiceURL jmxUrl = new 
		JMXServiceURL("service:jmx:rmi://localhost/jndi/rmi://localhost:1099/jmxconnector");
JMXConnector jmxConnector = JMXConnectorFactory.connect(jmxUrl);
MBeanServerConnection jmxMBeanServer = jmxConnector.getMBeanServerConnection();

Similarly to the local JMX access the MBeanServerConnection object is the entry point to all MBeans and notifications provided by the JMX layer of the Server API.

For example, you can list all MBeans available on the JMX Server:

Iterator mBeans = jmxMBeanServer.queryNames(null, null).iterator(); 
while (mBeans.hasNext()) {
  System.out.println("MBean: " + mBeans.next()); 
}

MBeans and Server API objects

The JMX layer wraps the Server API objects in MBeans. The access to the MBeans is however straightforward - you can directly look up an MBean through the MBeanServerConnection object.

There is no session object in the MBean layer (the session and the security checks are managed through the RMI session). The methods for creating, starting and stopping Config Instances that exist in the Server API Session object can be found in the DIServer MBean in the JMX layer.

A list of the Server API MBeans available at some time on a TDI Server might look like this:

Each Config Instance or AssemblyLine is wrapped in an MBean. When the Config Instance or AssemblyLine is started the MBean is created automatically and it is automatically removed when the Config Instance or AssemblyLine terminates.

Refer to the JavaDoc of the Java package com.ibm.di.api.jmx.mbeans for all available MBeans, their methods and attributes.

JMX notifications

The JMX layer of the Server API provides local and remote notifications for all Server API events (see Working with the System Queue.)

You have to register for JMX notifications with the Notifier MBean.

The JMX notification types are exactly the same as the Server API notifications:

JMX Example - Tivoli® Directory Integrator 7.1.1 and MC4J configuration

This example describes how MC4J and TDI can be set up so that MC4J can be used to access the Server API JMX layer from MC4J.

TDI side

Set up Remote Server API and JMX

Set the following properties in global.properties or solution.properties file (the long hexadecimal values may run off the side of this document):

## Server API properties
## ---------------------

api.on=true
api.user.registry=serverapi/registry.txt
api.user.registry.encryption.on=false

api.remote.on=true
api.remote.ssl.on=false
api.remote.ssl.client.auth.on=true
api.remote.naming.port=1099
# api.remote.server.ports=8700-8900
api.truststore=testserver.jks
{protect}-api.truststore.pass={encr}L79kdqak1afKdAyuCZBMi1GqY
/DPfD1Ipo020CVAGx/OROE2JBUTgZxLjqADXSZJgM3dHg2aWlCRwB+is
/WQa+dSVwT2hpA2kT11T7svqnIESYlcfbSg8xWxcNACdtHmdZoF7
aKSJ1cunDAxNCk0xfvMN+hXV8GK/PrneMLs1YY=

## Specifies a list of IP addresses to accept non SSL connections 
from (host names are not accepted).
## Use space, comma or semicolon as delimiter between IP addresses. 
This property is only taken into account
## when api.remote.ssl.on is set to false.
## api.remote.nonssl.hosts=

api.jmx.on=true
api.jmx.remote.on=true
Note:
SSL is turned off for easy configuration.

Property api.remote.server.ports specifies which ports are used for the RMI services; this property can be used to change the default range (8700-8900) if there is a firewall between the server and the client, and the firewall requires this.

Start the TDI server from the command line
D:\TDI>ibmdisrv -d

CTGDKD435I Remote API successfully started on port:1099, bound to:'SessionFactory'. SSL and Client Authentication are disabled.
CTGDKD111I JMX Remote Server Connector started at: service:jmx:rmi://localhost/jndi/rmi://localhost:1099/jmxconnector.

MC4J side

  1. Download and install MC4J from http://sourceforge.net/projects/mc4j/.
  2. Start the Connect to server ... wizard
    Panel Name Wizard, 1 of 4
  3. Enter TDI in Name field.
  4. In the Server URL text box paste the JMX connection URL dumped by the TDI server on startup
    Note:
    If TDI and MC4J are on different machines replace localhost with the TDI machine IP address.
  5. Select Next.
    Panel Name Wizard, 3 of 4
  6. In the Custom classpath and server libraries list, add all JAR files from the <TDI_install_dir>\jars\common folder.
  7. Add these three jars as well:

Now MC4J is connected to the TDI server.

MC4J screen, showing the MC4J connection to the TDI Server.
[ Top of Page | Previous Page | Next Page | Contents | Terms of use | Feedback ]
(C) Copyright IBM Corporation, 2003, 2012. All Rights Reserved.
IBM Tivoli Directory Integrator 7.1.1