Use of JMX RI
I have been trying to use the JMX agent and instrumentation RI from the SUN download site. However although I can get the BaseAgent.java program running, I am unable to view it through my browser. Could anyone please suggest what the problem could be.
The BaseAgent program is pasted below :/*
* @(#)fileBaseAgent.java
* @(#)authorSun Microsystems, Inc.
* @(#)version1.5
* @(#)date00/04/11
*
* Copyright 2000 Sun Microsystems, Inc. All rights reserved.
* This software is the proprietary information of Sun Microsystems, Inc.
* Use is subject to license terms.
*
* Copyright 2000 Sun Microsystems, Inc. Tous droits rserv s.
* Ce logiciel est propriet de Sun Microsystems, Inc.
* Distribu par des licences qui en restreignent l'utilisation.
*/
// java imports
//
import java.util.*;
import java.io.*;
import java.net.*;
// RI imports
//
import javax.management.ObjectName;
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
import javax.management.MalformedObjectNameException;
import com.sun.management.jmx.Trace;
import com.sun.jdmk.comm.HtmlAdaptorServer;
public class BaseAgent {
/*
*
* CONSTRUCTORS
*
*/
public BaseAgent() {
}
/*
*
* PUBLIC METHODS
*
*/
public static void main(String[] args) {
// Parse system properties to check if LEVEL_TRACE and/or LEVEL_DEBUG are set
// and enable the TRACE level accordingly
try {
Trace.parseTraceProperties();
}
catch (IOException e) {
e.printStackTrace();
}
// CREATE the MBeanServer
//
System.out.println("\n\tCREATE the MBeanServer.");
MBeanServer server = MBeanServerFactory.createMBeanServer();
// CREATE and START a new HTML adaptor
//
System.out.println("\n\tCREATE, REGISTER and START a new HTML adaptor:");
HtmlAdaptorServer html = new HtmlAdaptorServer();
ObjectName html_name = null;
try {
html_name = new ObjectName("Adaptor:name=html,port=8082");
System.out.println("\tOBJECT NAME= " + html_name);
server.registerMBean(html, html_name);
} catch(Exception e) {
System.out.println("\t!!! Could not create the HTML adaptor !!!");
e.printStackTrace();
return;
}
html.start();
}
}

