Feign 클라이언트에 문제가 있습니다. 나는 서로를 사용하여 서로 통신하는 3 개의 모듈을 가지고있다. ---
moduleA < 가장하다 ---> moduleB < ---- 가장하다 ----> moduleC
moduleC이 moduleB에 성공적인 응답을 보낼 때 내 문제가 발생합니다 : 그것은 다음과 같이 어떻게 든 보인다. 나는 거짓 중심의 수업을 공개하고 원인을 발견했다. 방법 checkNotNull (이유, "이유가")가 트리거됩니다 체하다 코어 클래스 응답에서com.netflix.feign 응답 클래스의 NullPointerException
package feign;
public final class Response {
private final int status;
private final String reason;
private final Map<String, Collection<String>> headers;
private final Body body;
private Response(int status, String reason, Map<String, Collection<String>> headers, Body body) {
checkState(status >= 200, "Invalid status code: %s", status); //my status is 200
this.status = status;
this.reason = checkNotNull(reason, "reason"); // my reason is unfortunatelly null
LinkedHashMap<String, Collection<String>>
copyOf =
new LinkedHashMap<String, Collection<String>>();
copyOf.putAll(checkNotNull(headers, "headers"));
this.headers = Collections.unmodifiableMap(copyOf);
this.body = body; //nullable
}
}
는 응답 상태 내가 그것을 고칠 수있는 방법 (200)에도 불구하고, NullPointerException가 간다?
편집 : 내 체하다 버전은 8.1.1
EDIT2입니다 : 내 바람둥이 버전은 내가 답을 발견 8.5.20
(200)에 유효하지 않은 상태해야한다는 바로 그 것이다 속성? (당신은'status> = 200'을 비교한다.) – bish
@bish 그것은 내 코드는 아니지만 feign-core API 코드이다. 그리고 checkState() 메소드는 상태> = 200이 거짓 일 때 예외를 트리거하는 까다로운 원인 중 하나입니다. – pokemzok