tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pawel Veselov <>
Subject How to make database connection pool show in JMX
Date Wed, 24 Jan 2018 01:48:51 GMT

I'd like to get some JMX stats out of the JDBC connection pools. But
they don't seem to register
in JMX, even though they are based on ConnectionPoolMBean.

I do create the pools programmatically, by binding the factory into
the JNDI, the creation snippet is
copied below. When I search for JMX objects, I don't see anything that
looks like the pool info,
but I'm also not sure what the object name is supposed to be. I expect
it to be in "Catalina"
domain, though some of the code I saw suggests it may be in
"tomcat.jdbc" domain instead... I
don't have any "tomcat." domains at all.

Any clues are appreciated.

Properties p = new Properties();

p.setProperty("type", "javax.sql.Datasource");
p.setProperty("defaultAutoCommit", "false");
// <...> set some other properties here
// enable JMX
p.setProperty("jmxEnabled", String.valueOf(Boolean.TRUE));
// JNDI of the actual data source
p.setProperty("dataSourceJNDI", pooledDSName);
Class<?> dsfClass =
Object dsf = dsfClass.newInstance();
Method m = dsfClass.getDeclaredMethod("createDataSource",
return m.invoke(dsf, p);
// the result is bound into JNDI

Thank you!

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message