项目启动时报错Instantiation of bean failed; nested exception is java.lang.ExceptionInInitializerError

https://www.cnblogs.com/liuyp-ken/p/7911536.html

解决过程:

1、检查配置,反反复复看了很多遍,确认没有问题。

2、 网上找了很多资料,类似的问题很多,看过答案以后依旧不得其要领。只好继续看报错代码,直到看到这一句:


1

2

3

4

Caused by: java.lang.NullPointerException

    at ***.***.SearchIPAttributionService.load(SearchIPAttributionService.java:133)

    at ***.***.SearchIPAttributionService.load(SearchIPAttributionService.java:66)

    at ***.***.SearchIPAttributionService.<clinit>(SearchIPAttributionService.java:28)

问题应该在本身的代码上,但是,我记得代码是测试过的,没有问题。但是,没有其他办法,只能顺着提示一步步寻找问题所在。最终,确实问题出在代码上。Spring在实例化这个类的时候,先执行静态方法,此时某个类还未实例化,故而报了这个空指针错误

经验教训:

1、解决问题,不要急躁,要淡定,淡定,淡定。

2、仔细看报错信息。

3、每次修改过代码以后,都要记得进行测试,确保修改是正确的。

原文地址:https://www.cnblogs.com/jing1617/p/10192532.html

时间: 2024-07-31 22:47:41

项目启动时报错Instantiation of bean failed; nested exception is java.lang.ExceptionInInitializerError的相关文章

spring Boot启动报错Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotatedElementUtils.getAnnotationAttributes

spring boot 启动报错如下 org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure

spring quartz:Instantiation of bean failed; nested exception is java.lang.IncompatibleClassChangeErr

spring 调度类初始化失败,分析是jar包冲突,日志如下: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scheduler' defined in file [D:\InstallApplication\apache-tomcat-7.0.23\wtpwebapps\campaign\WEB-INF\classes\spring\applicationConte

Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/objectweb/asm/Type

问题描述 将项目挂载到 Myeclipse 的 tomcat 上,启动 tomcat ,报错"Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/objectweb/asm/Type" 问题原因 缺少 jar 包 解决方案 第一种方案: 1.将需要的第三方包拷贝进libs 文件夹. 2.将引用的第三方包,添加进工作的build path -->工程上右键 --

Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.&lt;init&gt;(Z)V

启动web应用时出现以下异常: Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(Z)V at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(A

Initialization of bean failed; nested exception is java.lang.reflect.MalformedParameterizedTypeExcep

body { font-family: "Microsoft YaHei UI","Microsoft YaHei",SimSun,"Segoe UI",Tahoma,Helvetica,Sans-Serif,"Microsoft YaHei", Georgia,Helvetica,Arial,sans-serif,宋体, PMingLiU,serif; font-size: 10.5pt; line-height: 1.5;

Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/jms/JMSContext

参考链接 : https://blog.csdn.net/angus_Lucky/article/details/82811946?utm_source=blogxgwz7 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'connectionFactory' defined in class path resource [spring/applicationContex

Spring MVC集成thymeleaf时提示:defined in ServletContext resource [/WEB-INF/SrpingMVCTest-servlet.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException

错误提示: defined in ServletContext resource [/WEB-INF/SrpingMVCTest-servlet.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.thymeleaf.templateresolver.ServletContex

异常:Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException

这个异常是出现在注入配置文件中配置好的属性时报错的: Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'my.name' in value "${my.name}" 此时配置文件默认的名称为:application.properties 解决方法: 将配置文件名改为:appli

HTTP Status 500 - Handler processing failed; nested exception is java.lang.OutOfMemoryError: PermGen

HTTP Status 500 - Handler processing failed; nested exception is java.lang.OutOfMemoryError: PermGen space 发生此问题的环境信息: 系统:CentOS 6.5 Tomcat:Tomcat 7.0.6 PermGen space PermGen space的全称是Permanent Generation space,是指内存的永久保存区域OutOfMemoryError: PermGen sp