Caused by: java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in file [D:\HS_Test\WebRoot\WEB-INF\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(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:
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.FileSystemXmlApplicationContext.
< init > (FileSystemXmlApplicationContext.java: 93 )
at org.springframework.context.support.FileSystemXmlApplicationContext.
< init > (FileSystemXmlApplicationContext.java: 77 )
at org.springframework.context.support.FileSystemXmlApplicationContext.
< init > (FileSystemXmlApplicationContext.java: 67 )


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

你可能感兴趣的:(Java)