mercredi 1 mars 2017

org.reflections.ReflectionsException: Can't resolve member named #### for class [someClass].access

I encountered this exception when I was trying to call reflections.getMethodUsage(Method), using reflections library 0.9.10. JDK version: 1.8.0_121 64bit

Please investigate the relevant stacktrace below. Note that custom package names and class names are substituted:

Caused by: org.reflections.ReflectionsException: Can't resolve member named someClass.access$1300(someClass, anotherClass) #103
    at org.reflections.util.Utils.getMembersFromDescriptors(Utils.java:125)
    at org.reflections.Reflections.getMethodUsage(Reflections.java:574)
    at myCustomScanner.getCallers(myCustomScanner.java:145)
    at myCustomScanner.getBeanByMember(myCustomScanner.java:192)
    at myCustomScanner.getCallers(myCustomScanner.java:156)
    at myCustomScanner.getBeanByMember(myCustomScanner.java:192)
    at myCustomScanner.lambda$getServiceBeans$2(myCustomScanner.java:113)
    at java.lang.Iterable.forEach(Iterable.java:75)
    at myCustomScanner.getServiceBeans(myCustomScanner.java:111)
    at myCustomScanner.scan(myCustomScanner.java:87)
    at com.marvel.service.scanner.App.run(App.java:47)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:366)
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:311)
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:134)
    ... 22 more
Caused by: org.reflections.ReflectionsException: Can't resolve member named 1300 for class someClass.access
    at org.reflections.util.Utils.getMemberFromDescriptor(Utils.java:94)
    at org.reflections.util.Utils.getMembersFromDescriptors(Utils.java:123)
    ... 39 more

Progress I made so far: This weird member name '1300' and class name suffix '.access' seem to come from an anonymous class' method. I also found that the MemberUsageScanner is using javassist library to obtain this kind of info under the hood, but I failed to debug the process when MemberUsageScanner is scanning the members by setting a conditional breakpoint in Eclipse, the process seem to never reach that breakpoint and never proceed, hanging in the middle of nowhere.





Aucun commentaire:

Enregistrer un commentaire