java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

Thrown when an application attempts to load a class by string name using:
1. The forName method in the Class class.
2. The findSystemClass method in the ClassLoader class.
3. The loadClass method in the ClassLoader class.

Common causes of exceptions:

1 The required support class library is misplaced and not placed in the classpath (CLASSPATH environment variable).
2 Duplicate class libraries are used and the versions are inconsistent. Causes the lower version to be used preferentially.
3 The class name is wrong, generally when Class.forName is used, the class name is manually specified.
4 The pure JAVA driver package is not imported.
Suggested solution:
1 Make sure your class library is under the CLASSPATH of the system. If it is Tomcat, it can be placed under the tomcat/lib/ directory.
2 Delete duplicate libraries and keep only the latest ones.
 
 
Solved with the first method
Source https://blog.csdn.net/yinxjz/article/details/51332478

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325295572&siteId=291194637