具体异常如下:
可以做个监听器:
@WebListener public class ContextFinalizer implements ServletContextListener { private static final Logger logger = LoggerFactory.getLogger(ContextFinalizer.class); public void contextInitialized(ServletContextEvent sce) { } public void contextDestroyed(ServletContextEvent sce) { Enumeration<Driver> drivers = DriverManager.getDrivers(); Driver d = null; while (drivers.hasMoreElements()) { try { d = drivers.nextElement(); DriverManager.deregisterDriver(d); logger.warn(String.format("Driver %s deregistered", d)); } catch (SQLException ex) { logger.warn(String.format("Error deregistering driver %s", d), ex); } } AbandonedConnectionCleanupThread.uncheckedShutdown(); } }
0条评论
我要评论