最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

java - Remote Connection to Weblogic Using JMX - Stack Overflow

programmeradmin3浏览0评论

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.

发布评论

评论列表(0)

  1. 暂无评论