Hello team,
We use a mockserver to run our UI Integration Tests and the purpose of this mockserver is to run the spring boot application, while the server is ready, which will be indicated by a text: "Server is ready! Continuing...", the mockui and the UI tests will start running.
Recently, we have been facing an issue with starting the server as Initializing Spring DispatcherServlet 'dispatcherServlet' isn't starting.
We have attached logs where the run is successful and not.
In both successful and failure logs, this error is seen:
[server] java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
Despite that, the DispatcherServlet is initialized in the successful log, in the failure one, it isn;t.
We already have a cacheConfig file, which is implemented
@Configuration
public class CacheConfig {
@Bean
@Scope(scopeName = "requestWithFallback", proxyMode = ScopedProxyMode.TARGET_CLASS)
public CacheManager requestScopedCacheManager() {
return new ConcurrentMapCacheManager();
}
}
Also in the files where the above error is thrown, we have,
@Scheduled(fixedRate = Constants.CACHE_CLEAN_INTERVAL)
public void removeDestinationAuthToken() {
Cache cache = this.cacheManager.getCache(Constants.XXX);
if (cache != null)
cache.clear();
}
But the point is the two set of codes are available in both successful and failing scenarios. Then why in one instance there are issues with starting the server?
Spring version in both cases: 2.7.12
Please help us in resolving this.
Regards, Keerthana
Comment From: scottfrederick
@sKeer89 Thanks for getting in touch. There appears to be a lot going on here, and we won't be able to provide assistance without more details on what the code is doing. Please provide a complete minimal sample that reproduces the problem. The sample should have the smallest set of dependencies possible while reproducing the problem, and should have instructions for us to build and run the project in a way that shows the error. You can share it with us by pushing it to a separate repository on GitHub or by zipping it and attaching it to this issue.
Comment From: spring-projects-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Comment From: spring-projects-issues
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.