为了防止内存泄漏,JDBC驱动程序已被强制注销
当我停止tomcat7.0时,我得到了这个。我无法解决它。任何帮助都将不胜感激为了防止内存泄漏,JDBC驱动程序已被强制注销,jdbc,memory-leaks,Jdbc,Memory Leaks,当我停止tomcat7.0时,我得到了这个。我无法解决它。任何帮助都将不胜感激 SEVERE: The web application [/marketservice] registered the JDBC driver[oracle.jdbc.driver.OracleDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driv
SEVERE: The web application [/marketservice] registered the JDBC driver[oracle.jdbc.driver.OracleDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
2011-10-13 9:11:27 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/marketservice] appears to have started a thread named [FileWatchdog] but has failed to stop it. This is very likely to create a memory leak.
2011-10-13 9:11:27 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/marketservice] appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely to create a memory leak.
2011-10-13 9:11:27 org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/marketservice] created a ThreadLocal with key of type [com.opensymphony.xwork2.inject.ContainerImpl$10] (value [com.opensymphony.xwork2.inject.ContainerImpl$10@e24fa8]) and a value of type [java.lang.Object[]] (value [[Ljava.lang.Object;@1dba740]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
2011-10-13 9:11:27 org.apache.coyote.AbstractProtocolHandler stop
INFO: Stopping ProtocolHandler ["http-bio-8080"]
2011-10-13 9:11:27 org.apache.coyote.AbstractProtocolHandler stop
INFO: Stopping ProtocolHandler ["ajp-bio-8009"]
我知道你的话题已经不再是全新的了,但不管怎样,我对看门狗也有同样的问题 (具有JDBC连接的部分已解决:) 似乎已启动名为[FileWatchdog]的线程,但未能停止该线程。这很可能会造成内存泄漏 他们试图在log4j的下一个版本中修复它 但我认为这是有办法的。我这样启动“看门狗”:
@PostConstruct
private void initLogging(File log4JConfig) {
if (loggingExecutor == null) {
LogManager.resetConfiguration();
XMLWatchdog xdog = new XMLWatchdog(log4JConfig.getAbsolutePath());
loggingExecutor = Executors.newSingleThreadScheduledExecutor();
loggingExecutor.scheduleAtFixedRate(xdog, 0, 5, TimeUnit.MINUTES);
Logger logger = Logger.getLogger(ConfigurationService.class);
logger.info("Logging is initialized with the following configuration file: " + log4JConfig.getAbsolutePath());
} else {
logger.info("Logger is already ruinning");
}
}
/**
* Nasty bug:
*
* https://issues.apache.org/bugzilla/show_bug.cgi?id=4913
*
*
* @author Johannes.Hoehne
*
*/
private static class XMLWatchdog extends FileWatchdog {
XMLWatchdog(String filename) {
super(filename);
setName("LogFileChecker");
}
public void doOnChange() {
new DOMConfigurator().doConfigure(filename, LogManager.getLoggerRepository());
}
@Override
public void run() {
checkAndConfigure();
}
}
然后再像这样停止
@PreDestroy
public void shutDownLogger() {
logger.info("Will shut down logger task " + loggingExecutor);
loggingExecutor.shutdown();
}
可能重复的