包依赖异常

来源:2-4 表设计与实体类的创建

ZMS123

2018-05-28 17:38

老师,跑测试的时候报错:Method com/mchange/v2/c3p0/impl/NewProxyPreparedStatement.isClosed()Z is abstract c3p由<groupId>c3p0</groupId>artifactId>c3p0</artifactId>
<version>0.9.1.2</version>换成oupId>com.mchange</groupId>
<artifactId>c3p0</artifactId><version>0.9.5.2</version>也不对



写回答 关注

5回答

  • 翔仔
    2018-05-28 23:41:28
    已采纳

    同学好,这得和你的Spring版本严格对应起来,否则isClosed这个方法没有被实现,也就是c3p0版本不相符,你可以看看你的maven dependencies里的jar有没有重复的c3p0.

    下面是我的pom

    <?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">	<modelVersion>4.0.0</modelVersion>	<groupId>com.imooc</groupId>	<artifactId>o2o</artifactId>	<version>0.0.1-SNAPSHOT</version>	<packaging>war</packaging>	<name>o2o</name>	<description>Demo project for Spring Boot</description>	<parent>		<groupId>org.springframework.boot</groupId>		<artifactId>spring-boot-starter-parent</artifactId>		<version>1.5.8.RELEASE</version>		<relativePath /> <!-- lookup parent from repository -->	</parent>	<properties>		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>		<java.version>1.8</java.version>	</properties>	<dependencies>		<!-- https://mvnrepository.com/artifact/ch.qos.logback/logback-classic -->		<dependency>			<groupId>ch.qos.logback</groupId>			<artifactId>logback-classic</artifactId>		</dependency>		<!-- Servlet web -->		<dependency>			<groupId>javax.servlet</groupId>			<artifactId>javax.servlet-api</artifactId>		</dependency>		<!-- json解析 -->		<dependency>			<groupId>com.fasterxml.jackson.core</groupId>			<artifactId>jackson-databind</artifactId>		</dependency>		<!-- Map工具类 对标准java Collection的扩展 spring-core.jar需commons-collections.jar -->		<dependency>			<groupId>commons-collections</groupId>			<artifactId>commons-collections</artifactId>		</dependency>		<!-- 数据库 -->		<dependency>			<groupId>mysql</groupId>			<artifactId>mysql-connector-java</artifactId>		</dependency>		<!-- 图片处理 -->		<!-- https://mvnrepository.com/artifact/net.coobird/thumbnailator -->		<dependency>			<groupId>net.coobird</groupId>			<artifactId>thumbnailator</artifactId>			<version>0.4.8</version>		</dependency>		<!-- https://mvnrepository.com/artifact/com.github.penggle/kaptcha -->		<dependency>			<groupId>com.github.penggle</groupId>			<artifactId>kaptcha</artifactId>			<version>2.3.2</version>		</dependency>		<dependency>			<groupId>commons-fileupload</groupId>			<artifactId>commons-fileupload</artifactId>			<version>1.3.2</version>		</dependency>		<!-- redis客户端:Jedis -->		<dependency>			<groupId>redis.clients</groupId>			<artifactId>jedis</artifactId>		</dependency>		<dependency>			<groupId>org.mybatis.spring.boot</groupId>			<artifactId>mybatis-spring-boot-starter</artifactId>			<version>1.3.1</version>		</dependency>		<!-- 二维码相关 -->		<!-- https://mvnrepository.com/artifact/com.google.zxing/javase -->		<dependency>			<groupId>com.google.zxing</groupId>			<artifactId>javase</artifactId>			<version>3.3.0</version>		</dependency>		<!-- https://mvnrepository.com/artifact/org.quartz-scheduler/quartz -->		<dependency>			<groupId>org.quartz-scheduler</groupId>			<artifactId>quartz</artifactId>			<version>2.3.0</version>		</dependency>		<dependency>			<groupId>org.springframework</groupId>			<artifactId>spring-context-support</artifactId>		</dependency>		<dependency>			<groupId>org.springframework.boot</groupId>			<artifactId>spring-boot-starter-web</artifactId>		</dependency>		<dependency>			<groupId>org.springframework.boot</groupId>			<artifactId>spring-boot-starter-test</artifactId>			<scope>test</scope>		</dependency>		<!-- https://mvnrepository.com/artifact/com.alibaba/fastjson -->		<dependency>			<groupId>com.alibaba</groupId>			<artifactId>fastjson</artifactId>			<version>1.2.45</version>		</dependency>		<!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp -->		<dependency>			<groupId>com.squareup.okhttp3</groupId>			<artifactId>okhttp</artifactId>			<version>3.9.1</version>		</dependency>	</dependencies>	<build>		<plugins>			<plugin>				<groupId>org.springframework.boot</groupId>				<artifactId>spring-boot-maven-plugin</artifactId>			</plugin>		</plugins>	</build></project>


    ZMS123

    非常感谢!

    2018-05-30 17:43:32

    共 1 条回复 >

  • 小熊熊HELLO
    2018-06-02 11:43:44

    我昨天也是这个问题,我一顿乱整,已解决。pom:

    <dependencies>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-web</artifactId>
      </dependency>
          <dependency>
              <groupId>org.mybatis.spring.boot</groupId>
              <artifactId>mybatis-spring-boot-starter</artifactId>
              <version>1.3.1</version>
          </dependency>

      <dependency>
         <groupId>mysql</groupId>
         <artifactId>mysql-connector-java</artifactId>
      </dependency>

      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-test</artifactId>
         <scope>test</scope>
      </dependency>

          <dependency>
              <groupId>com.mchange</groupId>
              <artifactId>c3p0</artifactId>
              <version>0.9.5.2</version>
          </dependency>

      </dependencies>


    小熊熊HEL... 回复ZMS123

    ???秒回

    2018-06-02 11:49:45

    共 2 条回复 >

  • 慕九州5495211
    2018-05-28 21:03:06
    <dependencies>
       <dependency>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-web</artifactId>
       </dependency>
       <dependency>
          <groupId>org.mybatis.spring.boot</groupId>
          <artifactId>mybatis-spring-boot-starter</artifactId>
          <version>1.3.1</version>
       </dependency>
    
       <dependency>
          <groupId>mysql</groupId>
          <artifactId>mysql-connector-java</artifactId>
       </dependency>
    
       <dependency>
          <groupId>com.mchange</groupId>
          <artifactId>c3p0</artifactId>
          <version>0.9.2.1</version>
       </dependency>
    
       <dependency>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-test</artifactId>
          <scope>test</scope>
       </dependency>
    
       <dependency>
          <groupId>com.mchange</groupId>
          <artifactId>mchange-commons-java</artifactId>
          <version>0.2.3.4</version>
       </dependency>
    
    </dependencies>


  • 慕九州5495211
    2018-05-28 18:26:17
    我解决了。在pom.xml中加入jar包,c3p0需要。。。
    <dependency>
       <groupId>com.mchange</groupId>
       <artifactId>mchange-commons-java</artifactId>
       <version>0.2.3.4</version>
    </dependency>


    ZMS123

    把你的pom贴一下呗?我的加了这个依赖还是报错啊

    2018-05-28 18:35:34

    共 1 条回复 >

  • 慕九州5495211
    2018-05-28 18:05:13

    一样解决了告诉我一下。。

SpringBoot+MyBatis搭建迷你小程序

SpringBoot+MyBatis搭建小程序后台

91500 学习 · 621 问题

查看课程

相似问题