The hibernate plugin has this: <runs-inside> <parent-resource-type name="Tomcat Server" plugin="Tomcat"/> <parent-resource-type name="JBossAS Server" plugin="JBossAS"/> </runs-inside> This means we can only ever monitor hibernate that is hosted inside a Tomcat or JBossAS server. If we just add this parent-resource element: <parent-resource-type name="JMX Server" plugin="JMX"/> then we can monitor hibernate running in any JVM - even a standalone J2SE VM (i.e. not hosted in any application server). With a fix to RHQ-1086, we can check this in for existing inventory to accept this change. Without RHQ-1086, only those that have never deployed the hibernate plugin can take the new plugin and have it deploy. RHQ-1086 is fixed, so this is only a concern for those running an RHQ Server older than that which contains the RHQ-1086 fix.
Before we can check this change in, we need to find out why the plugin cannot remotely access the hibernate mbean. When I try to execute the "get query stats" operation, I get this: org.mc4j.ems.connection.EmsInvocationException: Exception on invocation of [getQueryStatistics]java.lang.reflect.UndeclaredThrowableException at org.mc4j.ems.impl.jmx.connection.bean.operation.DOperation.invoke(DOperation.java:127) at org.rhq.plugins.hibernate.StatisticsComponent.invokeOperation(StatisticsComponent.java:48) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocationThread.call(ResourceContainer.java:450) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) at java.lang.Thread.run(Thread.java:619) Caused by: java.lang.reflect.UndeclaredThrowableException at $Proxy41.invoke(Unknown Source) at org.mc4j.ems.impl.jmx.connection.bean.operation.DOperation.invoke(DOperation.java:111) ... 11 more Caused by: java.rmi.UnmarshalException: error unmarshalling return; nested exception is: java.lang.ClassNotFoundException: org.hibernate.stat.QueryStatistics (no security manager: RMI class loader disabled) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:178) at com.sun.jmx.remote.internal.PRef.invoke(Unknown Source) at javax.management.remote.rmi.RMIConnectionImpl_Stub.invoke(Unknown Source) at javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.invoke(RMIConnector.java:978) at sun.reflect.GeneratedMethodAccessor44.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.mc4j.ems.impl.jmx.connection.support.providers.proxy.JMXRemotingMBeanServerProxy.invoke(JMXRemotingMBeanServerProxy.java:61) ... 13 more Caused by: java.lang.ClassNotFoundException: org.hibernate.stat.QueryStatistics (no security manager: RMI class loader disabled) at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:375) at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165) at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620) at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247) at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:197) at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575) at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351) at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:306) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:155) ... 20 more
When the plugin attempts to collect measurements for all hibernate metrics, it gets this: 2008-11-09 03:25:59,109 DEBUG [MeasurementManager.collector-1] (rhq.core.pc.inventory.ResourceContainer$ResourceComponentInvocationHandler)- Call to org.rhq.plugins.hibernate.EntityComponent.getValues() with args [[org.rhq.core.domain.measurement.MeasurementReport@8e1f66, [ScheduledMeasurementInfo[res=501051, name=loadCount, sched=10225], ScheduledMeasurementInfo[res=501051, name=updateCount, sched=10226], ScheduledMeasurementInfo[res=501051, name=insertCount, sched=10227], ScheduledMeasurementInfo[res=501051, name=deleteCount, sched=10228], ScheduledMeasurementInfo[res=501051, name=optimisticFailureCount, sched=10230], ScheduledMeasurementInfo[res=501051, name=fetchCount, sched=10229]]]] failed. java.util.concurrent.ExecutionException: org.mc4j.ems.connection.EmsInvocationException: Exception on invocation of [getEntityStatistics]java.lang.reflect.UndeclaredThrowableException at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:232) at java.util.concurrent.FutureTask.get(FutureTask.java:91) at org.rhq.core.pc.inventory.ResourceContainer$ResourceComponentInvocationHandler.invokeInNewThreadWithLock(ResourceContainer.java:382) at org.rhq.core.pc.inventory.ResourceContainer$ResourceComponentInvocationHandler.invoke(ResourceContainer.java:365) at $Proxy42.getValues(Unknown Source) at org.rhq.core.pc.measurement.MeasurementCollectorRunner.getValues(MeasurementCollectorRunner.java:109) at org.rhq.core.pc.measurement.MeasurementCollectorRunner.call(MeasurementCollectorRunner.java:89) at org.rhq.core.pc.measurement.MeasurementManager$MeasurementCollectionRequester.run(MeasurementManager.java:169) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) at java.lang.Thread.run(Thread.java:619) Caused by: org.mc4j.ems.connection.EmsInvocationException: Exception on invocation of [getEntityStatistics]java.lang.reflect.UndeclaredThrowableException at org.mc4j.ems.impl.jmx.connection.bean.operation.DOperation.invoke(DOperation.java:127) at org.rhq.plugins.hibernate.EntityComponent.getValues(EntityComponent.java:48) at sun.reflect.GeneratedMethodAccessor41.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocationThread.call(ResourceContainer.java:450) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) ... 3 more Caused by: java.lang.reflect.UndeclaredThrowableException at $Proxy41.invoke(Unknown Source) at org.mc4j.ems.impl.jmx.connection.bean.operation.DOperation.invoke(DOperation.java:111) ... 10 more Caused by: java.rmi.UnmarshalException: error unmarshalling return; nested exception is: java.lang.ClassNotFoundException: org.hibernate.stat.EntityStatistics (no security manager: RMI class loader disabled) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:178) at com.sun.jmx.remote.internal.PRef.invoke(Unknown Source) at javax.management.remote.rmi.RMIConnectionImpl_Stub.invoke(Unknown Source) at javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.invoke(RMIConnector.java:978) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.mc4j.ems.impl.jmx.connection.support.providers.proxy.JMXRemotingMBeanServerProxy.invoke(JMXRemotingMBeanServerProxy.java:61) ... 12 more Caused by: java.lang.ClassNotFoundException: org.hibernate.stat.EntityStatistics (no security manager: RMI class loader disabled) at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:375) at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165) at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620) at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247) at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:197) at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575) at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351) at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:306) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:155) ... 20 more
this cannot work unless we implement RHQ-1094 first
shoot, this should have been in JOPR JIRA since that's where hibernate plugin lives. I'll create one over there just for completeness. This is fixed in JOPR svn rev 51.
this is the same as https://jira.jboss.org/jira/browse/JOPR-19
this is fully tested by doing what the demo does: http://management-platform.blogspot.com/2008/11/monitoring-hibernate.html but you can do a quick test without running through all that. Go to the Administration page and click "All types" link in the Monitoring Defaults: section. Scroll down and look for the JMX Server resource type - for this JIRA to be fixed, you need to see the hibernate resource types under JMX Server: JMX Server |__Hibernate Statistics |__Hibernate Entity
Tested as specified above. The element <parent-resource-type name="JMX Server" plugin="JMX"/> is already contained in the hibernate XML. RHEL5.3, x86_64, PostgreSQL8.2.4, java 1.6.0_11, JON RHQ SVN rev# 2894
This bug was previously known as http://jira.rhq-project.org/browse/RHQ-1093