首页 > 代码库 > java.lang.NoClassDefFoundError: org/apache/ibatis/mapping/DatabaseIdProvider
java.lang.NoClassDefFoundError: org/apache/ibatis/mapping/DatabaseIdProvider
我用的方案是:maven+struts2+spring+mybatis
出现上述错误的原因是:
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.2.2</version>
</dependency>
两个mybatis版本不兼容,把第一个dependency的mybatis版本提高的最新就可以解决这个问题了。改变后的结果如下所示:
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.2.7</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.2.2</version>
</dependency>