mysql-connector-java設定方法
問題:java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
1. 放到<web app>\WEB-INF\lib
ps.此方法容易造成:
Mar 02, 2015 8:40:45 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: The web application [] registered the JDBC 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.
Mar 02, 2015 8:40:45 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak.
2. 用eclipse build path
add your folder to the build path
Project Properties -> Java build path
Libraries -> add external lib or any other solution to add your files/folder
add your build path to deployment Assembly (reference)
Project Properties -> Deployment Assembly
Add -> Java Build Path Entries
You should now see the list of libraries on your build path that you can specify for inclusion into your finished WAR.
ps.此方法的Java build path與deployment Assembly兩者同時設定才能生效,且jar檔會自動包在war檔內
3. 放到 Tomcat 7.0\lib
或/usr/share/tomcat7/lib/ & chmod 644 mysql-connector-java-5.1.34-bin.jar
1. 放到<web app>\WEB-INF\lib
ps.此方法容易造成:
Mar 02, 2015 8:40:45 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: The web application [] registered the JDBC 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.
Mar 02, 2015 8:40:45 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak.
2. 用eclipse build path
add your folder to the build path
Project Properties -> Java build path
Libraries -> add external lib or any other solution to add your files/folder
add your build path to deployment Assembly (reference)
Project Properties -> Deployment Assembly
Add -> Java Build Path Entries
You should now see the list of libraries on your build path that you can specify for inclusion into your finished WAR.
ps.此方法的Java build path與deployment Assembly兩者同時設定才能生效,且jar檔會自動包在war檔內
3. 放到 Tomcat 7.0\lib
或/usr/share/tomcat7/lib/ & chmod 644 mysql-connector-java-5.1.34-bin.jar
留言
張貼留言