https://issues.apache.org/bugzilla/show_bug.cgi?id=54150

          Priority: P2
            Bug ID: 54150
          Assignee: dev@tomcat.apache.org
           Summary: SlowQueryReportJmx mbean deregistration failure due to
                    NPE - properties not set during pool close callback
          Severity: normal
    Classification: Unclassified
          Reporter: alexfran...@gmail.com
          Hardware: PC
            Status: NEW
           Version: unspecified
         Component: jdbc-pool
           Product: Tomcat Modules

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.
{code}
        PoolProperties.InterceptorDefinition[] proxies =
getPoolProperties().getJdbcInterceptorsAsArray();
        for (int i=0; i<proxies.length; i++) {
            try {
               
proxies[i].getInterceptorClass().newInstance().poolClosed(this);
            }catch (Exception x) {
                log.debug("Unable to inform interceptor of pool closure.",x);
            }
        }
...
{code}

NPE in SlowQueryReportJmx - null.containsKey

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

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

{code}
                JdbcInterceptor interceptor =
proxies[i].getInterceptorClass().newInstance();
                interceptor.setProperties(proxies[i].getProperties());
                interceptor.poolStarted(this);
{code}

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to