29 June 2006

Client setup for connecting to OC4J using JSR160

When connecting from remote JMX clients to OC4J using JSR160, there's a couple of things to keep in mind.

  1. For OC4J, the Service URL specifies the use of the RMI protocol


  2. For OracleAS, the Service URL additionally specifies the use of the OPMN mechanism to obtain the ORMI port of the specified OC4J instance


  3. The client needs to be told where to locate the RMI implementation.

    For programatic clients, this is done using the environment passed to the JMXConnectorFactory

    Hashtable env= new Hashtable();


    Hashtable credentials= new Hashtable();


    env.put(JMXConnector.CREDENTIALS, credentials);

    jmxCon = JMXConnectorFactory.newJMXConnector(serviceUrl, env);

    For pre-built clients, this is done using a System property:


  4. The client classpath needs to include the $ORACLE_HOME/j2ee/home/admin_client.jar library. This library contains references to all the libraries needed to establish remote JMX connections in its Manifest.mf Class-Path entry. It's a nice one-stop shop.
This combination of things usually solves most of the problems I get asked about in this area.

The OC4J J2EE Developer's Guide has a good section on remote connections.


Anonymous said...

Hi Buttso,

Thanks for the blog. It really helped me to resolve JMX Connection issue. Keep up on blogging with some more gooddies.

Thanks again.


Buttso said...

Thanks Rajesh, I'm glad it was able to help you.


Kamatcho said...

Sending a big thanks from Melbourne :). the blog covers points which is not clear or may be does not exist in Oracle documentation. Thanks again, cheeers