we're evaluating switching over from the C3P0 connection pool to the Tomcat JDBC Connection Pool (as described here).
It appears to work as a connection pool but I can't seem to see any JMX entries for it when I run jconsole.
Out of the box C3P0 gives lots of operations and attributes via JMX, the Tomcat
JDBC Connection Pool gives none (for me).
According to the page linked above there is a jmxEnabled flag that defaults to true. I've set this explicitly but it seems to make no difference.
What am I missing?
I'm running a fairly standard Java6/Spring/Hibernate app by the way.
If you configure pool in your spring context, you should export bean manually. Autoexport works only if you confiugre pool in tomcat container and import it from JNDI. See http://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html#JMX
You may use this spring config for export pool information to JMX:
<bean id="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource">
... skipped ...
</bean>
<bean id="jmxExporter" class="org.springframework.jmx.export.MBeanExporter" lazy-init="false">
<property name="beans">
<map>
<entry key="bean:name=DataSource" value="#{dataSource.getPool().getJmxPool()}"/>
</map>
</property>
</bean>
Config works only in Spring version 3.0 and above, because it uses spring expression language
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With