nested exception is java.lang.ExceptionInInitializerError

完整異常:

org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.ExceptionInInitializerError

問題所在:

初始化靜態常量的時候方法報異常

private static final numbers = getNumbers();

getNumbers()報了異常,所以就會出現這個問題

方案:

檢查方法內的異常,儘量不要使用這樣的方法來初始化靜態變量的值

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章