##### OpenJMS

- Overview
- Downloads
- Release Notes
- Getting Started
- User Guide
  - Using OpenJMS
  - Examples
  - Client JARS
  - Connectors
    - TCP
    - TCPS
    - RMI
    - HTTP
    - HTTPS
    - Embedded
  - Administration API
- Administrator Guide
- Developer Guide
- FAQ

##### Search OpenJMS

##### Project Documentation

- About
- Project Info
- Project Reports
- Development Process

##### Legend

- External Link
- Opens in a new window

## Overview

The RMI connector enables OpenJMS clients to connect to the OpenJMS server using RMI.

## Using the RMI connector

To connect to an OpenJMS server running on the local host, using the default RMI configuration, construct an `InitialContext` as follows:

        Hashtable properties = new Hashtable();
        properties.put(Context.INITIAL_CONTEXT_FACTORY,
                       "org.exolab.jms.jndi.InitialContextFactory");
        properties.put(Context.PROVIDER_URL, "rmi://localhost:1099/");
        Context context = new InitialContext(properties);

The JNDI `Context.PROVIDER_URL` property above, has the format:

    "rmi://<registry-host>:<registry-port>/"

Where:

- registry-host specifies the host that the RMI registry is running on.
- registry-port specifies the port that the RMI registry is listening on.

By default, the OpenJMS server is configured to use an embedded RMI registry. Under this configuration, registry-host will be the host that the OpenJMS server is running on.

## Administration using the RMI connector

To administer an OpenJMS server running on the local host, using the default RMI configuration, construct a `JmsAdminServerIfc` as follows:

        String url = "rmi://localhost:1099/";
        JmsAdminServerIfc admin = AdminConnectionFactory.create(url);

The URL argument has the same format as the `Context.PROVIDER_URL` described in Using the RMI connector