我用的方案是: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>
java.lang.NoClassDefFoundError: org/apache/ibatis/mapping/DatabaseIdProvider
时间: 2024-10-29 19:11:38