probably due to a new Java class file version that isn’t supported yet
1. 錯誤提示
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file
[E:\Code\git\xxx.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 [E:\Code\git\xxx.class]; nested exception is java.lang.IllegalArgumentException
org.apache.catalina.core.StandardContext.listenerStart 異常将上下文初始化事件發送到類的偵聽器執行個體.[org.springframework.web.context.ContextLoaderListener]
嚴重 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.StandardContext.listenerStop 例外情況發送上下文删除事件[org.springframework.web.context.ContextLoaderListener],以便清單執行個體
java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
2. Spring版本對應JDK版本
1.檢查一下Spring版本和JDK 版本
Spring Framework 5.3.x: JDK 8-17 (expected)
Spring Framework 5.2.x: JDK 8-15 (expected)
Spring Framework 5.1.x: JDK 8-12
Spring Framework 5.0.x: JDK 8-10
Spring Framework 4.3.x: JDK 6-8
官網位址:
https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-Versions
經過檢查是JDK1.8 不相容Spring Framework 3.2.x
3. IDEA修改項目JDK版本
1.7JDK下載下傳位址: https://www.oracle.com/java/technologies/javase/javase7-archive-downloads.html#jdk-7u80-oth-JPR
![](https://img.laitimes.com/img/__Qf2AjLwojIjJCLyojI0JCLiQDOxEzX3xCZlhXam9VbsUmepNXZy9CXwJWZ3xCdh1mcvZ2Lc1zaHRGcWdUYuVzVa9GczoVdG1mWfVGc5RHLwIzX39GZhh2csATMflHLwEzX4xSZz91ZsAzMfRHLGZkRGZkRfJ3bs92YskmNhVTYykVNQJVMRhXVEF1X0hXZ0xiNx8VZ6l2cssmch1mclRXY39CXldWYtlWPzNXZj9mcw1ycz9WL49zZuBnL4YTN1UjMhdzNkNGO3IjYyYzXxATNwATMyIzLcZDMyIDMy8CXn9Gbi9CXzV2Zh1WavwVbvNmLvR3YxUjLyM3Lc9CX6MHc0RHaiojIsJye.png)
選擇JDK版本
替換Project JDK版本
修改Modules 文法級别
設定源檔案路徑, 編輯代碼時會顯示源檔案形式
設定輸出路徑
設定JDK版本
4.Tomcat 對應JDK版本
參考連結javascript:void(0)