为了账号安全,请及时绑定邮箱和手机立即绑定

包依赖异常

老师,跑测试的时候报错: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 回答

同学好,这得和你的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>


0 回复 有任何疑惑可以回复我~
#1

ZMS123 提问者

非常感谢!
2018-05-30 回复 有任何疑惑可以回复我~

我昨天也是这个问题,我一顿乱整,已解决。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>


0 回复 有任何疑惑可以回复我~
#1

ZMS123 提问者

咱俩一样,我的也解决了
2018-06-02 回复 有任何疑惑可以回复我~
#2

小熊熊HELLO 回复 ZMS123 提问者

???秒回
2018-06-02 回复 有任何疑惑可以回复我~
<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>


0 回复 有任何疑惑可以回复我~
我解决了。在pom.xml中加入jar包,c3p0需要。。。
<dependency>
   <groupId>com.mchange</groupId>
   <artifactId>mchange-commons-java</artifactId>
   <version>0.2.3.4</version>
</dependency>


0 回复 有任何疑惑可以回复我~
#1

ZMS123 提问者

把你的pom贴一下呗?我的加了这个依赖还是报错啊
2018-05-28 回复 有任何疑惑可以回复我~

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

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

包依赖异常

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信