Java 在spring boot restTemplate.exchange上间歇性接收StackOverflower错误

Java 在spring boot restTemplate.exchange上间歇性接收StackOverflower错误,java,spring-boot,get,stack-overflow,resttemplate,Java,Spring Boot,Get,Stack Overflow,Resttemplate,下面是我用于restemplate的逻辑。对于发出的1000个请求,有50个请求间歇性失败。我必须触发一个GET请求,该请求在响应中发送List。因此使用了参数化类型引用 日志程序“Outbound request”显示在日志中,之后我收到:org.springframework.web.util.NestedServletException:处理程序调度失败;嵌套的异常是java.lang.StackOverflowerError 记录器“入站响应”未显示 代码: private RestTe

下面是我用于
restemplate
的逻辑。对于发出的1000个请求,有50个请求间歇性失败。我必须触发一个GET请求,该请求在响应中发送
List
。因此使用了
参数化类型引用

日志程序“Outbound request”显示在日志中,之后我收到:
org.springframework.web.util.NestedServletException:处理程序调度失败;嵌套的异常是java.lang.StackOverflowerError

记录器“入站响应”未显示

代码:

private RestTemplate restTemplate;

public List<Students> getConsents(Long managementid) {

        List<Students> studentList = new ArrayList<>();

        RequestEntity<String> requestEntity = buildRequestEntity(managementid);

        ResponseEntity<List<Students>> response = null;

    LOGGER.info("Outbound request");    
        response = restTemplate.exchange(requestEntity, new ParameterizedTypeReference<List<Students>>() {});
LOGGER.info("Inbound response");
        if(null != response &&  response.getStatusCode().is2xxSuccessful())
            studentList = response.getBody();

        return studentList;
    }

    private RequestEntity<String> buildRequestEntity(Long managementid) {
        HttpHeaders headers = new HttpHeaders();
        headers.set("Accept", MediaType.APPLICATION_JSON_VALUE);
        
        URI uri = UriComponentsBuilder.fromHttpUrl(url)
                .queryParam("managementid", managementid)
                .build()
                .toUri();
                
        return new RequestEntity<>(headers, HttpMethod.GET, uri);
    }
org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.StackOverflowError
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1053)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
    at ....
 .....
at java.base/sun.nio.ch.Invoker$2.run(Invoker.java:219)
    at java.base/sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.StackOverflowError: null
    at java.base/java.util.Collections$UnmodifiableCollection.isEmpty(Collections.java:1033)
    at java.base/java.util.Collections$UnmodifiableCollection.isEmpty(Collections.java:1033)
    at java.base/java.util.Collections$UnmodifiableCollection.isEmpty(Collections.java:1033)
    at java.base/java.util.Collections$UnmodifiableCollection.isEmpty(Collections.java:1033)
    at java.base/java.util.Collections$UnmodifiableCollection.isEmpty(Collections.java:1033)
    at java.base/java.util.Collections$UnmodifiableCollection.isEmpty(Collections.java:1033)
    at java.base/java.util.Collections$UnmodifiableCollection.isEmpty(Collections.java:1033)
    at java.base/java.util.Collections$UnmodifiableCollection.isEmpty(Collections.java:1033)
    ......
    
如果我使用了
restmplate
错误,或者您知道我收到此错误的原因,请帮助我。这发生在我们的生产环境中,我无法在我们的测试环境中重现它。所有的异常处理都完成了,我只是没有把它粘贴到这里