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

在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/

时间: 2024-10-12 17:53:08

疑惑的 java.lang.AbstractMethodError: org.mybatis.spring.transaction.SpringManagedTransaction.getTimeout()L的相关文章

java.lang.AbstractMethodError: org.mybatis.spring.transaction.SpringManagedTransaction.getTimeout()Ljava/lang/Integer; at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.jav

在整合spring和mybatis在执行数据库操作的时候报出了: java.lang.AbstractMethodError: org.mybatis.spring.transaction.SpringManagedTransaction.getTimeout()L错误 java.lang.AbstractMethodError: org.mybatis.spring.transaction.SpringManagedTransaction.getTimeout()Ljava/lang/Inte

整合SSM时报错:java.lang.AbstractMethodError: org.mybatis.spring.transaction.SpringManagedTransaction.getTimeout()Ljava/lang/Integer;

在整合Spring和MyBatis时,只进行了简单的插入操作,结果报了这个错,顿时整个人都崩溃了 -- 一点都看不懂嘛!只有网上搜索 结果是在使用MyBatis3.x和Spring4.x整合是 导入的MyBatis-Spring.jar要使用1.3.x版本以上才行.

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

SSM下报这个错是因为用于整合spring和mybatis的spring-mybatis的jar包版本不正确造成的,下图为三者的对照表,可根据图示进行jar包的选择

Mybatis异常:java.lang.ClassNotFoundException: org.mybatis.spring.SqlSessionFactoryBean

问题描述: 一月 15, 2014 3:43:13 下午 org.springframework.context.support.AbstractApplicationContext prepareRefresh信息: Refreshing org[email protected]a530461: startup date [Wed Jan 15 15:43:13 CST 2014]; root of context hierarchy一月 15, 2014 3:43:13 下午 org.spr

使用SpringData出现java.lang.AbstractMethodError

最近学习一下SpringData,在添加SpringData支持的时候,出现了这样的问题: SpringData需要的jar有:spring-data-jpa.jar  spring-data-commons.jar  slf4j-api.jar 没有添加slf4j也会出现一个异常,不过那个异常说的非常明确,就是少slf4j,可能SpringData使用slf4作为日志框架 又回到java.lang.AbstractMethodError这个错误上,先说明原因吧:就是版本不兼容导致的. 最初我是

java.lang.AbstractMethodError: Method com/mysql/jdbc/PreparedStatement.isClosed()Z is abstract

在学习Mybatis时出现下面的错误 1 java.lang.AbstractMethodError: Method com/mysql/jdbc/PreparedStatement.isClosed()Z is abstract 查阅资料后发现是Mybatis和mysql版本兼容问题 现在使用 <!-- https://mvnrepository.com/artifact/org.mybatis/mybatis --> <dependency> <groupId>or

启动eureka工程报java.lang.AbstractMethodError: null异常

java.lang.AbstractMethodError: null at org.springframework.core.OrderComparator.findOrder(OrderComparator.java:142) ~[spring-core-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.core.annotation.AnnotationAwareOrderComparator.findOrder(Annotat

spring-cloud-alibaba-sentinel和feign配合使用,启动报Caused by: java.lang.AbstractMethodError: com.alibaba.cloud.sentinel.feign.SentinelContractHolder.parseAndValidateMetadata(Ljava/lang/Class;)Ljava/util/List

背景 我在学习spring-cloud-alibaba技术栈期间,在学习服务熔断与限流的时候,服务启动发生了以下异常 #这是控制台最上面的 sun.misc.Unsafe.park(Native Method) java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awa

Hibernate连接sql server 2000 时,报错java.lang.AbstractMethodError

Exception in thread "main" java.lang.ExceptionInInitializerError at com.wolf.execise.util.HibernateUtil.buildSessionFactory(HibernateUtil.java:22) at com.wolf.execise.util.HibernateUtil.<clinit>(HibernateUtil.java:10) at com.wolf.execise.t