java.lang.AbstractMethodError: org.mybatis.spring.transaction.SpringManagedTransaction.getTimeout()L

https://www.cnblogs.com/molao-doing/p/6056380.html

在MAVEN项目里面,在整合spring和mybatis在执行数据库操作的时候报出了:

java.lang.AbstractMethodError: org.mybatis.spring.transaction.SpringManagedTransaction.getTimeout()L错误

在网上搜的大多说是jar包版本不兼容的问题。但想想,不应该啊,这是他们原有的系统,难道有做过升级吗,最后尝试着把版本升级了下,还真是版本兼容出了问题。

复制代码
 1 Exception in thread "main" java.lang.AbstractMethodError: org.mybatis.spring.transaction.SpringManagedTransaction.getTimeout()Ljava/lang/Integer;
 2 at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:85)
 3 at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:62)
 4 at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:325)
 5 at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
 6 at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
 7 at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83)
 8 at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148)
 9 at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)
10 at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:77)
11 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
12 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
13 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
14 at java.lang.reflect.Method.invoke(Unknown Source)
15 at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:358)
16 at com.sun.proxy.$Proxy8.selectOne(Unknown Source)
复制代码


更正后的依赖关系为:

复制代码
<properties>
    <springframework.version>3.2.9.RELEASE</springframework.version>
    <mybatis-spring.version>1.3.0</mybatis-spring.version>
    <mybatis.version>3.3.0</mybatis.version>
    <mysql-connector-java.version>5.1.37</mysql-connector-java.version>
</properties>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-aop</artifactId>
    <version>${springframework.version}</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-beans</artifactId>
    <version>${springframework.version}</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
    <version>${springframework.version}</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context-support</artifactId>
    <version>${springframework.version}</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-web</artifactId>
    <version>${springframework.version}</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-webmvc</artifactId>
    <version>${springframework.version}</version>
</dependency>
<dependency>
    <groupId>org.mybatis</groupId>
    <artifactId>mybatis-spring</artifactId>
    <version>${mybatis-spring.version}</version>
</dependency>
复制代码

大致导致这个问题的原意就是版本的问题, 将上面的mybatis-spring版本改为1.3.0即可.具体细节还有待去发现,

可参考http://www.mybatis.org/spring/zh/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值