Cannot see JMX entries in jconsole using Tomcat JDBC connection pool

we are evaluating the transition from the C3P0 connection pool to the Tomcat JDBC connection pool ( as described here ).

It seems to work as a connection pool, but I cannot see any JMX entries for it when I run jconsole.
Out of the box, C3P0 provides many operations and attributes via JMX; Tomcat does not provide JDBC connection pool (for me).

According to the page linked above, there is a jmxEnabled flag, which defaults to true. I installed this explicitly, but it doesn't seem to matter.

What am I missing?

I am using a pretty standard Java6 / Spring / Hibernate application, by the way.

+3
source share
4 answers

If you configure the pool in the context of spring, you must export the bean manually. Autoexport only works if the confiugre pool is in the tomcat container and import it from JNDI. See http://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html#JMX

You can use this spring configuration for JMX export pool information:

<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>

The configuration only works in spring version 3.0 and above, as it uses the spring expression language

+8
source

Do you see any entries under the tree

Catalina -> DataSource -> javax.sql.DataSource

Lists the number of active compounds, unoccupied compounds, and several other common characteristics. Another, then, what information do you hope to get out of monitoring?

0
source

, Catalina/DataSource/javax.sql.DataSource/<name> JConsole, , , , Tomcat.

0
In support of Sean's post:

Posting javax.sql.DataSourceto MBeans JConsole:

  • Catalina
    • DataSource
      • /[Name_of_deployed_application]//eg. "/ DomainService
        • /[Host_name_of_the_deployed_application]// eg "Local"
          • javax.sql.DataSource
0
source

Source: https://habr.com/ru/post/1768080/


All Articles