【异常】jdk21升级,asm报错Unsupported class file major version 65 springboot2 升级JDK21

2023-12-20 06:49:39

【异常】jdk21升级,asm报错Unsupported class file major version 65

错误信息

Caused by: org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn't supported yet: file [C:\App.class]; nested exception is java.lang.IllegalArgumentException: Unsupported class file major version 65
	at org.springframework.core.type.classreading.SimpleMetadataReader.getClassReader(SimpleMetadataReader.java:60)
	at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:49)
	at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:103)
	at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:123)
	at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.scanCandidateComponents(ClassPathScanningCandidateComponentProvider.java:429)
	... 20 common frames omitted
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 65
	at org.springframework.asm.ClassReader.<init>(ClassReader.java:199)
	at org.springframework.asm.ClassReader.<init>(ClassReader.java:180)
	at org.springframework.asm.ClassReader.<init>(ClassReader.java:166)
	at org.springframework.asm.ClassReader.<init>(ClassReader.java:287)
	at org.springframework.core.type.classreading.SimpleMetadataReader.getClassReader(SimpleMetadataReader.java:57)
	... 24 common frames omitted

排查 发现是这个类导致的

org.springframework.asm.ClassReader

在代码里写死了限制jdk版本

直接重写该类

把这四行注释掉?

问题解决

或者? 升级

升级spring-core版本,整体springboot升级

文章来源:https://blog.csdn.net/G971005287W/article/details/135084998
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。