Maven 配置Spring-Hibernate数据库连接池时启动错误

Error Log  如下所示:找不到驱动类[本身依赖是加了驱动的]

org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'com.mysql.jdbc.Driver'

    at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1429)
    at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)
    at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
    at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81)
    at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:76)
    at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2006)

    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1289)

解决方案:

使用数据库连接池时,tomecate的lib目录下放入使用的mysql驱动包(如:mysql-connector-java-5.1.16.jar),重新启动就OK。

你可能感兴趣的:(maven,connection-pool)