Server is not connected. Deploy is not available

Recommended for you: Get network issues from WhatsUp Gold. Not end users.

     Run the web project in Intellij IDEA, dished out a big exception. Look carefully at the next console, found the following key information:

Artifact * (project name): Server is not connected. Deploy is not available


Org.apache.catalina.loader.WebappClassLoader.clearReferencesJdbc The web application [* (project name)] registered the JDBC driver [com.alibaba.druid.proxy.DruidDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.

I do not know where the problem lies, Google once, found the solution, as follows:

A
A web application is registered with the JBDC driver [com.mysql.jdbc.Driver], but failed to stop the Web application log. In order to prevent memory leaks, the JDBC driver has been forced to register.
The solution :
The server keeps running state, the redeploy project, it is abnormal,
To stop and redeploy, can be [first Tomcat kill off, etc. process is completely dead, and restart the]
Two.
Tomcat 6.0.33 startup, error
he web application [/aaa] registered the JDBC driver [com.ibm.db2.jcc.DB2Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. 

In the online search that, is generally applied to the SSH portfolio project will be out this problem, mostly is the Hibernate version of the problem.

The reason is that Hibernate3.2.3 already contains hibernate-annotations-3.2.1.GA.jar, I re joined the Annotation.jar jar file, if the general use integrated development environment, such as Eclipse, MyEclipse, he will own hibernate framework of the jar package, if we add the same framework (but different version) jar package, it is easy to cause conflict [this method does not test, specific removed which packets, don't know. . . ]
Three.
It is found the development environment of Tom is 6.0.20, and the error of production environment for 6.0.29 (6.0.24, 6.0.26 according to the investigation will appear this problem) and reinstall tomcat6.0.20 to solve this problem, Tom if not higher than the 6.0.20, such as 6.0.18 [no test]
Four.
Warning use the configure data source Sping org.apache.commons.dbcp.BasicDataSource
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. 
The problem is the version of the problem of tomcat, this problem leads to Tomcat new detection mechanism, change the version of the problem can be solved, but it is not recommended, hire server is not you say change.
In fact, the root of the problem is the BasicDataSource, BasicDataSource close (a Bug).
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 at 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 has been forcibly unregistered. 
The above is the problem, the translation is not good, to see their own English.
Solution:
Inherit the org.apache.commons.dbcp.BasicDataSource rewrite close()
import java.sql.DriverManager; 
import java.sql.SQLException; 

import org.apache.commons.dbcp.BasicDataSource; 

public class FixedBasicDataSource extends BasicDataSource { 

@Override 
public <T> T unwrap(Class<T> iface) throws SQLException { 
  // TODO Auto-generated method stub 
  return null; 


@Override 
public boolean isWrapperFor(Class<?> iface) throws SQLException { 
  // TODO Auto-generated method stub 
  return false; 

@Override  
    public synchronized void close() throws SQLException {  
        DriverManager.deregisterDriver(DriverManager.getDriver(url));  
        super.close();  
    }  



Then replace the spring configuration file data source bean FixedBasicDataSource class [I use c3p0 database connection pool]

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Spark at February 28, 2014 - 3:18 PM