spring整合hibernate时出错(已经导入commons-dbcp2-2.1.1.jar和commons-pool2-2.1.jar)
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了spring整合hibernate时出错(已经导入commons-dbcp2-2.1.1.jar和commons-pool2-2.1.jar)相关的知识,希望对你有一定的参考价值。
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.apache.commons.pool2.impl.GenericObjectPool.setTestOnCreate(Z)V
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:472)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
at Test.TestSpringHibernate.main(TestSpringHibernate.java:18)
Caused by: java.lang.NoSuchMethodError: org.apache.commons.pool2.impl.GenericObjectPool.setTestOnCreate(Z)V
以上是关于spring整合hibernate时出错(已经导入commons-dbcp2-2.1.1.jar和commons-pool2-2.1.jar)的主要内容,如果未能解决你的问题,请参考以下文章