-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mark,

On 6/27/12 4:12 AM, Mark Thomas wrote:
> Getting rid of that message is simple. Fix the bug in the web
> application.

+1

FWIW, Oracle/MySQL says that this bug has been fixed in Connector/J
5.1.11 (http://bugs.mysql.com/bug.php?id=36565). If you can't upgrade,
you might have some success with a ServletContextListener with the
following contextDestroyed method:

    public void contextDestroyed(ServletContextEvent e)
    {
        try
        {
            ClassLoader myClassLoader = this.getClass().getClassLoader();
            Class clazz = Class.forName("com.mysql.jdbc.ConnectionImpl",
                                        false,
                                        myClassLoader);

            if(!(clazz.getClassLoader() == myClassLoader))
            {
                log.info("MySQL ConnectionImpl was loaded with another
ClassLoader: (" + clazz.getClassLoader() + "): cancelling anyway");
            }
            else
            {
                log.info("MySQL ConnectionImpl was loaded with the
WebappClassLoader: cancelling the Timer");
            }

                Field f = clazz.getDeclaredField("cancelTimer");
                f.setAccessible(true);
                Timer timer = (Timer) f.get(null);
                timer.cancel();
                log.info("completed timer cancellation");
        }
        catch (ClassNotFoundException cnfe)
        {
            // Ignore
            log.error("Cannot cancel", cnfe);
        }
        catch (NoSuchFieldException nsfe)
        {
            // Ignore
            log.error("Cannot cancel", nsfe);
        }
        catch (SecurityException se)
        {
            log.info("Failed to shut-down MySQL Statement Cancellation
Timer due to a SecurityException", se);
        }
        catch (IllegalAccessException iae)
        {
            log.info("Failed to shut-down MySQL Statement Cancellation
Timer due to an IllegalAccessException", iae);
        }
    }
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk/rI+4ACgkQ9CaO5/Lv0PBu5gCgw6GPz8gGEgS+yjeJDK20krPA
ugMAnRtm4r3ehNIG/cZhGeU/yS1pIhBY
=eHCR
-----END PGP SIGNATURE-----

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

Reply via email to