This content has been marked as final.
Show 1 reply
-
1. Re: Changing Servlet Parameters via JMX
sgturner Oct 9, 2002 2:17 PM (in response to mreith)Since the servlet is not an MBean the short answer is no. However, the long answer is yes. Try this:
Lets assume your servlet class is called Foo. Create an interface called FooMBean and expose whatever parameters you want to expose. Change your class definition to be this:
public class Foo extends HttpServlet implements FooMBean {
}
In the init method of the servlet, register the servlet with the MBeanServer something like this:
MBeanServer server = MBeanServer)MBeanServerFactory.findMBeanServer(null).iterator().next();
ObjectName objName = new ObjectName (domainName+":service=MonitorServlet-Foo");
server.registerMBean (this, objName);
Then you should find the Foo servlet listed in the jmx console so that you can change the parameters.