Registered the JBDC driver [Oracle.jdbc.OracleDriver] but failed-unregister it when the Web application was stopped. Go

Source: Internet
Author: User

Recent projects encountered a problem in the development environment without the problem of code, in the production environment will report the following error:

Critical: A Web application registered the JBDC driver [Oracle.jdbc.OracleDriver] but failed to unregister it when the Web appli Cation was stopped.
to prevent a memory leak, the jdbc driver has been forcibly  unregistered.   at first thought that the database account password error, or database link is not on, because these two reasons also do report this error, but by confirming that it is not the above two reasons caused by, at that time really is baffled its solution, Later through a step by step of the investigation and testing, found that the previous production, testing, development environment of the database are clustered form, we are also clustered form a number of nodes in the database link, as follows: jdbc.url=jdbc:oracle:thin:@ (description= ( FAILOVER = yes) (address = (PROTOCOL = TCP) (host =xxx.xxx.xxx.xxx) (PORT = 1521)) (address = (PROTOCOL = TCP) (host =xxx.xxx.x XX.XXX) (PORT = 1521)) (Connect_data = (SERVER = dedicated) (service_name = cedb))   Our new production environment is connected directly to the database, not to a DB cluster, So when loading the link is reported as the error, the configuration of the link is set as follows: jdbc.url=jdbc\:oracle\:thin\: @XXX .xxx.xxx.xxx\:1521\:cedb  This anomaly is really taught, Hope can help to have the same confused friend.  http://blog.csdn.net/suigaopeng/article/details/26579191 http://blog.sina.com.cn/s/blog_ 4550f3ca0101byg1.html  today began to learn struts2, so the latest version of struts2.2.3.1, in the process of using always error: A Web application created a ThreadLocal with key of type, despite this error Mistake, but does not hinder the normal operation of the program, although the program can run normally, but this error is very awkward to see, so the online search for a look, there is the following articlestruts2 about a Web application created a ThreadLocal with key of type exception resolution

Created a ThreadLocal with key of type [com.opensymphony.xwork2.inject.containerimpl$10] (value [[email protected]]) and a Value of type [java.lang.object[]] (value [[ljava.lang.object;@1a34544]) but failed to remove it ....

Solutions to this type of problem:

http://confluence.atlassian.com/pages/viewpage.action?pageId=218275753

Look at the foreigner this article, seems to be talking about this problem, the reason is that Tomcat 6.025 introduced a memory leak check mechanism, will not garbage collection of the image to do the log.

The first of these solutions:

Using tomcat that is below version 6

The second solution:

In the Tomcat Server.xml file (in the Conf folder under Tomcat's installation path),

<listener classname= "Org.apache.catalina.core.JreMemoryLeakPreventionListener"/>

This monitor is turned off.

is to use <!--。。。 --You can put the following three sentences together.

<listener classname= "Org.apache.catalina.core.JreMemoryLeakPreventionListener"/> <listener classname= "or G.apache.catalina.mbeans.globalresourceslifecyclelistener "/> <listener classname=" Org.apache.catalina.core . Threadlocalleakpreventionlistener "/>

http://blog.csdn.net/zhuhezan/article/details/6882089

Description

Basicdatasource ' s method close () doesn ' t deregister JDBC driver. This causes PermGen memory leaks in Web server environments, during context reloads. For example, using Tomcat 6.0.26 with spring, and Basicdatasource declared in spring context, there is a message printed a T Web application Reload:

SEVERE:A Web application registered the JBDC driver [Com.mysql.jdbc.Driver] but failed to unregister it when The Web application was stopped. To prevent a memory leak, the JDBC Driver have been forcibly unregistered.

I was able to the fix it by overriding Close method the This is:

Extends Basicdatasource {    @Override    throws SQLException {        Drivermanager.deregisterdriver ( Drivermanager.getdriver (URL));        super.close ();}} 

But I think it should is probably the default behavior of Basicdatasource. Or perhaps there should is some flag/setting on Basicdatasource, named ' Deregisterdriveratclose ' or so.

https://issues.apache.org/jira/browse/DBCP-332

Registered the JBDC driver [Oracle.jdbc.OracleDriver] but failed-unregister it when the Web application was stopped. (GO)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.