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.