1

I am trying to connect to a WebLogic Admin Server from a Java application using JMX. My admin server is running on a remote machine, and I am working from another machine. Below is my code:

import java.util.Map;
import javax.management.MBeanServerConnection;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;

public class WebLogicJMXClient {
    public static void main(String[] args) {
        String hostname = "...."; //dummy data for privacy reasons
        String port = "......";
        String username = "....";
        String password = ".....";

        try {
            // Constructing JMX service URL
            String serviceUrl = "service:jmx:http://" + hostname + ":" + port + "/jndi/weblogic.management.mbeanservers.domainruntime";
            JMXServiceURL jmxServiceURL = new JMXServiceURL(serviceUrl);

            // Connecting to WebLogic
            JMXConnector jmxConnector = JMXConnectorFactory.connect(jmxServiceURL,
                    Map.of("jmx.remote.credentials", new String[]{username, password}));
            MBeanServerConnection connection = jmxConnector.getMBeanServerConnection();
            System.out.println("Connected to WebLogic MBean successfully");

            jmxConnector.close();
        } catch (Exception e) {
            System.err.println("Error connecting to WebLogic");
            e.printStackTrace();
        }
    }
}

I am getting the error: javax.management.remote.JMXProviderException: Unsupported protocol: http

I have added all the required jars(weblogic.jar, wlthint3client.jar, wlclient.jar, wljmxclient.jar). Is this a firewall issue? Please help me debug this problem.

1
  • Related: Explain JMX URL and other questions linked from there. So, maybe service:jmx:rmi: instead of service:jmx:http:? If you get a new (different) error after trying that, then you can research that. Commented Feb 16 at 18:42

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.