简体   繁体   中英

feign client internal server exception (rest template didnt work either)

The last time i've posted i got an accessing token error. I also tried with rest template; still the same error.

"timestamp": 1597323995055,
"status": 500,
"error": "Internal Server Error",
"message": "Error requesting access token.",
"path": "/api/dashboard"

}

My code looks like this;

Controller.class

@RestController
@RequestMapping("/api/dashboard")
@AllArgsConstructor
public class LexcorpIntegrationController {
  private final TestServicee testServicee;

  @GetMapping
  public List<IncidentTasksResponse> getIT() {
    return testServicee.getFeign();
  }

  /*

This is Service.class

@Service
@AllArgsConstructor
public class TestServicee {

  private final LexcorpProxy proxy;

  private final RestTemplate restTemplate;

  public List<IncidentTasksResponse> getIT() {
    DateFilter dto = new DateFilter();
    dto.setDate(null);

    WrapperEntity wrapperEntity =
        restTemplate.getForObject(
            "http://im-sure-url-is-correct",
            WrapperEntity.class,
            dto);
    List<IncidentTasksResponse> tasks = wrapperEntity.getList();
    return tasks;
  }

  public List<IncidentTasksResponse> getFeign() {
    DateFilter filter = new DateFilter();
    filter.setDate(null);
    return proxy.getAllIncidentTasks(filter);
  }
}

Client.interface

@Component
@FeignClient(name = "lexcorp", url = "url-is-correct")
public interface LexcorpProxy {

  @PostMapping("/IncidentTasks")
  List<IncidentTasksResponse> getAllIncidentTasks(DateFilter date);
}

The first thing i wanna say is; i use a 3rdPartyVpn to access data. But another code that i wrote (2) worked so, thats not the case here.

1- This is Spring Cloud, so it gets dependencies from another microservice etc. Later, i added dependencies in pom.xml anyways.Still didnt work.

2- Try to create simple feign application in my local. (other one is also in my local anyways) It worked. I can get data from the api.

3- The parameter that i wrote inside the client method is correct.

All answers will be appreciated. Am i missing something? Even a lil explanation would help me.

I tried everything and didnt solve the problem. I used my other application instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM