C3p0 monitor (with hibernation and Tomcat) with JConsole

The web application is a Struts (no spring) application using c3p0 with Hibernate, and it is located in Tomcat 6. Both the Hibernate and c3p0 containers are located in the {WEB_APP} / WEB-INF / lib folder.

Tomcat includes jmx remote: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port = 8888 -Dcom.sun.management.jmxremote.ssl = false -Dcom.sun.management.jmxremote.authenticate = false

When I use jconsole, connect to it, I do not see MB3 c3p0 on the tab.

Is there any configuration I need to do in Tomcat or in a web application?

Thank!

+5
source share
1 answer

Spring JBoss, , JMX- Hibernate.

:

  • Hibernate :

    <property name="hibernate.generate_statistics">true</property>
    
  • MBeans MBean:

    MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer(); ObjectName objectName = new ObjectName("org.hibernate:type=statistics"); StatisticsService mBean = new StatisticsService(); mBean.setStatisticsEnabled(true); mBean.setSessionFactory(sessionFactory); mbeanServer.registerMBean(mBean, objectName);

+2

All Articles