今天看错误堆栈尽然发现一个以前没见过的Error ,java.lang.ExceptionInInitializerError
首先看下类原型
public class ExceptionInInitializerError extends LinkageError {
然后看下类说明
* Signals that an unexpected exception has occurred in a static initializer
.
* An <code>ExceptionInInitializerError</code> is thrown to indicate that an
* exception occurred during evaluation of a static initializer or the
* initializer for a static variable.
接着看下LinkageError的来历
public class LinkageError extends Error
再看看他的类说明
* Subclasses of <code>LinkageError</code> indicate that a class has
* some dependency on another class
; however, the latter class has
* incompatibly changed after the compilation of the former class.
顺便我们再来看下LinkageError的嫡系有哪些
好吧,这一家子的Error都是我们得罪不起的,他的孙子我们会经常见,而且好定位,儿子类型的错误不常见也不好直接定位。
说到这里,开始引入正题,看堆栈的时候,经常发现几个函数很特殊,例如堆栈里有如下2种函数
XxxClass.<init>
XxxxClass.<clinit>
对比其他函数调用堆栈的显示
XxxClass.sayHello
XxxClass.sayBye
最上面2个函数很特殊,用尖括号括起来,看下JVM的官方规范里的解释
http://java.sun.com/docs/books/jvms/second_edition/html/Overview.doc.html
3.9 Specially Named Initialization Methods
At the level of the Java virtual machine, every constructor (§2.12) appears as an instance initialization method that has the special name <init>. This name is supplied by a compiler. Because the name <init> is not a valid identifier, it cannot be used directly in a program written in the Java programming language. Instance initialization methods may be invoked only within the Java virtual machine by the invokespecial instruction, and they may be invoked only on uninitialized class instances. An instance initialization method takes on the access permissions (§2.7.4) of the constructor from which it was derived.
A class or interface has at most one class or interface initialization method and is initialized (§2.17.4) by invoking that method. The initialization method of a class or interface is static and takes no arguments. It has the special name <clinit>. This name is supplied by a compiler. Because the name <clinit> is not a valid identifier, it cannot be used directly in a program written in the Java programming language. Class and interface initialization methods are invoked implicitly by the Java virtual machine; they are never invoked directly from any Java virtual machine instruction, but are invoked only indirectly as part of the class initialization process
搬出这个规范以及上面啰嗦的Error问题 是想说,以后看到堆栈,我们应该能第一时间就能明白错误大致发生在什么地方,大概原因是什么,了解这些,对加速定位问题是有帮助的。
- 大小: 53.4 KB
分享到:
相关推荐
medical clinic management system
An Attention-Based BiLSTM-CRF Model for Chinese Clinic Named Entity Recognition;基于注意力的 BiLSTM-CRF 模型 中国门诊病历文本命名实体识别
Clinic - Operating room 1.0.unitypackage
SpringPetClinic样品...如果执行此操作,它将立即获取您在项目中进行的更改(对Java源文件的更改也需要编译-大多数人为此使用IDE): ./mvnw spring-boot:run 如果您发现Spring Petclinic的错误/建议的改进 我们的问
Clinic
使用Spring Boot的小型诊所信息系统,之前毕设使用php语言完成的,经过学习,自己写了一个Java版 介绍 这是一个模拟小型诊所的项目,用于本人学习时编写的,基本功能完成 软件架构 单机版的SpringBoot项目,(All ...
牙科诊所牙科诊所管理系统的使用Java,Java GUI
Clinic.js 开源Node.js性能分析套件。 演示和详细文档: : 安装 npm install -g clinic 入门 第一步,请运行clinic doctor : clinic doctor -- node server.js 然后使用wrk或autocannon对服务器进行基准测试:...
pet-clinic 是spring的一个例子,用maven工具进行操作,比较好的spring demo
howto-clinic.pdf
clinic.c
DB2® 10 for LUW Performance Tuning and Monitoring Clinic Hands-On Labs Workbook
Visteon Advanced Product Research Clinic Results.pdf
基于JAVA的医院门诊信息管理系统设计与实现 摘 要 医院门诊信息管理系统是一个基于Internet的应用系统,它是一个面对当前的医院门 诊管理工作基本还处于手工和半信息自动化处理状态而应运而生的一个基于Internet的...
--Young Neurosurgeon's News Written by leading skull base surgeons from the renowned House Clinic inLos Angeles, California, Lateral Skull Base Surgery: The House Clinic Atlas is a much-needed ...
SpringPetClinic样品申请 通过一些图表了解Spring Petclinic应用程序 在本地运行诊所 ... cd spring-petclinic ./mvnw spring-boot:run 然后,您可以在此处访问petclinic: 如果您发现Spring Petclinic的错误/建议的...
Clinic Control 是一个 Web 应用程序,它将控制和管理控制患者、医生的日程安排、病史、库存、现金控制以及许多其他功能,可帮助您在小型医疗中心控制一切。
关于Visteon Advanced Product Research Clinic Results的介绍说明.rar
琳达网代码诊所:Java 与 Patrick Royal 问题一:探索Lake Pend Oreille 扩展代码诊所的数据分析以处理新的网站格式。 新网站不再包含方便的目录格式,而仅包含 2011-2014 年的四个文本文件。 因此,练习涉及更多的...
错误诊所一个nodeschool.io风格的讲习班,用于学习如何调试Node.js应用程序 请注意,这仅完成了2/3,但是您可能仍会学到一些东西$ sudo npm --global install bug-clinic$ bug-clinic贡献者执照bug-clinic版权所有...