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

    Changing Servlet Parameters via JMX

    mreith

      Hello,

      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 ?

      Regards,
      Markus Reith

        • 1. Re: Changing Servlet Parameters via JMX
          sgturner

          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.