我试图调用另一个API,它给了我WebClientResponseException
2021-11-03 19:54:55.762 [5a2a9625f3c7ff19/5a2a9625f3c7ff19] ERROR
{FATAL=red blink, ERROR=red, WARN=yellow bold, INFO=green, DEBUG=green bold, TRACE=blue} 23556 [ctor-http-nio-4] r.u.Loggers$Slf4JLogger
{cyan} : onError(org.springframework.web.reactive.function.client.WebClientResponseException$NotFound: 404 Not Found from POST http://localhost:8082/v1/persons/getAllIds)
2021-11-03 19:54:55.788 [5a2a9625f3c7ff19/5a2a9625f3c7ff19] ERROR
{FATAL=red blink, ERROR=red, WARN=yellow bold, INFO=green, DEBUG=green bold, TRACE=blue} 23556 [ctor-http-nio-4] r.u.Loggers$Slf4JLogger
{cyan} :
org.springframework.web.reactive.function.client.WebClientResponseException$NotFound: 404 Not Found from POST http://localhost:8082/v1/persons/getAllIds
at org.springframework.web.reactive.function.client.WebClientResponseException.create(WebClientResponseException.java:185)
Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
Error has been observed at the following site(s):
|_ checkpoint ⇢ 404 from POST http://localhost:8082/v1/persons/getAllIds [DefaultWebClient]
Stack trace:
at org.springframework.web.reactive.function.client.WebClientResponseException.create(WebClientResponseException.java:185)
at org.springframework.web.reactive.function.client.DefaultClientResponse.lambda$createException$1(DefaultClientResponse.java:209)
at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:100)
at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:96)
at reactor.core.publisher.FluxDefaultIfEmpty$DefaultIfEmptySubscriber.onNext(FluxDefaultIfEmpty.java:92)
@Override
public Flux<Person> getByIds(List<String> ids) {
log.info("getIds : {}",ids);
return webClient.post()
.uri(uriBuilder -> uriBuilder.path(config.getIdURL()).build())
.contentType(MediaType.APPLICATION_JSON)
.body(Mono.just(ids), List.class)
.header(geConstant.X_APP_ID_KEY, geConstant.X_APP_ID_VALUE)
.header(geConstant.X_API_KEY_KEY, geConstant.X_API_KEY_VALUE)
.retrieve()
.bodyToFlux(Person.class)
.log("Find ids : " + ids)
.retryBackoff(3, Duration.ofSeconds(30));
}
发布于 2022-11-10 15:55:51
我建议您在(POST) http://localhost:8082/v1/persons/getAllIds上找到该URL,以确保您已经运行了该端点,并使用Postman进行了访问。
https://stackoverflow.com/questions/69826930
复制相似问题