首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >JMX EAP6.1在JConsole上未显示JBoss MBeans

问JMX EAP6.1在JConsole上未显示JBoss MBeans
EN

Stack Overflow用户
提问于 2013-10-18 21:57:07
回答 2查看 1.3K关注 0票数 1

我正在部署一个使用Hibernate 4.2.0Final的应用程序,并将查询缓存(通过在persistence.xml中将属性hibernate.cache.use_query_cache设置为"true“)启用到JBoss EAP6.1Final。

在启动JBoss并部署应用程序之后,当我打开JBoss -eap-6.1.0bin\jconsole.bat,在本地连接到JBoss进程并导航到MBeans选项卡时,我只看到一个空白选项卡。我甚至看不到通常注册的基本MBeans (比如jbost.*或java.lang.* MBeans)。

我注意到,只需更改persistence.xml,将"hibernate.cache.use_query_cache“设置为"false”(或删除属性,最终效果相同),一切工作正常,即,我可以从JConsole查看和管理MBeans。

我不知道这是否是Hibernate代码或JBoss代码中的错误(如果有),但无论如何,我都不知道在哪里可以修复这个问题。有没有人能帮我把这两件事都做好(Hibernate查询缓存和通过JBoss EAP安装中分发的JConsole进行MBeans管理)?

为了帮助隔离和重现这个问题,我用最少的资源构建了一个简单的EAR来重现这个问题,并附加到了在JBoss论坛上打开的一个讨论中,但到目前为止我还没有任何运气。如果有人对此感到好奇,那么url是https://community.jboss.org/thread/233421

EN

回答 2

Stack Overflow用户

发布于 2013-10-19 00:21:19

不知道这是否有帮助,但是:

当耗尽EAR时,EAP在Module "deployment.HibernateMBeanBug.ear.HibernateMBeanBug-persistence.jar:main" from Service Module Loader上抛出一个NumberFormatException,期望"main“部分是一个数字。在JConsole访问中,它在迭代MBeans时抛出NullPointerException。

它在这一行上:

代码语言:javascript
复制
doIterate(child, childAddress);

在检测MBeans时。child = null和childAddress=

代码语言:javascript
复制
[
    ("deployment" => "HibernateMBeanBug.ear"),
    ("subdeployment" => "HibernateMBeanBug-persistence.jar"),
    ("subsystem" => "jpa"),
    ("hibernate-persistence-unit" => "HibernateMBeanBug.ear/HibernateMBeanBug-persistence.jar#AnyPU"),
    ("entity-cache" => "org.hibernate.cache.spi.UpdateTimestampsCache")
]

然后,在下一次迭代中,当它请求"child“的孩子时,它将命中一个NPE。

这两个异常都可以通过调试器捕获。NPE的堆栈跟踪是

代码语言:javascript
复制
Daemon System Thread [RMI TCP Connection(24)-192.168.11.2] (Suspended (exception NullPointerException)) 
    RootResourceIterator<T>.doIterate(Resource, PathAddress) line: 49   
    RootResourceIterator<T>.doIterate(Resource, PathAddress) line: 55   
    RootResourceIterator<T>.doIterate(Resource, PathAddress) line: 55   
    RootResourceIterator<T>.doIterate(Resource, PathAddress) line: 55   
    RootResourceIterator<T>.doIterate(Resource, PathAddress) line: 55   
    RootResourceIterator<T>.doIterate(Resource, PathAddress) line: 55   
    RootResourceIterator<T>.iterate() line: 39  
    ModelControllerMBeanHelper.queryNames(ObjectName, QueryExp) line: 144   
    ModelControllerMBeanServerPlugin.queryNames(ObjectName, QueryExp) line: 166 
    PluggableMBeanServerImpl.queryNames(ObjectName, QueryExp) line: 308 
    RMIConnectionImpl.doOperation(int, Object[]) line: 1506 
    RMIConnectionImpl.access$300(RMIConnectionImpl, int, Object[]) line: 97 
    RMIConnectionImpl$PrivilegedOperation.run() line: 1328  
    RMIConnectionImpl.doPrivilegedOperation(int, Object[], Subject) line: 1420  
    RMIConnectionImpl.queryNames(ObjectName, MarshalledObject, Subject) line: 590   
    NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]  
    NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57  
    DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43  
    Method.invoke(Object, Object...) line: 606  
    UnicastServerRef2(UnicastServerRef).dispatch(Remote, RemoteCall) line: 322  
    Transport$1.run() line: 177 
    Transport$1.run() line: 174 
    AccessController.doPrivileged(PrivilegedExceptionAction<T>, AccessControlContext) line: not available [native method]   
    TCPTransport(Transport).serviceCall(RemoteCall) line: 173   
    TCPTransport.handleMessages(Connection, boolean) line: 556  
    TCPTransport$ConnectionHandler.run0() line: 811 
    TCPTransport$ConnectionHandler.run() line: 670  
    ThreadPoolExecutor.runWorker(ThreadPoolExecutor$Worker) line: 1145  
    ThreadPoolExecutor$Worker.run() line: 615   
    Thread.run() line: 724  

org.hibernate.cache.spi.UpdateTimestampsCache位于jboss-eap-6.1\modules\system\layers\base\org\hibernate\main\hibernate-core-4.2.0.CR1.jar,所以只要更新它,你就可以摆脱这个问题。

至少这个问题是完全可以重现的,所以我会在issues.jboss.org上打开一个问题。

更新:测试将jar更新到4.2.6。最后,没有解决这个问题。

Update2:

如果您在persistence.xml二级缓存中添加:

代码语言:javascript
复制
<property name="hibernate.cache.use_second_level_cache" value="true" />

这个问题就消失了。显然,如果您启用了NPE,MBean迭代逻辑也希望找到实体缓存(二级缓存),如果没有定义实体缓存,将抛出NPE。对于值"false“,问题仍然存在,因此必须启用它。

以上只是我的猜测,我可能走错了。然而,出于某种原因,添加二级缓存似乎能起到作用。

票数 0
EN

Stack Overflow用户

发布于 2017-04-14 15:18:59

https://access.redhat.com/solutions/180173

您需要将系统属性org.apache.tomcat.util.ENABLE_MODELER设置为true以监视这些MBeans。此系统属性将导致JBoss公开MBeans "jboss.web:type=*“。

在EAP 6独立模式下,可以将系统属性添加到$JBOSS_HOME/bin/standalone.conf,如下所示:

代码语言:javascript
复制
JAVA_OPTS="$JAVA_OPTS -Dorg.apache.tomcat.util.ENABLE_MODELER=true"

或者,也可以在JBoss EAP6配置文件(独立(-*).xml或domain.xml等)中定义系统属性,如下所示:

代码语言:javascript
复制
<system-properties>
    <property name="org.apache.tomcat.util.ENABLE_MODELER" value="true"/>
</system-properties>

如果要通过管理CLI添加系统属性:

代码语言:javascript
复制
/system-property=org.apache.tomcat.util.ENABLE_MODELER:add(value=true)

请注意,在ENABLE_MODELER设置为true的情况下,在JBoss中讨论的在EAP6.0.0上设置系统属性ENABLE_MODELER会中断。此问题的修复包含在EAP 6.0.1及更高版本中,此一次性修补程序可在EAP 6.0.0的客户门户上获得。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19451507

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档