我尝试在Jboss保险丝容器中连接JMX rmi url以监控队列。 未在jconsole中连接的URL,
service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi/camel
我想在我的软件包中实现,如何在JBoss Fuse中连接MBean服务器?
提前谢谢。
答案 0 :(得分:0)
恕我直言,错误的网址。
您可以在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
在我的情况下,网址看起来像service:jmx:rmi://0.0.0.0:44444/jndi/rmi://0.0.0.0:1099/karaf-root
P.S。并且不要忘记指定用户名和密码。
答案 1 :(得分:0)
最后解决了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);