Reputation: 3334
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.
Upvotes: 7
Views: 13870
Reputation: 143
In support of Sean's post:
The placement of the javax.sql.DataSource
entry in MBeans of JConsole is:
Catalina
DataSource
/[Name_of_deployed_application]
// e.g. "/DomainService
/[Host_name_of_the_deployed_application]
//e.g. "localhost"
javax.sql.DataSource
Upvotes: 0
Reputation: 1412
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
Upvotes: 12
Reputation: 1199
Darren, if you don't see the object name under Catalina/DataSource/javax.sql.DataSource/<name>
in JConsole, then I wonder if the datasource is defined incorrectly or perhaps it was not connected to the database when Tomcat was started.
Bruce
Upvotes: 0
Reputation: 7737
Do you see any entries under the tree
Catalina -> DataSource -> javax.sql.DataSource
This lists the number of active connections, idle connections, and a few other common stats. Other then that, what kind of information are you hoping to get out of monitoring?
Upvotes: 0