Zipkin: Nullpointer expection

Created on 10 Sep 2019  路  3Comments  路  Source: openzipkin/zipkin

Describe the Bug

If server.compression properties not defined in application.properties, then application not start

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'armeriaServer' defined in class path resource [com/linecorp/armeria/spring/ArmeriaAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.linecorp.armeria.server.Server]: Factory method 'armeriaServer' threw exception; nested exception is java.lang.NullPointerException at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:627) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:607) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1321) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1160) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:845) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1204) [spring-boot-2.1.8.RELEASE.jar:2.1.8.RELEASE] at com.quarks.services.zipkinserver.ZipkinServerApplication.main(ZipkinServerApplication.java:15) [classes/:na] Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.linecorp.armeria.server.Server]: Factory method 'armeriaServer' threw exception; nested exception is java.lang.NullPointerException at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:622) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE] ... 19 common frames omitted Caused by: java.lang.NullPointerException: null at zipkin2.autoconfigure.ui.ZipkinUiAutoConfiguration.lambda$uiServerConfigurator$0(ZipkinUiAutoConfiguration.java:179) ~[zipkin-autoconfigure-ui-2.12.9.jar:na] at com.linecorp.armeria.spring.ArmeriaAutoConfiguration.lambda$armeriaServer$0(ArmeriaAutoConfiguration.java:111) ~[armeria-spring-boot-autoconfigure-0.83.0.jar:na] at java.util.ArrayList.forEach(ArrayList.java:1257) ~[na:1.8.0_222] at com.linecorp.armeria.spring.ArmeriaAutoConfiguration.lambda$armeriaServer$1(ArmeriaAutoConfiguration.java:110) ~[armeria-spring-boot-autoconfigure-0.83.0.jar:na] at java.util.Optional.ifPresent(Optional.java:159) ~[na:1.8.0_222] at com.linecorp.armeria.spring.ArmeriaAutoConfiguration.armeriaServer(ArmeriaAutoConfiguration.java:109) ~[armeria-spring-boot-autoconfigure-0.83.0.jar:na] at com.linecorp.armeria.spring.ArmeriaAutoConfiguration$$EnhancerBySpringCGLIB$$2c76ca14.CGLIB$armeriaServer$0(<generated>) ~[armeria-spring-boot-autoconfigure-0.83.0.jar:na] at com.linecorp.armeria.spring.ArmeriaAutoConfiguration$$EnhancerBySpringCGLIB$$2c76ca14$$FastClassBySpringCGLIB$$1612b233.invoke(<generated>) ~[armeria-spring-boot-autoconfigure-0.83.0.jar:na] at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.1.9.RELEASE.jar:5.1.9.RELEASE] at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363) ~[spring-context-5.1.9.RELEASE.jar:5.1.9.RELEASE] at com.linecorp.armeria.spring.ArmeriaAutoConfiguration$$EnhancerBySpringCGLIB$$2c76ca14.armeriaServer(<generated>) ~[armeria-spring-boot-autoconfigure-0.83.0.jar:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_222] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_222] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_222] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_222] at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.1.9.RELEASE.jar:5.1.9.RELEASE] ... 20 common frames omitted

Steps to Reproduce

I am using these deps
zipkin-server:2.12.9
zipkin-autoconfigure-ui:2.12.9
spring-boot-starter-web:2.1.8.RELEASE

Expected Behaviour

Application should start

Most helpful comment

It's a bummer you closed this. The problem for this is at line 179 of the ZipkinUIAutoConfiguration.java.

Compression compression = compressionProperties.getCompression();
if (compression.getEnabled()) { //Throws NullPointerException. Maybe add a null check and skip this if null?
    sb.decorator(contentEncodingDecorator(compression));
}

To get by in a basic Spring Boot setup just add this proprty to your application.properties

server.compression.enabled=false

All 3 comments

Hi, it looks like you are building a custom zipkin server. Unfortunately we cannot provide support for custom servers, we are a small group of volunteers and custom servers can have so many variables that it is too big of a burden on our community.

Did you know there are pre-built distributions of zipkin? Please check out our documentation for more information: https://github.com/openzipkin/zipkin/blob/master/zipkin-server/README.md

It's a bummer you closed this. The problem for this is at line 179 of the ZipkinUIAutoConfiguration.java.

Compression compression = compressionProperties.getCompression();
if (compression.getEnabled()) { //Throws NullPointerException. Maybe add a null check and skip this if null?
    sb.decorator(contentEncodingDecorator(compression));
}

To get by in a basic Spring Boot setup just add this proprty to your application.properties

server.compression.enabled=false

it was closed because custom servers are not supported, and the problem was phrased as a custom assembled server.

You can feel free to raise a PR to remove the NPE risk, which is maybe possible in default server, if someone changes some override property config.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

adriancole picture adriancole  路  10Comments

narayaruna picture narayaruna  路  5Comments

adriancole picture adriancole  路  10Comments

basvanbeek picture basvanbeek  路  3Comments

adriancole picture adriancole  路  9Comments