Bean初始化错误:Instantiation of bean failed; nested exception is java.lang.ExceptionInInitializerError
在啟動Dubbo項目前,沒有報任何錯誤,但是在點擊運行Dubbo項目后報Bean初始化錯誤,也就是以下內容:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-09-01 14:55:02.289 ERROR 15560 --- [ ? ? ? ? ? main] o.s.boot.SpringApplication ? ? ? ? ? ? ? : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ServiceBean:com.service.ProviderUserService': Instantiation of bean failed; nested exception is java.lang.ExceptionInInitializerError
圖片和放大圖如下:
查找過spring注解沒有問題,甚至查看過maven依賴也沒有問題,最后發現這是因為JDK運行版本過高的問題導致:當前的運行版本要求配置太高,解決方法如下:
?1、找到Project Structure設置選項
2、key可以看到如下界面,我這里是使用了jdk17版本,要求Dubbo項目里面的配置也是17版本,但是我的實際使用的都需要是jdk1.8版本,所以改為相應版本即可
?3、改為jdk1.8版本
?4、再次運行項目,已經正常運行
?
總結
以上是生活随笔為你收集整理的Bean初始化错误:Instantiation of bean failed; nested exception is java.lang.ExceptionInInitializerError的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ASP生成JSON数据
- 下一篇: AJAX框架简笔画风景简单,好看简单的简