当前位置: 首页 > 工具软件 > Commons Pool > 使用案例 >

org/apache/commons/pool/impl/GenericObjectPool 的解决方法

洪梓
2023-12-01
  1. log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext).
  2. log4j:WARN Please initialize the log4j system properly.
  3. Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdbc' defined in class path resource [org/coffee/ssh/spring/applicationContext.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool
  4. Caused by: java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool
  5. at java.lang.Class.getDeclaredConstructors0(Native Method)
  6. at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
  7. at java.lang.Class.getConstructor0(Unknown Source)
  8. at java.lang.Class.getDeclaredConstructor(Unknown Source)
  9. at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:54)
  10. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:752)
  11. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:717)
  12. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:386)
  13. at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)
  14. at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)
  15. at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)
  16. at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
  17. at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:291)
  18. at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
  19. at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:122)
  20. at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:66)
  21. at org.coffee.ssh.Test.main(Test.java:17)

原因是工具myEclipse在建立SessionFactory的时候,少加一个包 commons-pool-1.3.jar 补上去问题解决。

下载apache 的 commons-pool/1.3/commons-pool-1.3.jar

该包下载地址
http://mirrors.ibiblio.org/pub/mirrors/maven2/commons-pool/commons-pool/1.3/commons-pool-1.3.jar
加到classpath里 或者 加到工程

 类似资料: