Class 'com.mchange.v2.c3p0.ComboPooledDataSource' not found

13,499

Solution 1

First of all, I suggest to use the same version of namespaces. In your case take 2.5 or 3.0. Or even current version But do not use different versions in same project.

About your first problem:

Class 'com.mchange.v2.c3p0.ComboPooledDataSource' not found

Have you included in your classpath 'c3p0-0.9.1.2.jar'?

In second case you should include to classpath 'spring-jdbc-x.x.jar' depending the version of Spring you decide to use.

Solution 2

Class 'com.mchange.v2.c3p0.ComboPooledDataSource' not found

I resolve this error by copying the c3p0-0.9.1.2.jar file to the WEB-INF/lib folder.c3p0-0.9.1.2.jar file was founded by google searching

Share:
13,499
John Smith
Author by

John Smith

Updated on June 26, 2022

Comments

  • John Smith
    John Smith about 2 years

    Where do I suppose to indicate class dependency when I got error messages:

    • Class 'com.mchange.v2.c3p0.ComboPooledDataSource' not found
    • Class 'org.springframework.jdbc.datasource.DataSourceTransactionManager' not found

    jdbc-context.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:tx="http://www.springframework.org/schema/tx"
        xmlns:context="http://www.springframework.org/schema/context"
        xmlns:p="http://www.springframework.org/schema/p"
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
            http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
            http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
    
        <context:property-placeholder location="/WEB-INF/spring.properties" />
    
        <tx:annotation-driven transaction-manager="transactionManager" />
    
        <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
            destroy-method="close"
            p:driverClass="${jdbc.driverClassName}"
            p:jdbcUrl="${jdbc.url}"
            p:user="${jdbc.username}"
            p:password="${jdbc.password}"
            p:acquireIncrement="5"
            p:idleConnectionTestPeriod="60"
            p:maxPoolSize="100"
            p:maxStatements="50"
            p:minPoolSize="10" />
    
        <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager" p:dataSource-ref="dataSource" />
    </beans>