Class JMXAccessorCreateTask

  • All Implemented Interfaces:
    Cloneable

    public class JMXAccessorCreateTask
    extends JMXAccessorTask
    Create new MBean at JMX JSR 160 MBeans Server.
    • Create Mbeans
    • Create Mbeans with parameter
    • Create remote Mbeans with different classloader

    Examples:
    create a new Mbean at jmx.server connection

       <jmx:create
               ref="jmx.server"
               name="Catalina:type=MBeanFactory"
               className="org.apache.catalina.mbeans.MBeanFactory"
               classLoader="Catalina:type=ServerClassLoader,name=server">
                <Arg value="org.apache.catalina.mbeans.MBeanFactory" />
       </jmxCreate/>
     

    WARNINGNot all Tomcat MBeans can create remotely and autoregister by its parents! Please, use the MBeanFactory operation to generate valves and realms.

    First call to a remote MBeanserver save the JMXConnection a reference jmx.server

    These tasks require Ant 1.6 or later interface.
    Since:
    5.5.12
    Author:
    Peter Rossbach
    • Constructor Detail

      • JMXAccessorCreateTask

        public JMXAccessorCreateTask()
    • Method Detail

      • getClassLoader

        public String getClassLoader()
        Returns:
        Returns the classLoader.
      • setClassLoader

        public void setClassLoader​(String classLoaderName)
        Parameters:
        classLoaderName - The classLoader to set.
      • getClassName

        public String getClassName()
        Returns:
        Returns the className.
      • setClassName

        public void setClassName​(String className)
        Parameters:
        className - The className to set.
      • addArg

        public void addArg​(Arg arg)
      • getArgs

        public List<Arg> getArgs()
        Returns:
        Returns the args.
      • setArgs

        public void setArgs​(List<Arg> args)
        Parameters:
        args - The args to set.
      • jmxExecute

        public String jmxExecute​(MBeanServerConnection jmxServerConnection)
                          throws Exception
        Description copied from class: JMXAccessorTask
        Execute the specified command, based on the configured properties. The input stream will be closed upon completion of this task, whether it was executed successfully or not.
        Overrides:
        jmxExecute in class JMXAccessorTask
        Parameters:
        jmxServerConnection - The JMX connection that should be used
        Returns:
        An error message string in some situations
        Throws:
        Exception - if an error occurs
      • jmxCreate

        protected void jmxCreate​(MBeanServerConnection jmxServerConnection,
                                 String name)
                          throws Exception
        Create new MBean from ClassLoader identified by an ObjectName.
        Parameters:
        jmxServerConnection - Connection to the JMX server
        name - MBean name
        Throws:
        Exception - Error creating MBean