十万火急!版本不兼容问题

十万火急!版本不兼容问题

接上个问题,因为创建是应该是com/name/et/dao,运行后又出现错误

http://img1.sycdn.imooc.com//climg/5c90c90600018cf213660768.jpg

这是配置文件:

<?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">
    <parent>
        <artifactId>easytravel</artifactId>
        <groupId>com.eurasia</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>et_service</artifactId>
    <packaging>jar</packaging>

    <dependencies>
        <!--Mybatis依赖-->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.47</version>
        </dependency>
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis</artifactId>
            <version>3.4.4</version>
        </dependency>
        <!--Spring依赖-->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>4.3.7.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>4.3.7.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>4.3.7.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>4.3.7.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>1.8.0</version>
        </dependency>
        <!--mybatis 与 spring 整合依赖-->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>4.3.7.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>4.3.7.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis-spring</artifactId>
            <version>1.3.2</version>
        </dependency>
    </dependencies>
</project>


正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

6回答
好帮手慕阿莹 2019-04-15 17:47:17

错误原因是 mybatis-spring 包版本问题,那么要么换mybatis或者spring包的版本,要么换整合包的版本。

spring包是4.3.7版本。mybatis版本是3.4.2    整合的包使用1.3.0 试试

遇到问题可以依次试试不同的版本,直到可以用。

祝学习愉快



提问者 SpadeDavid 2019-04-15 15:51:19

http://img1.sycdn.imooc.com//climg/5cb437cf0001a3d105300521.jpg

版本是一致的,但是还是现实不兼容,到底是为什么呢?

chrismorgen 2019-03-20 10:54:22

你好同学,检查了你的pom文件是没有问题的,建议你检查下一下下图标的两个jar包版本是否一致。祝学习愉快~

http://img1.sycdn.imooc.com//climg/5c91ab3e00019b1d04980397.jpg

  • 提问者 SpadeDavid #1
    还是不行,根本解决不了
    2019-04-15 15:50:03
提问者 SpadeDavid 2019-03-19 19:11:51
<?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">
    <parent>
        <artifactId>easytravel</artifactId>
        <groupId>com.eurasia</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>et_service</artifactId>
    <packaging>jar</packaging>

    <dependencies>
        <!-- Mybatis -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.44</version>
        </dependency>
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis</artifactId>
            <version>3.4.4</version>
        </dependency>
        <!-- Spring -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>4.0.2.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>4.0.2.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>4.0.2.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>4.0.2.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>1.8.0</version>
        </dependency>
        <!-- 事务 -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>4.0.2.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>4.0.2.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis-spring</artifactId>
            <version>1.3.1</version>
        </dependency>
    </dependencies>
  </project>

http://img1.sycdn.imooc.com//climg/5c90ce7300014d4513160492.jpg

chrismorgen 2019-03-19 19:04:55

改完之后需要点击下图中右下角标记的选项,该选项是将jar包依赖到项目中,祝学习愉快~

http://img1.sycdn.imooc.com//climg/5c90cca000013ca105420217.jpg

  • 提问者 SpadeDavid #1
    我修改了,也impor了,但是还是报错怎么办
    2019-03-19 19:08:42
  • 提问者 SpadeDavid #2
    为什么版本老是报错,有什么解决办法吗
    2019-03-19 19:40:19
chrismorgen 2019-03-19 19:01:14

你好同学,建议你将pom文件中的版本号改为和老师一样的版本号,这样就不会出现问题了,祝学习愉快~

  • 提问者 SpadeDavid #1
    改完之后还需要做什么操作吗?我之前修改的和老师的版本号一致,但是运行后还是会报错,改完需要什么后续操作
    2019-03-19 19:02:57
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
SSM主流框架入门与综合项目实战2018版
  • 参与学习           人
  • 提交作业       205    份
  • 解答问题       4317    个

Java中非常实用的SSM整合开发内容,从Spring开始,到MyBaits的进阶内容,再到SpringMVC的应用,最后是SSM整合开发案例,逐步深入,助你成长为一名Java工程师!

了解课程
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师