Solve the problem of Java Lang.exceptionininitializererror error problem

Solve the problem of Java Lang.exceptionininitializererror error problem

Start a project today An error is reported when starting After checking the error information for a long time, it has always been said that hibernate cache management is wrong

Finally, check the log at startup and find that Java. Net is reported in the program lang.ExceptionInInitializerError

Finally, the reason is that you have modified the static constant, which automatically obtains the properties value when the system is started. As a result, an error is obtained, resulting in an error during code compilation

Error code:

Cause analysis:

Message is a static constant When compiling this class, the system will first load static constants and store them in the memory static field

However, because GetMessage returns a null at startup, it leads to an error Java lang.ExceptionInInitializerError

Let's talk about Java Lang. exceptionininitializererror this error prompt

We rarely encountered such abnormal information before, so we searched the Internet for this error, indicating initialization exception and null pointer error

Look at the API, which describes this exception like this

The signal of an unexpected exception in the static initializer. Throwing exceptionininitializererror indicates that an exception occurred during the calculation of the static initial value or the initial value of a static variable.

It can be seen that he inherits from linkageerror

The linkageerror is described and the problem is clearly pointed out

The subclass of linkageerror indicates that one class depends on another class to some extent; However, after compiling the previous class, the latter class has made incompatible changes.

Thank you for reading, hope to help you, thank you for your support to this site!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>