求教jdb连接数据库的错误,求大神, 万分感谢您

比卡丘01 2015-09-09 07:03:12
我同时开了4个线程 从数据库拉取数据, mysql 和oracle
使用的jdbc 连接。 拉取大约30秒左右吧 就会出现以下警告, 有时候还会出现 conn的错误
求教...
小弟分少, 66分 你发我也发

九月 09, 2015 4:43:07 下午 org.apache.catalina.core.StandardContext reload
信息: Reloading Context with name [/LIST] has started
九月 09, 2015 4:43:07 下午 org.apache.catalina.loader.WebappClassLoaderBase clearReferencesJdbc
警告: The web application [LIST] 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.
九月 09, 2015 4:43:07 下午 org.apache.catalina.loader.WebappClassLoaderBase clearReferencesJdbc
警告: The web application [LIST] registered the JDBC driver [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.
九月 09, 2015 4:43:07 下午 org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
警告: The web application [LIST] 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. Stack trace of thread:
java.lang.Object.wait(Native Method)
java.lang.Object.wait(Object.java:502)
java.util.TimerThread.mainLoop(Timer.java:526)
java.util.TimerThread.run(Timer.java:505)
九月 09, 2015 4:43:07 下午 org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
警告: The web application [LIST] appears to have started a thread named [towner] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
oracle.jdbc.driver.PhysicalConnection.needLine(PhysicalConnection.java:2330)
oracle.jdbc.driver.OracleResultSetImpl.internal_close(OracleResultSetImpl.java:1883)
oracle.jdbc.driver.OracleResultSetImpl.close_or_fetch_from_next(OracleResultSetImpl.java:240)
oracle.jdbc.driver.OracleResultSetImpl.next(OracleResultSetImpl.java:213)
com.list.dao.impl.OwnerDaoImpl.findByLike(OwnerDaoImpl.java:100)
com.list.servlet.TmFindServlet$findByTownerLike.run(TmFindServlet.java:216)
九月 09, 2015 4:43:07 下午 org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
警告: The web application [LIST] appears to have started a thread named [tlink] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.net.SocketInputStream.socketRead0(Native Method)
java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
java.net.SocketInputStream.read(SocketInputStream.java:170)
java.net.SocketInputStream.read(SocketInputStream.java:141)
oracle.net.ns.Packet.receive(Unknown Source)
oracle.net.ns.DataPacket.receive(Unknown Source)
oracle.net.ns.NetInputStream.getNextPacket(Unknown Source)
oracle.net.ns.NetInputStream.read(Unknown Source)
oracle.net.ns.NetInputStream.read(Unknown Source)
oracle.net.ns.NetInputStream.read(Unknown Source)
oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1099)
oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:1070)
oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:478)
oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:207)
oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:946)
oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1054)
oracle.jdbc.driver.T4CStatement.executeMaybeDescribe(T4CStatement.java:830)
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1124)
oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:1264)
com.list.dao.impl.LinkManDaoImpl.findByLike(LinkManDaoImpl.java:161)
com.list.servlet.TmFindServlet$findByTLinkLike.run(TmFindServlet.java:395)
九月 09, 2015 4:43:07 下午 org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
警告: The web application [LIST] appears to have started a thread named [cust] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
oracle.jdbc.driver.PhysicalConnection.needLine(PhysicalConnection.java:2330)
oracle.jdbc.driver.OracleResultSetImpl.internal_close(OracleResultSetImpl.java:1883)
oracle.jdbc.driver.OracleResultSetImpl.close_or_fetch_from_next(OracleResultSetImpl.java:240)
oracle.jdbc.driver.OracleResultSetImpl.next(OracleResultSetImpl.java:213)
com.list.dao.impl.CustDaoImpl.findByLike(CustDaoImpl.java:80)
com.list.servlet.TmFindServlet$findByCustLike.run(TmFindServlet.java:466)
九月 09, 2015 4:43:07 下午 org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
警告: The web application [LIST] appears to have started a thread named [cend] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.lang.Thread.sleep(Native Method)
com.list.servlet.TmFindServlet$checkEnd.run(TmFindServlet.java:590)
九月 09, 2015 4:43:07 下午 org.apache.jasper.servlet.TldScanner scanJars
信息: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
九月 09, 2015 4:43:07 下午 org.apache.catalina.core.StandardContext reload
信息: Reloading Context with name [/LIST] is completed
...全文
209 点赞 收藏 5
写回复
5 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
WLBSky 2015-09-10
引用 3 楼 u010911944 的回复:
查询时候过长就会出现这个错误。。 我是web网站。 九月 10, 2015 9:34:31 上午 org.apache.catalina.loader.WebappClassLoaderBase checkStateForResourceLoading 信息: Illegal access: this web application instance has been stopped already. Could not load [com.mysql.jdbc.profiler.ProfilerEventHandlerFactory]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access. java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [com.mysql.jdbc.profiler.ProfilerEventHandlerFactory]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access. at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1335) at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1321) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1203) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1164) at com.mysql.jdbc.ConnectionImpl.realClose(ConnectionImpl.java:4315) at com.mysql.jdbc.ConnectionImpl.close(ConnectionImpl.java:1461) at com.list.servlet.TmFindServlet$checkEnd.close(TmFindServlet.java:611) at com.list.servlet.TmFindServlet$checkEnd.run(TmFindServlet.java:572) java.lang.IllegalStateException: Can't overwrite cause with java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [com.mysql.jdbc.profiler.ProfilerEventHandlerFactory]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access. at java.lang.Throwable.initCause(Throwable.java:457) at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1324) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1203) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1164) at com.mysql.jdbc.ConnectionImpl.realClose(ConnectionImpl.java:4315) at com.mysql.jdbc.ConnectionImpl.close(ConnectionImpl.java:1461) at com.list.servlet.TmFindServlet$checkEnd.close(TmFindServlet.java:611) at com.list.servlet.TmFindServlet$checkEnd.run(TmFindServlet.java:572) Caused by: java.lang.ClassNotFoundException at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1323) ... 6 more
你这个代码应该有问题, this web application instance has been stopped already.
回复
WLBSky 2015-09-10
引用 1 楼 zhuangqingch 的回复:
这个是由于 tomcat从6.0.24版本之后引入了内存泄漏侦测的功能,当发现系统有垃圾无法回收时,就会输出内存泄漏提醒的日志信息。当前楼主项目提示的信息主要有2个,一个是建立数据库连接后,当程序停止时,连接可能没断开。导致连接资源被占用。另线程创建被检测到没有停止处理操作。 关于提示这块有个不靠谱的方式,就是关掉提醒功能。不建议这么做。 数据库连接楼主可以检查下代码,做到用完就释放连接,当然也可以用第3方的数据库连接池组件来管理。 关于线程创建的可以将其设置为守护线程。或者给定一个停止的处理,可以用一个检查变量来处理,或者给程序注册一个关闭钩子(Runtime.getRuntime().addShutdownHook(Thread th))。 至于楼主所说的可能会出现连接异常。这个可能是你连接数过多,没有及时释放的原因导致。有可以能代码没做释放操作或者线程没控制好创建过多。具体得看楼主的代码才能得知。 就这些吧,有不明白的,欢迎追问
说的对的,我遇到过 ,conn关闭了也没用
回复
比卡丘01 2015-09-10
查询时候过长就会出现这个错误。。 我是web网站。 九月 10, 2015 9:34:31 上午 org.apache.catalina.loader.WebappClassLoaderBase checkStateForResourceLoading 信息: Illegal access: this web application instance has been stopped already. Could not load [com.mysql.jdbc.profiler.ProfilerEventHandlerFactory]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access. java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [com.mysql.jdbc.profiler.ProfilerEventHandlerFactory]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access. at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1335) at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1321) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1203) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1164) at com.mysql.jdbc.ConnectionImpl.realClose(ConnectionImpl.java:4315) at com.mysql.jdbc.ConnectionImpl.close(ConnectionImpl.java:1461) at com.list.servlet.TmFindServlet$checkEnd.close(TmFindServlet.java:611) at com.list.servlet.TmFindServlet$checkEnd.run(TmFindServlet.java:572) java.lang.IllegalStateException: Can't overwrite cause with java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [com.mysql.jdbc.profiler.ProfilerEventHandlerFactory]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access. at java.lang.Throwable.initCause(Throwable.java:457) at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1324) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1203) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1164) at com.mysql.jdbc.ConnectionImpl.realClose(ConnectionImpl.java:4315) at com.mysql.jdbc.ConnectionImpl.close(ConnectionImpl.java:1461) at com.list.servlet.TmFindServlet$checkEnd.close(TmFindServlet.java:611) at com.list.servlet.TmFindServlet$checkEnd.run(TmFindServlet.java:572) Caused by: java.lang.ClassNotFoundException at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1323) ... 6 more
回复
zhuangqingch 2015-09-09
这个是由于 tomcat从6.0.24版本之后引入了内存泄漏侦测的功能,当发现系统有垃圾无法回收时,就会输出内存泄漏提醒的日志信息。当前楼主项目提示的信息主要有2个,一个是建立数据库连接后,当程序停止时,连接可能没断开。导致连接资源被占用。另线程创建被检测到没有停止处理操作。 关于提示这块有个不靠谱的方式,就是关掉提醒功能。不建议这么做。 数据库连接楼主可以检查下代码,做到用完就释放连接,当然也可以用第3方的数据库连接池组件来管理。 关于线程创建的可以将其设置为守护线程。或者给定一个停止的处理,可以用一个检查变量来处理,或者给程序注册一个关闭钩子(Runtime.getRuntime().addShutdownHook(Thread th))。 至于楼主所说的可能会出现连接异常。这个可能是你连接数过多,没有及时释放的原因导致。有可以能代码没做释放操作或者线程没控制好创建过多。具体得看楼主的代码才能得知。 就这些吧,有不明白的,欢迎追问
回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2015-09-09 07:03
社区公告
暂无公告