skywalking icon indicating copy to clipboard operation
skywalking copied to clipboard

[agent]java.lang.NullPointerException: null with apm-spring-annotation-plugin-6.0.0-GA.jar

Open vanlin opened this issue 7 years ago • 6 comments

Bug

  • Which version of SkyWalking, OS and JRE? SkyWalking ver: 6.0 GA ServiceComb ver: 1.1.0 JRE: 1.8

when I enabled apm-spring-annotation-plugin-6.0.0-GA.jar plugins and then I get NPE !

NPE cause:

org.apache.servicecomb.core.definition.schema.AbstractSchemaFactory.setSchemaLoader 

method @Inject annotation missing , schemaLoader cannot inject. av

disabled apm-spring-annotation-plugin-6.0.0-GA.jar

image

enabled apm-spring-annotation-plugin-6.0.0-GA.jar

image

vanlin avatar Mar 02 '19 05:03 vanlin

@candyleer Could you take a look at this? You should have many experiences with this kind of issue. :)

wu-sheng avatar Mar 03 '19 12:03 wu-sheng

OK,No problem

candyleer avatar Mar 03 '19 14:03 candyleer

@vanlin can you provide a demo to reproduce this issue?

candyleer avatar Mar 04 '19 01:03 candyleer

hi @candyleer, please look at this : https://github.com/vanlin/servicecombtest

vanlin avatar Mar 04 '19 14:03 vanlin

I found the reason, the spring plugin remove the annotation when enhance the method, let me think and fix the issue

  cachedValue$enuaW9Jm$6e6svp1 = ProducerSchemaFactory.class.getMethod("getOrCreateProducerSchema", String.class, Class.class, Object.class);
        cachedValue$enuaW9Jm$u2pnf53 = ProducerSchemaFactory.class.getMethod("setSwaggerEnv", SwaggerEnvironment.class);
        cachedValue$enuaW9Jm$hf4k4j3 = AbstractSchemaFactory.class.getMethod("setSchemaLoader", SchemaLoader.class);

candyleer avatar Mar 05 '19 09:03 candyleer

Fixed. PR merged in to master.

wu-sheng avatar Mar 06 '19 00:03 wu-sheng