1. 程式人生 > >c3p0連接數據庫報錯

c3p0連接數據庫報錯

com class welcom lang sed .com 到來 net 連接不上

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: com/mchange/v2/ser/Indirector
    at cn.itcast.jdbc.JdbcUtils.<clinit>(JdbcUtils.java:17)
    at dao.DataBase1.<init>(DataBase1.java:18)
    at service.Service.<init>(Service.java:9)
    at UI.Welcome.<init>(Welcome.java:23)
    at UI.Welcome$
1.run(Welcome.java:39) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$500(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Caused by: java.lang.ClassNotFoundException: com.mchange.v2.ser.Indirector at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ...
19 more

導入外包的文件夾要建在項目下,不要建在src下,這個錯誤是因為導入的jar包導錯了,找不到來源,連接不上數據庫。

技術分享圖片

這裏沒有導到mchange-commons-0.2.jar這個包,加了這個包之後就好了。

c3p0連接數據庫報錯