| Author |
DBC Driver error
|
Daniel Sagayaraj
Ranch Hand
Joined: Mar 15, 2010
Posts: 32
|
|
Dear Friends,
When i start my tomcat server i get this error.What is it.
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 has been forcibly unregistered.
|
 |
Tim Holloway
Saloon Keeper
Joined: Jun 25, 2001
Posts: 14568
|
|
Yamuna Daniel wrote:
Dear Friends,
When i start my tomcat server i get this error.What is it.
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 has been forcibly unregistered.
I suspect that the webapp isn't properly releasing all of its database connections when it's done using them.
|
Customer surveys are for companies who didn't pay proper attention to begin with.
|
 |
Donald Winston
Greenhorn
Joined: Jul 16, 2010
Posts: 16
|
|
I have this problem too;
SEVERE: A web application registered the JBDC driver [org.postgresql.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
I'm using the connection pooling facility that comes with tomcat. It does not make sense for the programmer to have to explicitly unregister the driver.
Tomcat should do this. There's no method in the DataSource class to unregister a driver.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56529
|
|
|
No, you don't have to unregister the driver. But perhaps the system can't do it because there are connections that have not been properly returned to the pool?
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Donald Winston
Greenhorn
Joined: Jul 16, 2010
Posts: 16
|
|
|
I haven't attempted to access the database yet in my code. I was just looking at the log to see if my web.xml and context.xml file information caused any problems. All I have done so far is do a lookup on the named data sources.
|
 |
Donald Winston
Greenhorn
Joined: Jul 16, 2010
Posts: 16
|
|
This the only thing I've done so far:
public static void setDataSource(String name) throws NamingException {
Context context = new InitialContext();
context = (Context)context.lookup("java:/env/com/env");
dataSource = (DataSource)context.lookup(name);
}
I keep the datasource around in a singleton class and fetch a connection when necessary in various places in my webapp. I have yet to do this so there are no connections requested by me. But since there's a pool of connections created by tomcat's DBCP tomcat should take care of releasing them when it shuts down.
|
 |
Donald Winston
Greenhorn
Joined: Jul 16, 2010
Posts: 16
|
|
|
I use the shutdown.sh script to stop tomcat. It should stop my webapp for me and close all the pooled connections my app has created.
|
 |
 |
|
|
subject: DBC Driver error
|
|
|