org/apache/commons/pool/impl/GenericObjectPool 的解決方法
阿新 • • 發佈:2019-01-07
- 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 'jdbc' defined
- Caused by: java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool
- at java.lang.Class.getDeclaredConstructors0(Native Method)
- at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
- at java.lang.Class.getConstructor0(Unknown Source)
- at java.lang.Class.getDeclaredConstructor(Unknown Source)
- at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:54)
- at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:752)
- at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:717)
- at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:386)
- at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)
- at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)
- at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)
- at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
- at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:291)
- at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
- at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:122)
- at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:66)
- 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