| |
OC4J and MC4J
OC4J and MC4J
The MC4J open source project " ... provides a rich management interface to Java Management Extensions (JMX) based servers. It displays a tree structure of the managed components and provides the ability to view, alter, and graph attributes of live state."
The latest release of the OC4J 10g (10.0.3) Developer Preview contains a working implementation of the JMX specification and all of the required MBeans defined in the JSR77 specification. It also provides a set of MBeans for its own internal components (more of which are currently being implemented and will be available in the production release).
With JMX support now in place with OC4J the latest beta build update has added support for OC4J as a standard server connection type. This lets MC4J display and interact with the MBeans in a running OC4J 10g (10.0.3) Developer Preview.
The OC4J Server Connection
Connecting to OC4J from within MC4J is accomplished by creating a new server connection of type OC4J. When OC4J is chosen as the server type, the connection dialog fields are pre-populated with a default set of values to connect to an OC4J instance.
You can create connections to both local and remote servers by setting the value of the "Server URL" field to the desired server. To connect to the administrator view of the MBeanServer, it's important to retain the "default" portion of the Server URL.
The MC4J console uses the Management EJB (MEJB) provided by OC4J, so the "JNDI Name" field contains the JNDI location of the MEJB that is exposed by OC4J.
Enter the username and password of an administrator enabled users -- by default in an OC4J installation, the user name is "admin". If you want to connect as another user, then to see the full set of MBeans, the user will need to belong to the "administrators" group.
Once you have provided the connection details, you are then required to specify the location of a local OC4J installation directory. This is so that MC4J can locate and use the OC4J specific class libraries required to establish the connection and interact with the MBeanServer. This means that even when creating a remote connection, you need a local OC4J installation -- and it has to also be the same version as the remote OC4J instance you are connecting to. For local installations, this isn't a big deal.
This is the model MC4J uses for Weblogic and WebSphere, so OC4J just uses the same. But hey, it's an open souce project, so I guess it'd be possible to allow for the provision of either a local installation or point or just the smaller subset set of class libraries required to make the connection. Got an opinion -- let me know!
The directory you point MC4J at should be the root directory of the OC4J installation. For example, if you unzipped oc4j_extended.zip into a d:javaoc4j directory, then you'd point it at the d:javaoc4j directory.
MC4J is configured to know which class libraries it needs, and it will then search through the chosen directory to locate them, and add them to it's classpath.
Once the required class libraries have been located, MC4J creates the connection and displays the new OC4J node in the tree. The node can be expanded to show the list of managed objects OC4J provides.
Connections using the MEJB
The OC4J server connection type in MC4J uses the Management EJB (MEJB) defined in JSR77 to query and access the managed objects running in OC4J. The MEJB is a stateless session EJB and provides a remote interface to the MBeanServer.
MC4J acts as a remote J2EE application client. It looks up the Home interface of the MEJB using the OC4J J2EE Application Client context factory -- com.evermind.server.ApplicationClientInitialContextFactory -- and the registered JNDI location of the MEJB -- java:comp/env/ejb/mgmt/MEJB -- and then creates the remote Management object to interface with the MBeanServer. Since this is an application-client, using the MEJB allows both local and remote operations to be performed -- it's location transparent.
** One trick we employed to allow MC4J to lookup and use the MEJB as an application-client was to include an empty META-INF/application-client.xml inside one of the MC4J class libraries (mc4j-core.jar). This was required since the OC4J intiial context for application clients required this file to be present in order for it to operate.
A more interesting option for connecting to OC4J would have been to use the MC4J's JSR160 connection type -- which is the official JMX Remote API. While we have JSR160 connectors implemented in OC4J, unfortunately it didn't make it in time for the code freeze for the Developer Preview, so it's not available to Joe Public. I have tested the JSR160 connection type with a development builds, and with a few additional property settings (to specify the alternate wire protocol to use) it worked. Once we release a version with JSR160 support, this will become the preferred connection type to use.
Links
© Copyright 2004 buttso.
Last update: 4/20/2004; 3:06:50 PM.
|
|