首页 > 代码库 > NoClassDefFoundError:....KeyedObjectPoolFactory

NoClassDefFoundError:....KeyedObjectPoolFactory

java配置JDBC时,用连接池出现错误NoClassDefFoundError: org/apache/commons/pool/KeyedObjectPoolFactory

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/pool/KeyedObjectPoolFactory

at JDBCtools.JDBCUtils.<clinit>(JDBCUtils.java:13)

at JDBCtools.Test.main(Test.java:7)

Caused by: java.lang.ClassNotFoundException: org.apache.commons.pool.KeyedObjectPoolFactory

at java.net.URLClassLoader.findClass(URLClassLoader.java:381)

at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)

at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

... 2 more


解决方法:分析上面的错误,是缺少相应的类文件:需要下载并添加一个叫common-pool的jar包。


本文出自 “8231977” 博客,请务必保留此出处http://8241977.blog.51cto.com/8231977/1885333

NoClassDefFoundError:....KeyedObjectPoolFactory