开发者

Is there a way for C# to communicate with a Java server via JMX using MBeans?

I have a server written to Java to service HTTP requests for various clients. I also have some MBeans on this server exposed over JMX from which a monitoring tool can keep an eye on some the servers resources and assist in maintenance.

All code that system/integration tests HTTP endpoints is done is C#. Because of this, I was hoping to try to use C# to also test my开发者_C百科 MBeans over JMX. Does a library to do such a thing already exist, or would I have to go about implementing the protocol myself? What other options (with C#) might I have?


You could use a JMX Bridge like Jolokia which exposes MBeans via HTTP and JSON to the outside world. Several client libraries are available (Java, Perl, Javascript), unfortunately not for C# yet. However, since the protocol is well documented, it should not be that hard to access the Jolokia agents from C# as well. The protocol supports GET requests, so using it mostly only implies to create a proper HTTP Url, send the HTTP request and parse the HTTP-Response as JSON. There is also a sample how to do this in a bash script.


I can attest to the usability of Jolokia. Excellent product. Two additional options:

  • JMX WebService Connector: Install the WS JMXConnectorServer in the target JVM and you can use standard WebService calls to interact with the JMX server.
  • IKVM: This is a compiler that converts Java byte code to .NET byte code. The standard JMX remoting works fine from a C# client.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜