不知道这是任何帮助,但:
当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”,问题仍然存在,所以必须启用它。
以上只是猜测,但我可能会离开。但是,添加二级缓存似乎是出于某种原因做的伎俩。