1、UnsupportedClassVersionError
序列 | 报错详情 | 解决 | 相应图片 |
---|---|---|---|
1 | org/mybatis/spring/boot/autoconfigure/ MybatisAutoConfiguration$ AutoConfiguredMapperScannerRegistrar 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 52.0 | 解决方法1: 导入依赖时,依赖下载的jar和当前jdk版本存在不同,导致出错 当前使用的jdk:jdk-8u151-windows-x64.exe 原mybatis:3.0.1 修改后:2.2.1 | ![]() |
解决方法2: 进入AutoConfiguredMapperScannerRegistrar 的class中 右上角会出现Choose Sources 删除高版本后选择低版本即可 | ![]() ![]() | ||
这边原来是2022.0.1,当前java版本为1.8 版本太高需要换回2021.0.1才行 | ![]() |
2、Field Mapper that could not be found
序列 | 报错详情 | 解决 | 相应图片 |
---|---|---|---|
1 | Field dynamicsqlitedbMapper in com.example.demo.controller.TestController required a bean of type ‘com.example.demo.dao.DynamicsqlitedbMapper’ that could not be found. | 解决方法1:spring dao层注释需要添加注解@Mapper 解决方法2:在启动类上添加@MapperScan(“dao层所在地址”) | ![]() ![]() |
在mapper上添加注解@Component | ![]() |
3、启动
序列 | 报错详情 | 解决 | 相应图片 |
---|---|---|---|
1 | java: 无法访问org.springframework.beans.factory.annotation.Value 错误的类文件: /E:/JAVA/javaku/org/springframework/spring-beans/6.0.6/ spring-beans-6.0.6.jar!/org/springframework/beans/ factory/annotation/Value.class 类文件具有错误的版本 61.0, 应为 52.0 请删除该文件或确保该文件位于正确的类路径子目录中。 | HostInfoEnvironmentPostProcessor Java、Major version版本存在对应关系, 当前jdk版本为1.8,不适配干版本数据 | ![]() ![]() |
2 | java.lang.annotation.AnnotationFormatError: Invalid default: public abstract java.lang.Class org.mybatis.spring.annotation.MapperScan.factoryBean() | 添加依赖 < dependency> < groupId>org.mybatis</ groupId> < artifactId>mybatis-spring< /artifactId> < version>2.0.6</v ersion> </d ependency> < dependency> < groupId>org.mybatis.spring.boot</ groupId> < artifactId>mybatis-spring-boot-starter</ artifactId> < version>2.0.1</ version> < /dependency> 添加完依赖后,可能还是会出现: 命令台打印:mvn clean 然后重新运行项目 | |
3 | Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded datasource could be configured. | 使用DruidDataSourceBuilder.create().build();配置多数据源的时候yml配置错误 | ![]() |
4、Invalid packaging for parent POM com.yj:pro:0.0.1-SNAPSHOT (E:\JAVA\java\pro
序列 | 报错详情 | 解决 | 相应图片 |
---|---|---|---|
a | b | 父工程中添加< packaging>pom</ packaging> 子工程中添加< packaging>jar</ packaging> | b |
5、java.lang.NullPointerException
序列 | 报错详情 | 解决 | 相应图片 |
---|---|---|---|
1 | org.springframework.context.ApplicationContextException: Failed to start bean ‘documentationPluginsBootstrapper’; nested exception is java.lang.NullPointerException | 在yml中添加代码 spring: mvc: pathmatch: matching-strategy: ant_path_matcher | 完成 |
6、java代码报错
序列 | 报错详情 | 解决 | 相应图片 |
---|---|---|---|
1 | mybatis日期比较大小问题 | 比较符号不能使用<=、=>需要使用 <![CDATA[ <= ]]>、<![CDATA[ >= ]]> | ![]() ![]() |
#、
序列 | 报错详情 | 解决 | 相应图片 |
---|---|---|---|
a | b | b | b |