Hi

The Docs of jdbc-pool describe like this.
==
If you're running outside of a container, you can register the DataSource
yourself under any object name you specify, and it propagates the
registration to the underlying pool. To do this you would call
mBeanServer.registerMBean(dataSource.getPool().getJmxPool(),objectname).
Prior to this call, ensure that the pool has been created by calling
dataSource.createPool().
==
http://tomcat.apache.org/tomcat-9.0-doc/jdbc-pool.html#JMX

Thus you must register the DataSource as MBean.


2018-01-24 10:48 GMT+09:00 Pawel Veselov <pawel.vese...@gmail.com>:

> Hello.
>
> 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 =
>         Class.forName("org.apache.tomcat.jdbc.pool.DataSourceFactory");
> Object dsf = dsfClass.newInstance();
> Method m = dsfClass.getDeclaredMethod("createDataSource",
>         Properties.class);
> return m.invoke(dsf, p);
> // the result is bound into JNDI
> --------------------------
>
> Thank you!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
> --
> Keiichi.Fujino
> <users-h...@tomcat.apache.org>

Reply via email to