You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Walter Heestermans (TME)" <wa...@external.toyota-europe.com> on 2017/12/08 12:47:24 UTC

[dbcp] Exposing JMXbeans

Hi,

We have Struts application using  the commons DBCP and commons Pool implementation. I like to have the pool information exposed as JMX beans, so that I can use JConsole to look a t the pool behaviour. The application is deployed inside a Jetty container. I can see a lot of info already via JConsole but the pool information is missing.

What is required to be able to do that?

Regards
Walter


This e-mail may contain confidential information. If you are not an addressee or otherwise authorised to receive this message, you should not use, copy, disclose or take any action based on this e-mail. If you have received this e-mail in error, please inform the sender promptly and delete this message and any attachments immediately.

RE: [dbcp] Exposing JMXbeans

Posted by "Walter Heestermans (TME)" <wa...@external.toyota-europe.com>.
Project has changed the name to



connectionPool.setJmxName("org.apache.commons.dbcp2:DataSource=ECIDB");



(old: connectionPool.setJmxName("org.apache.dbcp:DataSource=ECIDB");*)



and now info is given in jconsole



Walter





-----Original Message-----
From: Mark Thomas [mailto:markt@apache.org]
Sent: 08 December 2017 16:23
To: user@commons.apache.org
Subject: Re: [dbcp] Exposing JMXbeans



On 08/12/17 14:28, Walter Heestermans (TME) wrote:

> This is what has been coded by the project



I've confirmed that the name used is valid.



You won't see anything in JMX until BasicDataSource.createDataSource()

is called. Typically, you'd trigger that with a call to getConnection().



I used TestBasicDataSource#testClose() to confirm everything was working as expected. I recommended comparing your code to that test case to see where it differs.



Mark





>

>

>

> …

>

>

>

>     public static void setUp() throws Exception {

>

>         // Load JDBC Driver class.

>

>         Class.forName(DatabaseProperties.DB_DRIVER).newInstance();

>

>

>

> *      connectionPool = new BasicDataSource();*

>

>

>

>         connectionPool.setUsername(DatabaseProperties.DB_USER);

>

>         connectionPool.setPassword(DatabaseProperties.DB_PASSWORD);

>

>

> connectionPool.setDriverClassName(DatabaseProperties.DB_DRIVER);

>

>         connectionPool.setUrl(DatabaseProperties.DB_URL);

>

>         connectionPool.setInitialSize(0);

>

>

> connectionPool.setValidationQuery(DatabaseProperties.DB_PREFERRED_TEST

> _QUERY);

>

>         connectionPool.setMaxIdle(DatabaseProperties.DB_MAX_IDLE);

>

>         connectionPool.setMinIdle(DatabaseProperties.DB_MIN_IDLE);

>

>

> //connectionPool.setMaxActive(Integer.parseInt(DatabaseProperties.DB_M

> AX_POOL_SIZE));

>

>

> connectionPool.setMinEvictableIdleTimeMillis(DatabaseProperties.DB_MIN

> _EVICTABLE_IDLE_TME_MILIS);

>

> *      connectionPool.setJmxName("org.apache.dbcp:DataSource=ECIDB");*

>

>

>

> …

>

>

>

> Nothing in jconsole

>

>

>

>

>

> Maybe related to the name they use?

>

>

>

> *connectionPool.setJmxName("org.apache.dbcp:DataSource=ECIDB");*

>

>

>

> Walter

>

>

>

>

>

> -----Original Message-----

> From: Mark Thomas [mailto:markt@apache.org]

> Sent: 08 December 2017 15:11

> To: Commons Users List <us...@commons.apache.org>>

> Subject: Re: [dbcp] Exposing JMXbeans

>

>

>

> On 08/12/17 12:59, Walter Heestermans (TME) wrote:

>

>> We are using:

>

>>

>

>> commons-dbcp2-2.1.1.jar

>

>> commons-pool2-2.4.3.jar

>

>

>

> Set the jmxName property on your BasicDataSourceFcatory and that will

> enable JMX for DBCP and the underlying pools.

>

>

>

> Mark

>

>

>

>>

>

>> Walter

>

>>

>

>>

>

>> -----Original Message-----

>

>> From: Mark Thomas [mailto:markt@apache.org]

>

>> Sent: 08 December 2017 13:58

>

>> To: user@commons.apache.org<ma...@commons.apache.org> <ma...@commons.apache.org>

>

>> Subject: Re: [dbcp] Exposing JMXbeans

>

>>

>

>> On 08/12/17 12:47, Walter Heestermans (TME) wrote:

>

>>> Hi,

>

>>>

>

>>> We have Struts application using  the commons DBCP and commons Pool

> implementation. I like to have the pool information exposed as JMX

> beans, so that I can use JConsole to look a t the pool behaviour. The

> application is deployed inside a Jetty container. I can see a lot of

> info already via JConsole but the pool information is missing.

>

>>>

>

>>> What is required to be able to do that?

>

>>

>

>> A good place to start would be you telling the list which versions of

> Commons DBCP and Commons Pool are being used.

>

>>

>

>> Mark

>

>>

>

>> ---------------------------------------------------------------------

>

>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org<ma...@commons.apache.org>

> <ma...@commons.apache.org>

>

>> For additional commands, e-mail: user-help@commons.apache.org<ma...@commons.apache.org>

> <ma...@commons.apache.org>

>

>>

>

>> This e-mail may contain confidential information. If you are not an

> addressee or otherwise authorised to receive this message, you should

> not use, copy, disclose or take any action based on this e-mail. If

> you have received this e-mail in error, please inform the sender

> promptly and delete this message and any attachments immediately.

>

>>

>

>> ---------------------------------------------------------------------

>

>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org<ma...@commons.apache.org>

> <ma...@commons.apache.org>

>

>> For additional commands, e-mail: user-help@commons.apache.org<ma...@commons.apache.org>

> <ma...@commons.apache.org>

>

>>

>

>

>

>

>

> ---------------------------------------------------------------------

>

> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org<ma...@commons.apache.org>

> <ma...@commons.apache.org>

>

> For additional commands, e-mail: user-help@commons.apache.org<ma...@commons.apache.org>

> <ma...@commons.apache.org>

>

>

>

> This e-mail may contain confidential information. If you are not an

> addressee or otherwise authorised to receive this message, you should

> not use, copy, disclose or take any action based on this e-mail. If

> you have received this e-mail in error, please inform the sender

> promptly and delete this message and any attachments immediately.

>





---------------------------------------------------------------------

To unsubscribe, e-mail: user-unsubscribe@commons.apache.org<ma...@commons.apache.org>

For additional commands, e-mail: user-help@commons.apache.org<ma...@commons.apache.org>



This e-mail may contain confidential information. If you are not an addressee or otherwise authorised to receive this message, you should not use, copy, disclose or take any action based on this e-mail. If you have received this e-mail in error, please inform the sender promptly and delete this message and any attachments immediately.

Re: [dbcp] Exposing JMXbeans

Posted by Mark Thomas <ma...@apache.org>.
On 08/12/17 14:28, Walter Heestermans (TME) wrote:
> This is what has been coded by the project

I've confirmed that the name used is valid.

You won't see anything in JMX until BasicDataSource.createDataSource()
is called. Typically, you'd trigger that with a call to getConnection().

I used TestBasicDataSource#testClose() to confirm everything was working
as expected. I recommended comparing your code to that test case to see
where it differs.

Mark


> 
>  
> 
> …
> 
>  
> 
>     public static void setUp() throws Exception {
> 
>         // Load JDBC Driver class.
> 
>         Class.forName(DatabaseProperties.DB_DRIVER).newInstance();
> 
>  
> 
> *      connectionPool = new BasicDataSource();*
> 
>  
> 
>         connectionPool.setUsername(DatabaseProperties.DB_USER);
> 
>         connectionPool.setPassword(DatabaseProperties.DB_PASSWORD);
> 
>         connectionPool.setDriverClassName(DatabaseProperties.DB_DRIVER);
> 
>         connectionPool.setUrl(DatabaseProperties.DB_URL);
> 
>         connectionPool.setInitialSize(0);
> 
>        
> connectionPool.setValidationQuery(DatabaseProperties.DB_PREFERRED_TEST_QUERY);
> 
>         connectionPool.setMaxIdle(DatabaseProperties.DB_MAX_IDLE);
> 
>         connectionPool.setMinIdle(DatabaseProperties.DB_MIN_IDLE);
> 
>        
> //connectionPool.setMaxActive(Integer.parseInt(DatabaseProperties.DB_MAX_POOL_SIZE));
> 
>        
> connectionPool.setMinEvictableIdleTimeMillis(DatabaseProperties.DB_MIN_EVICTABLE_IDLE_TME_MILIS);
> 
> *      connectionPool.setJmxName("org.apache.dbcp:DataSource=ECIDB");*
> 
>  
> 
> …
> 
>  
> 
> Nothing in jconsole
> 
>  
> 
>  
> 
> Maybe related to the name they use?
> 
>  
> 
> *connectionPool.setJmxName("org.apache.dbcp:DataSource=ECIDB");*
> 
>  
> 
> Walter
> 
>  
> 
>  
> 
> -----Original Message-----
> From: Mark Thomas [mailto:markt@apache.org]
> Sent: 08 December 2017 15:11
> To: Commons Users List <us...@commons.apache.org>
> Subject: Re: [dbcp] Exposing JMXbeans
> 
>  
> 
> On 08/12/17 12:59, Walter Heestermans (TME) wrote:
> 
>> We are using:
> 
>>
> 
>> commons-dbcp2-2.1.1.jar
> 
>> commons-pool2-2.4.3.jar
> 
>  
> 
> Set the jmxName property on your BasicDataSourceFcatory and that will
> enable JMX for DBCP and the underlying pools.
> 
>  
> 
> Mark
> 
>  
> 
>>
> 
>> Walter
> 
>>
> 
>>
> 
>> -----Original Message-----
> 
>> From: Mark Thomas [mailto:markt@apache.org]
> 
>> Sent: 08 December 2017 13:58
> 
>> To: user@commons.apache.org <ma...@commons.apache.org>
> 
>> Subject: Re: [dbcp] Exposing JMXbeans
> 
>>
> 
>> On 08/12/17 12:47, Walter Heestermans (TME) wrote:
> 
>>> Hi,
> 
>>> 
> 
>>> We have Struts application using  the commons DBCP and commons Pool
> implementation. I like to have the pool information exposed as JMX
> beans, so that I can use JConsole to look a t the pool behaviour. The
> application is deployed inside a Jetty container. I can see a lot of
> info already via JConsole but the pool information is missing.
> 
>>> 
> 
>>> What is required to be able to do that?
> 
>>
> 
>> A good place to start would be you telling the list which versions of
> Commons DBCP and Commons Pool are being used.
> 
>>
> 
>> Mark
> 
>>
> 
>> ---------------------------------------------------------------------
> 
>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> <ma...@commons.apache.org>
> 
>> For additional commands, e-mail: user-help@commons.apache.org
> <ma...@commons.apache.org>
> 
>>
> 
>> This e-mail may contain confidential information. If you are not an
> addressee or otherwise authorised to receive this message, you should
> not use, copy, disclose or take any action based on this e-mail. If you
> have received this e-mail in error, please inform the sender promptly
> and delete this message and any attachments immediately.
> 
>>
> 
>> ---------------------------------------------------------------------
> 
>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> <ma...@commons.apache.org>
> 
>> For additional commands, e-mail: user-help@commons.apache.org
> <ma...@commons.apache.org>
> 
>>
> 
>  
> 
>  
> 
> ---------------------------------------------------------------------
> 
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> <ma...@commons.apache.org>
> 
> For additional commands, e-mail: user-help@commons.apache.org
> <ma...@commons.apache.org>
> 
>  
> 
> This e-mail may contain confidential information. If you are not an
> addressee or otherwise authorised to receive this message, you should
> not use, copy, disclose or take any action based on this e-mail. If you
> have received this e-mail in error, please inform the sender promptly
> and delete this message and any attachments immediately.
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


RE: [dbcp] Exposing JMXbeans

Posted by "Walter Heestermans (TME)" <wa...@external.toyota-europe.com>.
This is what has been coded by the project



…



    public static void setUp() throws Exception {

        // Load JDBC Driver class.

        Class.forName(DatabaseProperties.DB_DRIVER).newInstance();



      connectionPool = new BasicDataSource();



        connectionPool.setUsername(DatabaseProperties.DB_USER);

        connectionPool.setPassword(DatabaseProperties.DB_PASSWORD);

        connectionPool.setDriverClassName(DatabaseProperties.DB_DRIVER);

        connectionPool.setUrl(DatabaseProperties.DB_URL);

        connectionPool.setInitialSize(0);

        connectionPool.setValidationQuery(DatabaseProperties.DB_PREFERRED_TEST_QUERY);

        connectionPool.setMaxIdle(DatabaseProperties.DB_MAX_IDLE);

        connectionPool.setMinIdle(DatabaseProperties.DB_MIN_IDLE);

        //connectionPool.setMaxActive(Integer.parseInt(DatabaseProperties.DB_MAX_POOL_SIZE));

        connectionPool.setMinEvictableIdleTimeMillis(DatabaseProperties.DB_MIN_EVICTABLE_IDLE_TME_MILIS);

      connectionPool.setJmxName("org.apache.dbcp:DataSource=ECIDB");



…



Nothing in jconsole



[cid:image001.png@01D37038.31DBE350]



Maybe related to the name they use?



connectionPool.setJmxName("org.apache.dbcp:DataSource=ECIDB");



Walter





-----Original Message-----
From: Mark Thomas [mailto:markt@apache.org]
Sent: 08 December 2017 15:11
To: Commons Users List <us...@commons.apache.org>
Subject: Re: [dbcp] Exposing JMXbeans



On 08/12/17 12:59, Walter Heestermans (TME) wrote:

> We are using:

>

> commons-dbcp2-2.1.1.jar

> commons-pool2-2.4.3.jar



Set the jmxName property on your BasicDataSourceFcatory and that will enable JMX for DBCP and the underlying pools.



Mark



>

> Walter

>

>

> -----Original Message-----

> From: Mark Thomas [mailto:markt@apache.org]

> Sent: 08 December 2017 13:58

> To: user@commons.apache.org<ma...@commons.apache.org>

> Subject: Re: [dbcp] Exposing JMXbeans

>

> On 08/12/17 12:47, Walter Heestermans (TME) wrote:

>> Hi,

>>

>> We have Struts application using  the commons DBCP and commons Pool implementation. I like to have the pool information exposed as JMX beans, so that I can use JConsole to look a t the pool behaviour. The application is deployed inside a Jetty container. I can see a lot of info already via JConsole but the pool information is missing.

>>

>> What is required to be able to do that?

>

> A good place to start would be you telling the list which versions of Commons DBCP and Commons Pool are being used.

>

> Mark

>

> ---------------------------------------------------------------------

> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org<ma...@commons.apache.org>

> For additional commands, e-mail: user-help@commons.apache.org<ma...@commons.apache.org>

>

> This e-mail may contain confidential information. If you are not an addressee or otherwise authorised to receive this message, you should not use, copy, disclose or take any action based on this e-mail. If you have received this e-mail in error, please inform the sender promptly and delete this message and any attachments immediately.

>

> ---------------------------------------------------------------------

> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org<ma...@commons.apache.org>

> For additional commands, e-mail: user-help@commons.apache.org<ma...@commons.apache.org>

>





---------------------------------------------------------------------

To unsubscribe, e-mail: user-unsubscribe@commons.apache.org<ma...@commons.apache.org>

For additional commands, e-mail: user-help@commons.apache.org<ma...@commons.apache.org>



This e-mail may contain confidential information. If you are not an addressee or otherwise authorised to receive this message, you should not use, copy, disclose or take any action based on this e-mail. If you have received this e-mail in error, please inform the sender promptly and delete this message and any attachments immediately.

Re: [dbcp] Exposing JMXbeans

Posted by Mark Thomas <ma...@apache.org>.
On 08/12/17 12:59, Walter Heestermans (TME) wrote:
> We are using:
> 
> commons-dbcp2-2.1.1.jar
> commons-pool2-2.4.3.jar

Set the jmxName property on your BasicDataSourceFcatory and that will
enable JMX for DBCP and the underlying pools.

Mark

> 
> Walter
> 
> 
> -----Original Message-----
> From: Mark Thomas [mailto:markt@apache.org]
> Sent: 08 December 2017 13:58
> To: user@commons.apache.org
> Subject: Re: [dbcp] Exposing JMXbeans
> 
> On 08/12/17 12:47, Walter Heestermans (TME) wrote:
>> Hi,
>>
>> We have Struts application using  the commons DBCP and commons Pool implementation. I like to have the pool information exposed as JMX beans, so that I can use JConsole to look a t the pool behaviour. The application is deployed inside a Jetty container. I can see a lot of info already via JConsole but the pool information is missing.
>>
>> What is required to be able to do that?
> 
> A good place to start would be you telling the list which versions of Commons DBCP and Commons Pool are being used.
> 
> Mark
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
> 
> This e-mail may contain confidential information. If you are not an addressee or otherwise authorised to receive this message, you should not use, copy, disclose or take any action based on this e-mail. If you have received this e-mail in error, please inform the sender promptly and delete this message and any attachments immediately.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


RE: [dbcp] Exposing JMXbeans

Posted by "Walter Heestermans (TME)" <wa...@external.toyota-europe.com>.
We are using:

commons-dbcp2-2.1.1.jar
commons-pool2-2.4.3.jar

Walter


-----Original Message-----
From: Mark Thomas [mailto:markt@apache.org]
Sent: 08 December 2017 13:58
To: user@commons.apache.org
Subject: Re: [dbcp] Exposing JMXbeans

On 08/12/17 12:47, Walter Heestermans (TME) wrote:
> Hi,
>
> We have Struts application using  the commons DBCP and commons Pool implementation. I like to have the pool information exposed as JMX beans, so that I can use JConsole to look a t the pool behaviour. The application is deployed inside a Jetty container. I can see a lot of info already via JConsole but the pool information is missing.
>
> What is required to be able to do that?

A good place to start would be you telling the list which versions of Commons DBCP and Commons Pool are being used.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org

This e-mail may contain confidential information. If you are not an addressee or otherwise authorised to receive this message, you should not use, copy, disclose or take any action based on this e-mail. If you have received this e-mail in error, please inform the sender promptly and delete this message and any attachments immediately.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: [dbcp] Exposing JMXbeans

Posted by Mark Thomas <ma...@apache.org>.
On 08/12/17 12:47, Walter Heestermans (TME) wrote:
> Hi,
> 
> We have Struts application using  the commons DBCP and commons Pool implementation. I like to have the pool information exposed as JMX beans, so that I can use JConsole to look a t the pool behaviour. The application is deployed inside a Jetty container. I can see a lot of info already via JConsole but the pool information is missing.
> 
> What is required to be able to do that?

A good place to start would be you telling the list which versions of
Commons DBCP and Commons Pool are being used.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org