Cannot find class [org.apache.commons.dbcp.BasicDataSource]

S2SH项目启动时,提示如下异常:

Cannotfindclass[org.apache.commons.dbcp.BasicDataSource]

Spring配置文件如下:

<?xmlversion="1.0"encoding="UTF-8"?>

<!DOCTYPEbeansPUBLIC"-//SPRING//DTDBEAN//EN""http://www.springframework.org/dtd/spring-beans.dtd">

<beansdefault-autowire="autodetect">

<beanid="loginAction"class="com.test.action.usermanager.LoginAction"/>

<beanid="dataSource"class="org.apache.commons.dbcp.BasicDataSource"destroy-method="close">

<propertyname="driverClassName"value="oracle.jdbc.driver.OracleDriver"></property>

<propertyname="url"value="jdbc:oracle:thin:@localhost:1521:oracle"></property>

<propertyname="username"value="TestUser"></property>

<propertyname="password"value="TestUser"></property>

</bean>

</beans>

原因是缺少如下两个jar包:

commons-dbcp.jar、commons-pool.jar

相关推荐