JBoss Community Archive (Read Only)

RHQ 4.9

Plugins - Hibernate

Name

Hibernate

Description

Provides monitoring of Hibernate session manager statistics, EJB3 entities and queries

RHQ Version

1.0

View Source

Source

Get Source

Source

The Hibernate plugin provides monitoring capabilities for Hibernate session manager, EJB3 entities and queries.

The monitoring is possible in any JVM that has the remote JMX monitoring enabled. To enable JMX monitoring, start your JVM using command line parameters such like:

java -Dcom.sun.management.jmxremote.port=19988 \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.authenticate=false \
-jar helloworld.jar

In addition, you have to manually enable Hibernate statistics MBean in the code of your application like this:

StatisticsService mBean = new StatisticsService();
SessionFactory sessionFactory = //...get hibernate session factory...
mBean.setSessionFactory(sessionFactory);
ObjectName objectName = new ObjectName("Hibernate:application=MY_APP_NAME,type=statistics");
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
mbs.registerMBean(mBean, objectName);
sessionFactory.getStatistics().setStatisticsEnabled(true);

Once this setup is in place, you can point the Hibernate plugin to the host and port of the MBean server (configured by the command line parameters above) and you should see the Hibernate statistics of your application listed in the RHQ user interface.

JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-13 07:57:50 UTC, last content change 2013-09-18 19:42:01 UTC.