title: JMX Html Adaptor
body: <p>I'm looking for a simple and straightforward way to add JMX capacities to application, preferably exposed via http. Below is simple code snippet, which, I suspect, should run http server on 8000. And I should be able to access it via <code>http://localhost:8000</code>. However page can't be opened. I can't find proper documentation how it is supposed to work.</p>
  
  <p>jmxtools-1.2.jar is included to classpath. Java version - 1.6</p>
  
  <pre><code>import javax.management.MBeanServerFactory;
  import javax.management.ObjectName;
  import com.sun.jdmk.comm.HtmlAdaptorServer;
  
  public class JmxHttpAdapter {
      public static void main(String[] args) {
          try {
              com.sun.jdmk.comm.HtmlAdaptorServer adapter = new HtmlAdaptorServer(8000);
              MBeanServerFactory.createMBeanServer().registerMBean(adapter, new ObjectName("Adaptor:name=html,port=8000"));
              adapter.start();
              Thread.sleep(100000);
          } catch (Exception ex) {
              ex.printStackTrace();
          }
      }
  }
  </code></pre>