java开发遇到过的问题

1、UnsupportedClassVersionError

序列报错详情解决相应图片
1org/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

序列报错详情解决相应图片
1Field 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层所在地址”)
b
在这里插入图片描述
在mapper上添加注解@Component在这里插入图片描述

3、启动

序列报错详情解决相应图片
1java: 无法访问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,不适配干版本数据
在这里插入图片描述在这里插入图片描述
2java.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
然后重新运行项目
3Failed 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

序列报错详情解决相应图片
ab父工程中添加< packaging>pom</ packaging>
子工程中添加< packaging>jar</ packaging>
b

5、java.lang.NullPointerException

序列报错详情解决相应图片
1org.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代码报错

序列报错详情解决相应图片
1mybatis日期比较大小问题比较符号不能使用<=、=>需要使用 <![CDATA[ <= ]]>、<![CDATA[ >= ]]>完成
在这里插入图片描述

#、

序列报错详情解决相应图片
abbb
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值