c3p0连接数据库报错
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这个包,加了这个包之后就好了。