SimpleJMX contains a simple web-server handler that uses Jetty so that you can access JMX information from a web browser or other web client using the JmxWebServer class. To use this class you need to provide a Jetty version in your dependency list or classpath. See the below example code:
There is a simple web server example program checked into source control. There is also a basic example program that shows how to use the annotations and publish beans to JMX using SimpleJMX.
To use the web-server you would do something like:// [[optionally]] create a new server listening on port 8000 // or you could just use the platform MBeanServer JmxServer jmxServer = new JmxServer(8000); // start the jmx server if necessary jmxServer.start(); // start a web server for exposing jmx beans listening on port 8080 JmxWebServer jmxWebServer = new JmxWebServer(8080); jmxWebServer.start(); // register some object(s) to be exposed with JMX jmxServer.register(someObj); jmxServer.register(someOtherObject); ... // now you can use your web browser to connect on port 8080 ... // stop the server jmxServer.stop(); // stop the web server jmxWebServer.stop();
Here's an image of some sample output as seen from a web browser. You can see that the HTML produced is very rudamentary.
Free Spam Protection Eggnog Recipe Android ORM Simple Java Magic JMX using HTTP OAuth 2.0 Simple Example Great Eggnog Recipe Christopher Randolph