我試圖使用FasterXML Jackson-Databind爲了從JSON文件加載配置。嘗試使用Jackson加載配置時發生異常
我的應用程序使用AspectJ。方面J通過以下命令行開關加載:「-javaagent:target \ aspectjweaver-1.6.12.jar」。
當我嘗試加載配置而不啓動AspectJ時,一切正常。
當我嘗試加載使用AspectJ的配置,我碰到下面的錯誤堆棧:
Exception in thread "main" java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.reflect.Proxy.newInstance(Proxy.java:717)
at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:708)
at sun.reflect.annotation.AnnotationParser.annotationForMap(AnnotationParser.java:239)
at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:229)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:69)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:52)
at java.lang.Class.initAnnotationsIfNecessary(Class.java:3079)
at java.lang.Class.getAnnotation(Class.java:3038)
at sun.reflect.annotation.AnnotationType.<init>(AnnotationType.java:113)
at sun.reflect.annotation.AnnotationType.getInstance(AnnotationType.java:66)
at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:202)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:69)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:52)
at java.lang.Class.initAnnotationsIfNecessary(Class.java:3079)
at java.lang.Class.getAnnotation(Class.java:3038)
at com.fasterxml.jackson.databind.introspect.VisibilityChecker$Std.<clinit>(VisibilityChecker.java:170)
at com.fasterxml.jackson.databind.ObjectMapper.<clinit>(ObjectMapper.java:261)
at com.mytest.core.ConfigurationManager.loadConfiguration(ConfigurationManager.java:44)
at com.mytest.core.ConfigurationManager.getOrLoadConfigurationData(ConfigurationManager.java:33)
at com.mytest.core.ApplicationContext.getConfigruation(ApplicationContext.java:51)
at com.mytest.core.services.FootprintsServiceClient.init(FootprintsServiceClient.java:43)
at com.mytest.core.AppManager.init(AppManager.java:43)
at com.mytest.core.AppManager.getInstance(AppManager.java:61)
at com.mytest.core.aspects.TestAspect.ajc$before$com_mytest_core_aspects_TestAspect$1$93e74aa7(TestAspect.aj:21)
at io.demo.App.main(App.java:12)
Caused by: java.lang.NullPointerException
at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:530)
at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:448)
at com.mytest.core.ConfigurationManager.loadConfiguration(ConfigurationManager.java:44)
at com.mytest.core.ConfigurationManager.getOrLoadConfigurationData(ConfigurationManager.java:33)
at com.mytest.core.ApplicationContext.getConfigruation(ApplicationContext.java:51)
at com.mytest.core.services.FootprintsServiceClient.init(FootprintsServiceClient.java:43)
at com.mytest.core.AppManager.init(AppManager.java:43)
at com.mytest.core.AppManager.getInstance(AppManager.java:61)
at com.mytest.core.aspects.TestAspect.ajc$before$com_mytest_core_aspects_TestAspect$1$93e74aa7(TestAspect.aj:21)
at com.sun.proxy.$Proxy3.<clinit>(Unknown Source)
... 29 more
我會明白,如果你能指出我的根本原因或推薦的調試技術。
親切的問候,
Nadav
編輯 請注意,我知道什麼是空指針。我的問題是,我從ObjectMapper類的一個實例中獲取NullPointerException,它是Jackson框架的一部分。
我知道什麼是空指針異常。問題在於它是由ObjectMapper引發的,它是Jackson框架的一部分。 – nadavy
什麼版本的傑克遜? –
版本2.6.3。看起來像最新的.. – nadavy