优米格
分享有营养的

Tomcat启动报错:To prevent a memory leak, the JDBC Driver has been forcibly unregistered

BraUndress.png

Tomcat部署完项目启动时,报错,报错内容如下:

10:30:01.346 [localhost-startStop-1] DEBUG org.mybatis.spring.SqlSessionUtils.debug(Slf4jImpl.java:47) -  Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1061c0ac]
视频告警监听器启动...
23-Aug-2017 10:30:01.862 严重 [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found
n the appropriate container log file
23-Aug-2017 10:30:01.875 严重 [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal Context [/epcp] startup failed due to previous errors
视频告警监听器销毁...
23-Aug-2017 10:30:01.925 警告 [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [epcp] registered the JDBC drive
 [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
23-Aug-2017 10:30:01.932 警告 [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [epcp] appears to have starteda thread named [pool-2-thread-1] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 sun.misc.Unsafe.park(Native Method)
 java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:226)
 java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2082)
 java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1090)
 java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:807)
 java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1068)
 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
 java.lang.Thread.run(Thread.java:745)
23-Aug-2017 10:30:01.960 严重 [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [epcp] created a ThreadL
cal with key of type [com.sun.jna.Structure$2] (value [com.sun.jna.Structure$2@770b879d]) and a value of type [com.sun.jna.Structure$2.StructureSet] (value [[]]) 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.
23-Aug-2017 10:30:01.978 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\apache-tomcat-8.5.20\webapps\epcp] has finished in [60,041] ms

背景:

我在web.xml里配置了一个监听器,监听当项目启动时,执行周期性任务:

ScheduledExecutorService executorService = new ScheduledThreadPoolExecutor(1);
        VideoAlarmTask task = new VideoAlarmTask();
        //10秒后开始执行任务,以后每隔1秒执行一次
        executorService.scheduleWithFixedDelay(task, 10000, 1000, TimeUnit.MILLISECONDS);

任务内容是执行回调函数,检测的报警信息,就将报警信息入库。

在网上搜索错误原因,一篇文章成功解决了我的问题:参见[解决memory leak问题]。

所以我解决的问题方法是,删除了lib目录下的oracle驱动jar包,保留mysql的驱动,问题解决!

赞(0)
未经允许禁止转载:优米格 » Tomcat启动报错:To prevent a memory leak, the JDBC Driver has been forcibly unregistered

评论 抢沙发

合作&反馈&投稿

商务合作、问题反馈、投稿,欢迎联系

广告合作侵权联系