views:

315

answers:

3

I need to connect my .Net application to somebody else's JMX agent. I've read that this is simply not the done thing and I should use soap or practically anything else. As this is just not going to happen, are there any libraries or interop techniques out there that can help me? I'm only interested in the simple things like invoking a remote operation or returning a string result.

+1  A: 

.NET is really not the technology to use to talk to JMX. JMX is a builtin standard that is part of Java but is pretty specific to running in Java. I would assume that you cannot control the application you are trying to consume since you indicate you are trying to use someone else's JMX agent.

In that case, you might want to consider writing your application or part of it in Java. That is the best way to get access to the JMX. If that is not an option you do have a few things you could look into:

1) Check to see if the application you are connecting to can expose the data as something other than JMX. It is usually not hard to allow access via web services to the same data.

2) Write a small Java wrapper that talks to the JMX server and exposes web services. This allows you to query the web services which in turn go over JMX.

3) There are other agents that JMX has to allow it to talk with different technologies. You could use something like the SNMP agent and use SNMP traps from .NET. More information on that can be found here: http://java.sun.com/javase/6/docs/technotes/guides/management/snmp.html

Chris Dail
+1  A: 

If you start up an HtmlAdaptorServer - you could just use the URLs to invoke JMX methods using standard HTTP calls.

I've done this in the past from Perl as part of a system administration task. Its not pretty and its unmaintainable if the JMX interfaces are changing a lot. But.. if you need a quick and dirty hack - this is it!

Fortyrunner
+1  A: 

The Web Services Connector for Java Management Extensions (JMX) Agents and the reference implementation ws-jmx-connector would be my choice. JSR 262 will provide a new opportunity for cross-platform/cross-language enterprise integration projects, but development unfortunately has slowed down.

It would only require some SOAP calls to invoke all operations of the JMX management interface, IIRC even including callbacks/notifications.

mjustin