Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DBC Driver error

 
Daniel Sagayaraj
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Pie
Posts: 18013
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Donald Winston
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Donald Winston
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic