Bug 54150 - SlowQueryReportJmx mbean deregistration failure due to NPE - properties not set during pool close callback
Summary: SlowQueryReportJmx mbean deregistration failure due to NPE - properties not s...
Alias: None
Product: Tomcat Modules
Classification: Unclassified
Component: jdbc-pool (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2012-11-15 18:38 UTC by Alex Franken
Modified: 2012-12-04 06:09 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Alex Franken 2012-11-15 18:38:29 UTC
Found while debugging version 7.0.29

I found that our SlowQueryReportJmx mbean was not being deregistered during webapp shutdown.  I tracked this down to a NPE.  The interceptor properties are not being set (as is done in setupConnection) prior to the pool close callback.

ConnectionPool.close(boolean) poolClosed callback produces NPE in SlowQueryReportJmx.
        PoolProperties.InterceptorDefinition[] proxies = getPoolProperties().getJdbcInterceptorsAsArray();
        for (int i=0; i<proxies.length; i++) {
            try {
            }catch (Exception x) {
                log.debug("Unable to inform interceptor of pool closure.",x);

NPE in SlowQueryReportJmx - null.containsKey

    public ObjectName getObjectName(Class<?> clazz, String poolName) throws MalformedObjectNameException {
... NPE
        if (getProperties().containsKey(objectNameAttribute)) {

Sounds reasonable to set properties any time you need to instantiate interceptors.
As is done in ConnectionPool.init(PoolConfiguration)

                JdbcInterceptor interceptor = proxies[i].getInterceptorClass().newInstance();
Comment 1 Keiichi Fujino 2012-12-04 06:09:51 UTC
Thanks for the report.
Fixed in trunk and 7.0.x and will be included in 7.0.34 onwards.