2013-10-18 38 views
1

我正在部署一个使用Hibernate 4.2.0.Final并启用查询缓存(通过在persistence.xml中将属性hibernate.cache.use_query_cache设置为“true”)的应用程序部署到JBoss EAP 6.1最后。JBoss EAP 6.1未在JConsole上显示JMX MBean

启动JBoss并部署应用程序后,当我打开jboss-eap-6.1.0 \ bin \ jconsole.bat时,本地连接到JBoss进程并导航到MBean选项卡,除了空白选项卡外,什么也看不到。我甚至无法看到通常已注册的基本MBean(如jboss。*或java.lang。* MBean)。

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

我不知道这是Hibernate代码还是JBoss代码中的错误(如果有的话),但无论如何我都不知道要在哪里解决这个问题。任何人都可以帮助我完成这两件事情(通过JConsole分发到JBoss EAP安装中的Hibernate查询缓存和MBeans管理)吗?

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

回答

0

不知道这是任何帮助,但:

当deplying的EAR,EAP略知Module "deployment.HibernateMBeanBug.ear.HibernateMBeanBug-persistence.jar:main" from Service Module Loader NumberFormatException异常,期待“主要”部分成为一个数字。在JConsole访问上,它会在迭代MBeans时引发NullPointerException。

它是在这条线:

doIterate(child, childAddress); 

检测的MBean时。孩子= NULL和childAddress =

[ 
    ("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") 
] 

然后,当对下一个迭代的,它要求“儿童”的孩子,这将创下NPE。

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

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.Final,没有解决问题。

UPDATE2:

如果您添加到您的persistence.xml二级缓存:

<property name="hibernate.cache.use_second_level_cache" value="true" /> 

问题就没有了。很显然,如果启用了query_cache,MBean迭代逻辑也希望找到实体缓存(第二级缓存),并且如果未定义则会抛出NPE。如果值为“false”,问题仍然存在,所以必须启用它。

以上只是猜测,但我可能会离开。但是,添加二级缓存似乎是出于某种原因做的伎俩。

0

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

您需要将系统属性org.apache.tomcat.util.ENABLE_MODELER设置为true来监控这些MBean。这个系统属性将导致JBoss公开MBeans“jboss.web:type = *”。

您可以将系统属性添加到$ JBOSS_HOME/bin中/ standalone.conf对EAP 6单机模式,如:

JAVA_OPTS="$JAVA_OPTS -Dorg.apache.tomcat.util.ENABLE_MODELER=true" 

或系统属性也可以在JBoss的EAP 6配置文件中定义(独立( - *),如XML或domain.xml中,等):

<system-properties> 
    <property name="org.apache.tomcat.util.ENABLE_MODELER" value="true"/> 
</system-properties> 

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

/system-property=org.apache.tomcat.util.ENABLE_MODELER:add(value=true) 

请注意,在EAP 6.0.0上设置系统属性ENABLE_MODELER已被中断,如JBoss无法以ENABLE_MODELER设置为true开始所述。此问题的修复程序已包含在EAP 6.0.1之后,此客户端门户上提供了此修补程序,用于EAP 6.0.0。

相关问题