JDBC Datasource Memory Leak in Tomcat 7
When shutting down Tomcat 7 using the JDBC datasource, users may encounter a warning message similar to the below:
SEVERE: The web application [/my_webapp] appears to have started a thread named [MySQL Statement Cancellation Timer] but has failed to stop it. This is very likely to create a memory leak.
Addressing the JDBC Driver Registration Issue
To resolve the issue related to unregistering the JDBC driver, ensure that the destroy-method is properly configured within the
Resolving the MySQL Statement Cancellation Timer Error
To address the error related to the MySQL Statement Cancellation Timer thread, follow these steps:
shutdownHook com.example.MyShutdownHook
Create the MyShutdownHook class to execute upon Tomcat shutdown:
public class MyShutdownHook implements Shutdownable { @Override public void shutdown() { // Logic to properly close the MySQL Statement Cancellation Timer thread } }
By implementing the above solutions, memory leaks related to JDBC datasource usage and the MySQL Statement Cancellation Timer issue can be effectively mitigated in Tomcat 7.
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3