1

My application is running on Wildfly-8.0.1. Currently, I am able to trigger MBean methods through JConsole using service:jmx:http-remoting-jmx://localhost:9990.

I want to write some script to trigger those commands but I didn't find a supporting tool to accomplish that.

I tried below tools, but it seems like they are not supporting http-remoting-jmx protocol or may be I am not using in right way 1. JMXTerm 2. Cmdline_JMXClient 3. JManage 4. CJMX

Here is the error from JMXTerm

$>open service:jmx:http-remoting-jmx://localhost:9990 RuntimeIOException: Runtime IO exception: Unsupported protocol: http-remoting-j mx

any help would greatly be appreciated.

Suresh Namala
  • 306
  • 4
  • 14

1 Answers1

-1

Create custom jar file using below class.

import javax.management.MBeanServerConnection;
import javax.management.ObjectName;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;

public class JMXCli {

    //private static List<String> operations;

    private static final String SERVICE_URL = "service:jmx:http-remoting-jmx://";

    public static void main(String[] args) throws Exception {

        JMXServiceURL url = new JMXServiceURL(SERVICE_URL + args[0]);

        JMXConnector connector = JMXConnectorFactory.connect(url);

        MBeanServerConnection connection = connector.getMBeanServerConnection();

        ObjectName objectName = new ObjectName("com.xyz.com:name=<<Your MBean class name>>");

        System.out.println(connection.invoke(objectName, args[1], null, null));

    }
}
Suresh Namala
  • 306
  • 4
  • 14