`
bigtree2006
  • 浏览: 47251 次
  • 性别: Icon_minigender_1
  • 来自: 河南
社区版块
存档分类
最新评论

org/apache/commons/pool/impl/GenericObjectPool异常

    博客分类:
  • java
阅读更多

org/apache/commons/pool/impl/GenericObjectPool异常

前段时间在做一个Spring2.0+Struts1.2练习的时候遇到的一个问题

问题

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)

 

 

 

原因:
   找不到 Caused by: java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool
就是Apache所提供的基本对象池。

解决:

   到这里
http://commons.apache.org/downloads/download_pool.cgi下载包,然后,把里面的commons-pool-x.jar复制到myEclipse的Referenced Libraries下.

   MyEclipse工具在添加Spring支持的时候,少加一个包 commons-pool-1.x.jar,补上去问题解决(放到\WebRoot\WEB-INF\lib目录下)。

分享到:
评论

相关推荐

    commons-pool.jar

    当myeclipse出现java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool错误时下载该jar包放在lib下 即可!!

    commons-poo ljar包

    import org.apache.commons.pool2.impl.GenericObjectPool; import org.apache.commons.pool2.impl.GenericObjectPoolConfig; import org.apache.commons.pool2.PooledObjectFactory; import org.apache.commons....

    commons-pool2-2.6.0-bin.zip

    2. **对象池实现**:`org.apache.commons.pool2.impl.GenericObjectPool` 和 `org.apache.commons.pool2.impl.GenericKeyedObjectPool` 是基础的对象池实现,它们可以管理任意类型的对象。 3. **对象生命周期管理**...

    S2SH整合报错

    该错误信息表明,在初始化Spring容器时遇到了问题,具体是在创建名为`dataSource`的Bean时失败,进一步的原因是找不到`org.apache.commons.pool.impl.GenericObjectPool`类的定义。这个类是Apache Commons Pool库中...

    commons-pool-1.4.rar

    &lt;bean id="dataSource" class="org.apache.commons.pool.impl.GenericObjectPool"&gt; &lt;property name="maxActive" value="8"/&gt; &lt;property name="maxIdle" value="4"/&gt; &lt;property name="minIdle" value="1"/&gt; ...

    jedis-2.9.0和commons-pool2

    import org.apache.commons.pool2.impl.GenericObjectPoolConfig; public class JedisPoolExample { private static JedisPool pool; static { // 配置对象池参数 GenericObjectPoolConfig config = new ...

    commons-logging-1.0.4.jar,commons-codec-1.3

    在`org.apache.commons.pool.jar`中,你可以找到`org.apache.commons.pool.impl.GenericObjectPool`这样的类,它是对象池的基类,提供了对象的创建、借用、归还和回收等功能。这个库在数据库连接池(如C3P0、DBCP)...

    SSH整合项目中容易出现的错误

    nested exception is java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool 这个错误是由于Spring无法加载dataSource bean,导致ApplicationContext无法启动。解决方法是检查...

    apache对象池的实现

    import org.apache.commons.pool2.impl.GenericObjectPool; import org.apache.commons.pool2.impl.GenericObjectPoolConfig; public class StringPool { private static class StringWrapper implements Poolable...

    spring mvc 项目错误,和一些配置

    java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool - **原因**:表示类路径中缺少Apache Commons Pool的依赖。 - **解决办法**: - 添加Apache Commons Pool的依赖至项目中。 - ...

    RabbitMQ客户端连接池实现代码可直接复制项目中使用

    import org.apache.commons.pool2.impl.GenericObjectPool; import org.apache.commons.pool2.impl.GenericObjectPoolConfig; public class MQHelper { private static final ObjectPool&lt;ConnectionFactory&gt; ...

    java,redis,jedis操作工具类,自己写的简易 demo

    常见的Jedis连接池实现是`org.apache.commons.pool2.impl.GenericObjectPool`。配置包括: - `maxTotal`: 最大连接数。 - `maxIdle`: 最大空闲连接数。 - `minIdle`: 最小空闲连接数。 - `testOnBorrow`: 借出...

    jedis使用指南

    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 */ ...

Global site tag (gtag.js) - Google Analytics