The Source for Java Technology Collaboration
User: Password:



Eamonn McManus

Eamonn McManus's Blog

JSR-262 and WS-Management

Posted by emcmanus on November 06, 2006 at 08:53 AM | Comments (5)

JSR-262 is defining "A Web-Services Connector for JMX Agents", and I'm the Spec Lead. The Expert Group recently decided to replace the custom protocol that was defined in the Early Draft document with a protocol that builds on the WS-Management standard. Here's the background to that decision.

WS-Management and WSDM

Ideally a Web Services Connector for the JMX world would build on some existing and standard Web Services protocol. The problem we faced early on in JSR-262 is that there were two such protocols, WS-Management and WSDM. Without getting into the details, the protocols were incompatible and support for them was about evenly split between the major industry players. So rather than choosing one of them arbitrarily, which would have been politically very difficult, we defined a custom protocol.

A custom protocol

The custom protocol is defined in the Early Draft document. It is conceptually very simple, and very specific to JMX technology. Basically we defined two XML document schemas, one representing an MBeanServer request, such as getAttribute or queryNames, and the other representing the corresponding reply. Then the protocol basically consisted of a trivial WSDL that defined an operation taking an MBeanServerRequest parameter and returning an MBeanServerResponse.

Original (custom) JSR-262 protocol used document exchange

(This is simple only conceptually, because it becomes massively complicated once you start getting into the details of how Java objects are serialized into XML inside the requests and responses.)

Convergence between WS-Management and WSDM

The picture changed with the publication of the white paper Toward Converging Web Service Standards for Resources, Events, and Management, co-signed by key players in each of the two camps. With this paper, an approach based on an existing standard rather than a custom protocol became possible. Furthermore, we had begun getting feedback that defining a new and arguably rival standard was leading to confusion.

From a practical perspective, it is not expected that the converged standard will be finalized before about 2008. JSR-262 is targeted for Java SE 7, which is also scheduled for 2008, but given the necessary lead time to integrate into Java SE, we cannot reasonably wait for the converged protocol to be ready. However, studying the convergence proposal, we can see that its bottom layers are the existing standards WS-Transfer, WS-Enumeration, and WS-Eventing. WS-Management is basically just a definition of how to use these three specifications for management.

So if we include WS-Management in version 1.0 of JSR-262, we can plan to support the converged protocol in a later version, and that should be an incremental and compatible change. It will add the new specifications discussed in the convergence document: WS-ResourceTransfer, WS-Transfer Addendum, WS-MetadataExchange 1.1, and WS-EventingNotification.

A further advantage of including WS-Management is that we have a much better story for integration into heterogeneous network environments. Previous JMX standards defined a sort of "JMX island". They were very useful provided everything was based around JMX technology. But if parts of your network didn't use JMX technology, then they were cast out of the island.

Client use cases for JSR-262

Rather than launching straight into a deeply technical exploration of what this change implies for the JSR-262 protocol, I think it is useful to look at what we see as being the client use cases driving our choices.

Client use case: JMX Connector Client

This is a Java client that is using the JMX Remote API to access the server. Ideally, this client should look exactly like a client using another protocol (such as the RMI connector defined by JSR-160). The only difference should be the URL it specifies. So in particular there should not need to be any configuration of XML schemas or the like on the client or server for this use case.

Use case: JMX Connector Client

The switch to WS-Management will be completely invisible to this sort of client. It still establishes its connection with JMXConnectorFactory.connect, using code something like this:

JMXServiceURL url = new JMXServiceURL("service:jmx:ws://blah:8888/blah");
JMXConnector cc = JMXConnectorFactory.connect(url);
MBeanServerConnection mbsc = cc.getMBeanServerConnection();
String osName = mbsc.getAttribute(
    new ObjectName("java.lang:type=OperatingSystem"), "Name");

This code is exactly the same as if we were using the RMI connector that is already part of the Java SE platform, except that we have replaced :rmi: in the JMXServiceURL by :ws:. We could deploy both an RMI connector and a WS connector for the same MBean Server, and then clients could connect with either.

The details of exactly what gets sent over the wire do change compared to the Early Draft, of course, since the protocol is now based on WS-Management. But both the client and the server will be updated to reflect the change.

Client use case: JMX-aware client

This is a client, probably not running on the Java platform, that is interacting with JMX resources. For example, suppose you have an app server that exposes the JSR-77 MBeans, and you deploy a JSR-262 connector server on top of it. Then you could write a perl or ruby or C# client that is able to display the various statistics exposed by those MBeans.

Use case: JMX-aware client

It might be more accurate to call this client "JMX-model-aware". It probably doesn't know what the MBeanServer interface looks like, but it does know the details of one or more JMX models. In the example, it knows what the names of the MBeans in the JSR-77 model are, even if it calls them "Resource Instances" rather than MBeans. It knows what attributes it can expect to find in those MBeans, even if it calls them "properties".

Client use case: Specific WS-Management client

This is a client that is expecting a particular schema or set of schemas for the WS-Management resources it is interacting with. For example, a client that knows about a CIM model and that accesses that model using the standard WS-CIM mapping. In this use case, JMX is just an implementation technology and the client interaction is exactly the same as if it were interacting with a C# agent implementing the same model.

Use case: WS-Man client

Not a client use case: using the JMX API to access WS-Management

We do not intend to address the use case of a JMX Connector Client that is using the JMX Remote API to interact with arbitrary WS-Management instrumentation. The connector client we define expects the WS-Management agent it interacts with to implement the exact schemas we define. If you need to interact with WS-Management, then you should use a WS-Management client API, such as the one defined by the Wiseman project. The JMX Remote API is not a good fit for this case.

XML schemas for WS-Management content

To understand the WS-Management client use case, you need to know that WS-Management does not specify the XML schema to be used for "Management Resources". Suppose you want to GET the properties of a certain physicalDisk resource, equivalent to getting the attributes of the physicalDisk MBean in JMX parlance. WS-Management says what the SOAP envelope for the request and reply must look like, but it doesn't specify what XML schema will be used for the contents -- the actual attributes. In this example from the WS-Management spec, the SOAP body of the reply might look like this:

<s:Body>
  <PhysicalDisk xmlns="http://schemas.acme.com/2005/02/samples/physDisk">
    <Manufacturer> Acme, Inc. </Manufacturer>
    <Model> 123-SCSI 42 GB Drive </Model>
    <LUN> 2 </LUN>
    <Cylinders> 16384 </Cylinders>
    <Heads> 80 </Heads>
    <Sectors> 63 </Sectors>
    <OctetsPerSector> 512 </OctetsPerSector>
    <BootPartition> 0 </BootPartition>
  </PhysicalDisk>
</s:Body>

The client had better be prepared to deal with the http://schemas.acme.com/2005/02/samples/physDisk namespace, <PhysicalDisk>, <Manufacturer>, and so on. Conversely, the server has to know what schema the client is expecting.

So to be useful in a general WS-Management context, JSR-262 will have to provide an adaptor in the JMX sense of the word. An adaptor takes a standard protocol such as SNMP or WS-Management and converts it into operations on the JMX MBean Server.

In the case of a WS-Management adaptor, it will need to take SOAP headers like these (excerpted)...

<wsman:ResourceURI>http://samples.org/2005/02/physicalDisk</wsman:ResourceURI>
<wsa:Action>
  http://schemas.xmlsoap.org/ws/2004/09/transfer/Get
</wsa:Action>
<wsman:SelectorSet>
  <wsman:Selector Name="LUN"> 2 </wsman:Selector>
</wsman:SelectorSet>

...and derive a JMX ObjectName like org.samples.2005.02:type=physicalDisk,LUN=2. And it will need to convert the AttributeList that it gets back from MBeanServer.getAttributes into an XML fragment like the one above.

We will define some JMX-specific rules that say how an arbitrary ObjectName is represented in the SOAP headers of a WS-Management request, and how the contents of an arbitrary MBean are represented in the SOAP body of a request or a reply. This will allow the connector use case to work without any explicit customization of the client or the server.

We will also define a plug-in mechanism that will allow you to customize these rules for a particular environment, in the WS-Management use case. So you could could tell the adaptor how to convert <wsman:ResourceURI>http://samples.org/2005/02/physicalDisk</wsman:ResourceURI> etc into org.samples.2005.02:type=physicalDisk,LUN=2, and how to convert between an AttributeList and <PhysicalDisk xmlns="http://schemas.acme.com/2005/02/samples/physDisk"> etc.

A particular application of this plug-in mechanism would apply to the WS-CIM mapping, as illustrated above. However, to be complete we would also need to specify how CIM classes are translated into JMX MBeans, which is beyond the scope of the JSR. It's definitely something we'll investigate in order to validate the proposed plug-in mechanism.

Another way to look at this is that the first two use cases correspond to a situation where you are starting from an existing JMX model such as the JSR-77 MBeans. The third use case corresponds to a situation where you are starting from an existing WS-Management model such as one you might get from applying WS-CIM to a CIM model.

So what happens now?

We need to rework the specification and the Reference Implementation to take these changes into account. Luckily the work of implementing the WS-Management protocol in the Java language has already been done in the Wiseman project on java.net, which we intend to build on.

Once the changes have been made to the specification, we plan to release another Early Draft. That's probably going to take a few months, though. In the meantime, comments on this change are welcome either in public on this blog or in private to jsr-262-comments@jcp.org. (And now I'll start getting spam at that address!)


Bookmark blog post: del.icio.us del.icio.us Digg Digg DZone DZone Furl Furl Reddit Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment

  • I love this. It is about time we get a on-the-wire protocol for JMX access. The classpath dependencies you have with JNDI based access or with RMI (via Connector) is really an annoyance. Especially ifyou want to do system management from non-java.

    I like the WS-Management approach and would like to be kept up-to-date. I think we will implement a WS handler for our (JBoss based) application soon, so we can have version independend access.

    Eamonn do you look at JBI as one "early adpoter" for calling JMX methods which do more than simple system monitoring? JBI Tools will greatly benefit from a loose binding.

    Bernd

    Posted by: ecki on April 27, 2007 at 08:23 PM

  • Bernd,

    I'm glad you like what we're doing! An Early Access implementation should be posted very soon.

    I'm familiar with JBI but I'm not sure exactly what you're suggesting in your last sentence. Care to give some examples?

    Éamonn

    Posted by: emcmanus on May 02, 2007 at 07:32 AM

  • Éamonn,

    Do you know of any update regarding the white paper "Toward Converging Web Service Standards for Resources, Events, and Management"? Is there any news about the ongoing work? The white paper is from Mar 2006, and I couldn't find any recent news.

    Thank you,
    Estêvão Rohr.

    Posted by: estevaorohr on November 11, 2007 at 04:37 PM

  • Hi, I haved worked with JMX and WS-Man stuff. Since the subscription format in the JMX and WS-Man are very different, I would like to know how you map them? Do u have any references that might be of some help?Thanks !

    Posted by: ywu on November 16, 2007 at 01:30 AM

  • Hi wyu, very interesting question.
    Mapping from JMX to WS-Eventing / WS-Management has not been trivial. The mapping is detailed in the JSR 262 specification that you can download from this link : http://jcp.org/aboutJava/communityprocess/edr/jsr262/index2.html

    Chapter 2.3.4 offers a good description of such mapping.

    The main idea is that the JMX defined pulling of Notifications (defined by the JSR 160), has been mapped to WS-Management Pulling of Notifications (a WS-Eventing extension). The next release of JSR 262 will also offer the PUSH mechanism.
    We have defined a new Event filter dialect to convey JMX filter. We have also defined an extensible XML representation of the JMX notification.

    The WS-Eventing subscription mechanism has been extended to cope with JMX requirements.
    A short description of the extension:
    A client Subscribes to an MBean and receives an EnumerationContext.
    The client then reuses this EnumerationContext and sends a Pull request to retrieve MBean Notifications. Pull request is waiting for Notifications to be sent before to return. In any case, at the end of the Pull maxTime, the Pull request returns.
    Finally the client unsubscribe. This is quite simple and follow WS-Management specification. It becomes more complex when a client subscribes to more than one MBean.
    Pull request can't contain multiple EnumerationContext. That is why we have defined 2 Custom actions that allow to extend an existing subscription with listeners. Doing so, with a single Pull request, we can retrieve all Notifications of all the active subscriptions. This is the way the JSR 262 JMX Connector client work. Obviously this way of doing is not mandatory. This is a nice optimization to avoid to send multiple Pull requests. Standard WS-Management client can ignore this extension and rely on the WS-Management compliance of the ConnectorServer.

    Hope this help you better understand JMX to WS-Management notification mapping.

    Jean-François Denise.
    http://blogs.sun.com/jmxnetbeans/

    Posted by: jfdenise on November 16, 2007 at 02:00 PM



Only logged in users may post comments. Login Here.


Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds