1 Reply Latest reply on Oct 9, 2002 2:17 PM by Greg Turner

    Changing Servlet Parameters via JMX

    Markus Reith Newbie


      I tried to change initial parameters of a deployed servlet from the jmx-console. I did not manage the servlet use the new parameters submitted drom the console. Even restarting the servlet did not update the parameters. Is there any way to manipulate servlet parameters from the jmx-console ?

      Markus Reith

        • 1. Re: Changing Servlet Parameters via JMX
          Greg Turner Apprentice

          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.