[英]JmxResource published with simplejmx does not appear in JConsole
I am using simplejmx
to publish my JMX Resources
. 我正在使用simplejmx
发布我的JMX Resources
。
I have got jmx-config.xml
我有jmx-config.xml
<bean id="beanPublisher" class="com.j256.simplejmx.spring.BeanPublisher">
<property name="jmxServer" ref="jmxServer" />
</bean>
<bean id="jmxServer" class="com.j256.simplejmx.server.JmxServer"
init-method="start" destroy-method="stop">
<property name="registryPort" value="8123" />
</bean>
I am starting my JBoss
application, everything is ok: 我正在启动我的JBoss
应用程序,一切正常:
15:20:11,860 INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] (MSC service thread 1-8) Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1be30160: defining beans [...,beanPublisher,jmxServer,...]; root of factory hierarchy
I created a simply class. 我创建了一个简单的类。
package com.mypckg.jmx;
import com.j256.simplejmx.common.JmxAttributeField;
import com.j256.simplejmx.common.JmxResource;
@JmxResource(description = "Blah1", domainName = "Blah2", beanName = "Blah3")
public class DummyJMX {
@JmxAttributeField(description = "Blah4")
private int var = 3;
}
I am starting JConsole
, I am choosing JBoss
application and I am going to MBeans
. 我正在启动JConsole
,选择JBoss
应用程序,然后转到MBeans
。 That is what I see: 我看到的是:
* *
Probably, my DummyJMX
class has not been published (or I just cannot find it). 可能是我的DummyJMX
类尚未发布(或者我找不到)。
About which step I forgot? 我忘了哪一步?
Thank you in advance 先感谢您
EDIT : 编辑:
EDIT : 编辑:
@Andrei Stefan @安德烈·斯特凡
An error which I got using your link: 我使用您的链接时遇到了一个错误:
@Gray @灰色
An error which I got using localhost:8123
: 我使用localhost:8123
遇到的错误:
Probably, my DummyJMX class has not been published (or I just cannot find it). 可能是我的DummyJMX类尚未发布(或者我找不到)。
When you are using the registryPort
configuration for JmxServer
then it will not show up in the "Local Process" list under Jconsole. 当您将registryPort
JmxServer
配置用于JmxServer
,它将不会显示在Jconsole下的“本地进程”列表中。 It will be able to be accessed as a "Remote Process" with localhost:8123
. 可以使用localhost:8123
作为“远程进程”进行访问。 If you are on a Linux box, you might use netstat -an | grep LISTEN
如果在Linux机器上,则可以使用netstat -an | grep LISTEN
netstat -an | grep LISTEN
to see what ports your application is listening on. netstat -an | grep LISTEN
查看您的应用程序正在侦听的端口。 If you don't see 8123 in the list then maybe it already has a RMI server configured? 如果您在列表中没有看到8123,则可能它已经配置了RMI服务器?
If you want to use the platform mbean-server which does show up as a local process then use the new setter or constructor in version 1.9 which was released recently (4/2014). 如果您想使用的平台MBean服务器这确实显示为一个本地进程,然后使用于日前发布了1.9版本的新二传或者构造(2014分之4)。 Unfortunately, SimpleJMX cannot programmatically register itself so it shows up in the process list -- that's not code that the JVM exports. 不幸的是,SimpleJMX无法以编程方式注册自己,因此它会显示在进程列表中-而不是JVM导出的代码。
<bean id="jmxServer" class="com.j256.simplejmx.server.JmxServer"
init-method="start" destroy-method="stop">
<property name="usePlatformMBeanServer" value="true" />
</bean>
Try the following url in JConsole, with Remote Process option: service:jmx:rmi:///jndi/rmi://localhost:8123/jmxrmi
尝试在JConsole中使用“远程进程”选项使用以下URL: service:jmx:rmi:///jndi/rmi://localhost:8123/jmxrmi
It's a bit different than what I provided in the comments. 与我在评论中提供的内容有些不同。
Finally, I am connected to my JMX Beans
using JConsole
. 最后,我使用JConsole
连接到我的JMX Beans
。
Probably, I did something wrong in the beginning of my work with simplejmx
. 可能我在使用simplejmx
工作开始时simplejmx
。
I have not changed a lot of things. 我没有改变很多事情。 I kept jmx-config
file and I still use version 1.8
of simplejmx
. 我保留了jmx-config
文件,但仍然使用simplejmx
1.8
版。
I can easily connect to this bean locally
- I have no idea why I was not able to do that earlier. 我可以很容易地locally
连接到该bean-我不知道为什么我不能更早地做到这一点。 Could you tell me, why in your opinion it should not be a local process
? 您能告诉我,为什么您认为这不应该是local process
?
Below, you can see that my JMX Bean
appears in JConsole
: 在下面,您可以看到我的JMX Bean
出现在JConsole
:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.