运行springboot新建的项目,运行Application类时报错

运行springboot新建的项目,运行Application类时报错

跟着视频,创建了Application和application.yml文件,foodie项目install之后,运行application类直接报错,jdk的版本是1.8,找不到原因。



[2022-07-05 19:53:04.734] - 2910 信息 [main] --- com.syy.Application: Starting Application on LPT008660 with PID 2910 (/Users/shuyangyang/workspaces/codes/back-end/foodie-dev/target/classes started by shuyangyang in /Users/shuyangyang/workspaces/codes/back-end/foodie-dev)

[2022-07-05 19:53:04.752] - 2910 信息 [main] --- com.syy.Application: No active profile set, falling back to default profiles: default

[2022-07-05 19:53:04.802] - 2910 警告 [main] --- org.springframework.context.annotation.AnnotationConfigApplicationContext: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [/Users/shuyangyang/workspaces/codes/back-end/foodie-dev/target/classes/com/syy/Application.class]; nested exception is 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 [/Users/shuyangyang/workspaces/codes/back-end/foodie-dev/target/classes/com/syy/Application.class]; nested exception is java.lang.IllegalArgumentException: Unsupported class file major version 62

[2022-07-05 19:53:04.812] - 2910 严重 [main] --- org.springframework.boot.SpringApplication: Application run failed

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [/Users/shuyangyang/workspaces/codes/back-end/foodie-dev/target/classes/com/syy/Application.class]; nested exception is 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 [/Users/shuyangyang/workspaces/codes/back-end/foodie-dev/target/classes/com/syy/Application.class]; nested exception is java.lang.IllegalArgumentException: Unsupported class file major version 62

at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.scanCandidateComponents(ClassPathScanningCandidateComponentProvider.java:454)

at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:316)

at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:275)

at org.springframework.context.annotation.ComponentScanAnnotationParser.parse(ComponentScanAnnotationParser.java:132)

at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:287)

at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:242)

at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:199)

at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:167)

at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:315)

at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:232)

at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275)

at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:95)

at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:705)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531)

at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)

at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)

at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)

at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)

at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)

at com.syy.Application.main(Application.java:10)

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 [/Users/shuyangyang/workspaces/codes/back-end/foodie-dev/target/classes/com/syy/Application.class]; nested exception is java.lang.IllegalArgumentException: Unsupported class file major version 62

at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:57)

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:430)

... 19 more

Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 62

at org.springframework.asm.ClassReader.<init>(ClassReader.java:184)

at org.springframework.asm.ClassReader.<init>(ClassReader.java:166)

at org.springframework.asm.ClassReader.<init>(ClassReader.java:152)

at org.springframework.asm.ClassReader.<init>(ClassReader.java:273)

at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:54)

... 22 more

https://img1.sycdn.imooc.com//climg/62c427c70937b5e528240562.jpg

https://img1.sycdn.imooc.com//climg/62c427c7095c983b26321650.jpg


正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
风间影月 2022-07-05 20:08:02

看样子是环境配置问题,但是不能确定是哪里的问题。请问之前有没有接触过springboot呢?

  • 提问者 kkloqin0 #1

    没有接触过,请问我应该怎么去排查问题,方便加个qq联系吗?

    2022-07-05 20:40:24
  • 亲可以加群噢~ 大家都在群里哈~~ 另外建议学习一下springboot基础会更好哟,本课程是偏中高级进阶的哈~~
    2022-07-05 20:43:14
  • 慕娘6277225 回复 提问者 kkloqin0 #3

    亲,请问你解决这个问题了吗?还记得是怎么解决的吗

    2023-04-11 18:05:38
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师