OpenFeign / OpenFeign/feign

NamedContextFactory.getContext NullPointerException

Open
#1,703 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
9.8k
Forks
1.9k
Avg merge
1d 2h
Merged PRs (30d)
41

Description

Other service to current service is Ok,but
Current service to current service will throw NullPointerException

java.lang.NullPointerException: null
at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:936) ~[na:1.8.0_341]
at java.util.concurrent.ConcurrentHashMap.containsKey(ConcurrentHashMap.java:964) ~[na:1.8.0_341]
at org.springframework.cloud.context.named.NamedContextFactory.getContext(NamedContextFactory.java:102) ~[spring-cloud-context-3.1.1.jar:3.1.1]
at org.springframework.cloud.context.named.NamedContextFactory.getProvider(NamedContextFactory.java:161) ~[spring-cloud-context-3.1.1.jar:3.1.1]
at org.springframework.cloud.context.named.ClientFactoryObjectProvider.delegate(ClientFactoryObjectProvider.java:115) ~[spring-cloud-context-3.1.1.jar:3.1.1]
at org.springframework.cloud.context.named.ClientFactoryObjectProvider.getIfAvailable(ClientFactoryObjectProvider.java:64) ~[spring-cloud-context-3.1.1.jar:3.1.1]
at com.alibaba.cloud.nacos.loadbalancer.NacosLoadBalancer.choose(NacosLoadBalancer.java:68) ~[spring-cloud-starter-alibaba-nacos-discovery-2021.0.1.0.jar:2021.0.1.0]
at com.alibaba.cloud.nacos.loadbalancer.NacosLoadBalancer.choose(NacosLoadBalancer.java:47) ~[spring-cloud-starter-alibaba-nacos-discovery-2021.0.1.0.jar:2021.0.1.0]
at org.springframework.cloud.loadbalancer.blocking.client.BlockingLoadBalancerClient.choose(BlockingLoadBalancerClient.java:155) ~[spring-cloud-loadbalancer-3.1.1.jar:3.1.1]
at org.springframework.cloud.openfeign.loadbalancer.FeignBlockingLoadBalancerClient.execute(FeignBlockingLoadBalancerClient.java:97) ~[spring-cloud-openfeign-core-3.1.1.jar:3.1.1]
at com.alibaba.cloud.seata.feign.SeataFeignBlockingLoadBalancerClient.execute(SeataFeignBlockingLoadBalancerClient.java:44) ~[spring-cloud-starter-alibaba-seata-2021.0.1.0.jar:2021.0.1.0]
at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:119) ~[feign-core-11.8.jar:na]
at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:89) ~[feign-core-11.8.jar:na]
at com.alibaba.cloud.sentinel.feign.SentinelInvocationHandler.invoke(SentinelInvocationHandler.java:109) ~[spring-cloud-starter-alibaba-sentinel-2021.0.1.0.jar:2021.0.1.0]
at com.sun.proxy.$Proxy199.addOperaLog(Unknown Source) ~[na:na]
at com.common.log.aspect.LogAspect$1.run(LogAspect.java:79) ~[classes/:na]
at java.lang.Thread.run(Thread.java:750) ~[na:1.8.0_341]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the stack trace at org.springframework.cloud.context.named.NamedContextFactory.getContext and the call path through NacosLoadBalancer.choose and FeignBlockingLoadBalancerClient.execute. Reproduce the current-service-to-current-service request with the reported dependency versions, then determine the missing context value and add or identify a regression test that confirms the request no longer throws NullPointerException.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.