异常org.mybatis.spring.transaction.SpringManagedTransactionFactory.newTransaction

2015/04/29 00:38
阅读数 494

mybatis-3.1.1 +spring-3.2.0.M1+mybatis-spring-1.0.0 集成,应用spring test测试时产生如下错误:

java.lang.AbstractMethodError: org.mybatis.spring.transaction.SpringManagedTransactionFactory.newTransaction(Ljava/sql/Connection;)Lorg/apache/ibatis/transaction/Transaction; 
at org.apache.ibatis.session.defaults.DefaultSqlSessionFactory.openSessionFromConnection(DefaultSqlSessionFactory.java:100)
at org.apache.ibatis.session.defaults.DefaultSqlSessionFactory.openSession(DefaultSqlSessionFactory.java:73) 
at org.mybatis.spring.SqlSessionUtils.getSqlSession(SqlSessionUtils.java:134) 
at org.mybatis.spring.SqlSessionTemplate¥SqlSessionInterceptor.invoke(SqlSessionTemplate.java:333) 
at ¥Proxy11.List(Unknown Source) 
at org.mybatis.spring.SqlSessionTemplate.List(SqlSessionTemplate.java:189) 
at org.apache.ibatis.binding.MapperMethod.executeForList(MapperMethod.java:114) 
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:84) 
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:40) 
at ¥Proxy12.getAllProductIndexField(Unknown Source) 
at com.babaifang.search.mapper.ProductIndexMapperTest.test(ProductIndexMapperTest.java:43) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
at java.lang.reflect.Method.invoke(Method.java:597) 
at org.junit.runners.model.FrameworkMethod¥1.runReflectiveCall(FrameworkMethod.java:44) 
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) 
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) 
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) 
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72) 
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231) 
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) 
at org.junit.runners.ParentRunner¥3.run(ParentRunner.java:193) 
at org.junit.runners.ParentRunner¥1.schedule(ParentRunner.java:52) 
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) 
at org.junit.runners.ParentRunner.access¥000(ParentRunner.java:42) 
at org.junit.runners.ParentRunner¥2.evaluate(ParentRunner.java:184) 
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236) 
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174) 
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49) 
at org.eclipse.jdt.internal.junit.runner.Testution.run(Testution.java:38) 
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) 
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) 
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) 
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

解决方案:

          将 mybatis-spring-1.0.0 .jar  替换成 mybatis-spring-1.1.1.jar

                                  问题得到解决。

 

原文链接:http://flashdream8.iteye.com/blog/1560795

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部