Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 类别';com.mchange.v2.c3p0.ComboPooledDataSource';找不到_Java_Spring Mvc_Sts Springsourcetoolsuite - Fatal编程技术网

Java 类别';com.mchange.v2.c3p0.ComboPooledDataSource';找不到

Java 类别';com.mchange.v2.c3p0.ComboPooledDataSource';找不到,java,spring-mvc,sts-springsourcetoolsuite,Java,Spring Mvc,Sts Springsourcetoolsuite,当我收到错误消息时,我应该在哪里指示类依赖关系: 找不到类“com.mchange.v2.c3p0.ComboPooledDataSource” 未找到类“org.springframework.jdbc.datasource.DataSourceTransactionManager” jdbc context.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframewor

当我收到错误消息时,我应该在哪里指示类依赖关系:

  • 找不到类“com.mchange.v2.c3p0.ComboPooledDataSource”
  • 未找到类“org.springframework.jdbc.datasource.DataSourceTransactionManager”
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>

首先,我建议使用相同版本的名称空间。在你的情况下,采取2.5或3.0。 甚至 但不要在同一个项目中使用不同的版本

关于您的第一个问题:

找不到类“com.mchange.v2.c3p0.ComboPooledDataSource”

您是否已将“c3p0-0.9.1.2.jar”包含在类路径中

在第二种情况下,根据您决定使用的spring版本,您应该将“spring-jdbc-x.x.jar”包含到类路径中

Class 'com.mchange.v2.c3p0.ComboPooledDataSource' not found
我通过将
c3p0-0.9.1.2.jar
文件复制到
WEB-INF/lib文件夹来解决此错误。c3p0-0.9.1.2.jar
文件是通过谷歌搜索创建的