Skip to content

NPE when FeignClient response is null #1823

Closed
@jmecsei

Description

@jmecsei

Describe the bug
I have a demo project where I use Feign, RabbitMQ, Spring Kubernetes Config, and Sleuth of course.
I found a Bug that when a feign response is null the sleuth throws a NullPointerException.

Sample
Example Project
If you want to reproduce the problem just run the DemoApplicationTest.java file and will see got a NPE.

  • Solution 1
    Remove dependency (rabbit)
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-stream-rabbit</artifactId>
        </dependency>
  • Solution 2
    Remove dependency (kubernetes)
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-kubernetes-fabric8-config</artifactId>
        </dependency>
  • But I want to use all of these components so I have to find out another one
    If I exclude the spring-cloud-loadbalancer dependency NPE does not thrown.
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-kubernetes-fabric8-config</artifactId>
            <!--Uncomment this exclusion to solve the NPE Problem-->
            <!--            <exclusions>-->
            <!--                <exclusion>-->
            <!--                    <groupId>org.springframework.cloud</groupId>-->
            <!--                    <artifactId>spring-cloud-loadbalancer</artifactId>-->
            <!--                </exclusion>-->
            <!--            </exclusions>-->
        </dependency>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions