-
FEATURED COMPONENTS
First time here? Check out the FAQ!
My god!! I have tried so many times to modify something to overcome the error, but I failed at last ...
Can anyone help me to solve the problem?? I want to integrate ZK with spring and hibernate, but when I launch the tomcat server, the error appers: (I don't know why the session can not be created)
My server is Tomcat6.0, and database is mysql 5.0.
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'factory' defined in ServletContext resource [/WEB-INF/ApplicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.apache.commons.pool.impl.GenericObjectPool: method <init>()V not found
Caused by: java.lang.NoSuchMethodError: org.apache.commons.pool.impl.GenericObjectPool: method <init>()V not found
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:795)
the Content of ApplicationContext.xml is:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="url">
<value>jdbc:mysql://localhost:3306/deri</value>
</property>
<property name="username">
<value>root</value>
</property>
<property name="password">
<value>deri</value>
</property>
<property name="maxActive">
<value>100</value>
</property>
<property name="maxIdle">
<value>30</value>
</property>
<property name="maxWait">
<value>1000</value>
</property>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource"><ref bean="dataSource"/></property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>ie/deri/lion2/backend/bean/Sensor.hbm.xml</value>
</list>
</property>
</bean>
<bean id="sensorDao" class="ie.deri.lion2.backend.daoImpl.SensorDAOImpl" singleton="true">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="sensorService" class="ie.deri.lion2.backend.serviceImpl.SensorServiceImpl">
<property name="sensorDAO">
<ref bean="sensorDao"/>
</property>
</bean>
</beans>
The problem is that Spring could not create "dataSource" bean for problem with dbcp definition and in particular org.apache.commons.pool.impl.GenericObjectPool:
Do ypu add the Jakarta Commons pool to your classpath ?
Also check http://longlog.wordpress.com/2007/01/22/spring-dbcp/
Asked: 2010-03-18 09:42:07 +0800
Seen: 920 times
Last updated: Mar 18 '10