JBoss 融合 JMX 不工作

JBoss Fuse JMX not working

我试图在 Jboss 保险丝容器中连接 JMX rmi url 以监控队列。 URL 未在 jconsole 中连接,

service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi/camel

我想在我的包中实现,如何在 JBoss Fuse 中连接 MBean 服务器?

提前致谢。

恕我直言错了URL。

您可以在 org.apache.karaf.management.cfg.

中查看服务器的当前设置

例如:

#
# Port number for RMI registry connection
#
rmiRegistryPort = 1099

#
# Host for RMI registry
#
rmiRegistryHost = 0.0.0.0

#
# Port number for RMI server connection
#
rmiServerPort = 44444

#
# Host for RMI server
#
rmiServerHost = 0.0.0.0

#
# Name of the JAAS realm used for authentication
#
jmxRealm = karaf

#
# The service URL for the JMXConnectorServer
#
serviceUrl = service:jmx:rmi://${rmiServerHost}:${rmiServerPort}/jndi/rmi://${rmiRegistryHost}:${rmiRegistryPort}/karaf-${karaf.name}

#
# Whether any threads started for the JMXConnectorServer should be started as daemon threads
#
daemon = true

#
# Whether the JMXConnectorServer should be started in a separate thread
#
threaded = true

#
# The ObjectName used to register the JMXConnectorServer
#
objectName = connector:name=rmi

在我的例子中 URL 看起来像 service:jmx:rmi://0.0.0.0:44444/jndi/rmi://0.0.0.0:1099/karaf-root

P.S。并且不要忘记指定用户名和密码。

终于解决了karaf用户名和密码的问题, 检查 users.properties 文件中的用户名和密码。

 service:jmx:rmi:///jndi/rmi://localhost:1099/karaf-root

应该可以。

JMXServiceURL url = new JMXServiceURL(serviceURL);
     HashMap<String, String[]> environment = new HashMap<String, String[]>();
         String username = "admin";
         String password = "admin";
         String[] credentials = new String[] { username, password };
         environment.put("jmx.remote.credentials", credentials);

      connectorServer = JMXConnectorFactory.connect(url,environment);