SSM项目启动时报错:
org/mybatis/spring/SqlSessionFactoryBean has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0 (无法载入的类 [org.mybatis.spring.SqlSessionFactoryBean])
原因:
可能使用了不兼容本项目的Mybatis-Spring依赖版本,Mybatis-Spring 3.0+版本只只用于Spring 6.0+,而Spring 6.0+只能在Java 17+版本运行。
如果你的项目还在使用Spring 5.x等版本,请将Mybatis-Spring依赖版本更改为2.x版本。
解决方案:
修改Mybatis-Spring依赖版本为2.x版本
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>2.1.1</version>
</dependency>
Mybatis各版本对照图(来源:Mybatis官网)

SSM项目启动时遇到Java版本不兼容问题
文章讲述了在SSM项目启动时出现的错误,原因是Mybatis-Spring的高版本与正在使用的Java版本不兼容。解决方案是将Mybatis-Spring的依赖版本降级到2.x,以适应Spring5.x及更低版本的项目需求。

被折叠的 条评论
为什么被折叠?



