log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'DataSource' defined in class path resource [applicationContext.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2328)
at java.lang.Class.getConstructor0(Class.java:2640)
at java.lang.Class.getDeclaredConstructor(Class.java:1953)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:54)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:759)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:724)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:387)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:91)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:75)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:65)
at org.jzb.test.Test.main(Test.java:15)
相关推荐
当myeclipse出现java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool错误时下载该jar包放在lib下 即可!!
import org.apache.commons.pool2.impl.GenericObjectPool; import org.apache.commons.pool2.impl.GenericObjectPoolConfig; import org.apache.commons.pool2.PooledObjectFactory; import org.apache.commons....
2. **对象池实现**:`org.apache.commons.pool2.impl.GenericObjectPool` 和 `org.apache.commons.pool2.impl.GenericKeyedObjectPool` 是基础的对象池实现,它们可以管理任意类型的对象。 3. **对象生命周期管理**...
该错误信息表明,在初始化Spring容器时遇到了问题,具体是在创建名为`dataSource`的Bean时失败,进一步的原因是找不到`org.apache.commons.pool.impl.GenericObjectPool`类的定义。这个类是Apache Commons Pool库中...
<bean id="dataSource" class="org.apache.commons.pool.impl.GenericObjectPool"> <property name="maxActive" value="8"/> <property name="maxIdle" value="4"/> <property name="minIdle" value="1"/> ...
import org.apache.commons.pool2.impl.GenericObjectPoolConfig; public class JedisPoolExample { private static JedisPool pool; static { // 配置对象池参数 GenericObjectPoolConfig config = new ...
在`org.apache.commons.pool.jar`中,你可以找到`org.apache.commons.pool.impl.GenericObjectPool`这样的类,它是对象池的基类,提供了对象的创建、借用、归还和回收等功能。这个库在数据库连接池(如C3P0、DBCP)...
nested exception is java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool 这个错误是由于Spring无法加载dataSource bean,导致ApplicationContext无法启动。解决方法是检查...
import org.apache.commons.pool2.impl.GenericObjectPool; import org.apache.commons.pool2.impl.GenericObjectPoolConfig; public class StringPool { private static class StringWrapper implements Poolable...
java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool - **原因**:表示类路径中缺少Apache Commons Pool的依赖。 - **解决办法**: - 添加Apache Commons Pool的依赖至项目中。 - ...
import org.apache.commons.pool2.impl.GenericObjectPool; import org.apache.commons.pool2.impl.GenericObjectPoolConfig; public class MQHelper { private static final ObjectPool<ConnectionFactory> ...
常见的Jedis连接池实现是`org.apache.commons.pool2.impl.GenericObjectPool`。配置包括: - `maxTotal`: 最大连接数。 - `maxIdle`: 最大空闲连接数。 - `minIdle`: 最小空闲连接数。 - `testOnBorrow`: 借出...
import org.apache.commons.pool.impl.GenericObjectPool.Config; import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPool; import redis.clients.jedis.Transaction; /** * @author Teaey */ ...