-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Infinity loop when starting spring boot server #2907
Comments
i don't really understand what is happening under the covers. I have tried debugging but as it seems is that if you don't explicitly set
To forward slash, the front end gui will DDOS your application under the covers, and you will not see this unless you run your spring boot in debug mode. when front end is building it's path it has some value defaulted to null, and if it doesn't get something, it then builds it's path containing the null value. I don't know if this is a bug, or there should be added a default value instead of the null as default. |
@Tandolf Hello, Was it something like this? |
hi @lombocska i wrote my solution. As you can see, i solved it by explicitly setting the pathMapping value to "/" in my docket. If i omitted this setting, the springfox front end gui would as i said loop over some sort of request to the backend trying to fetch something on ${myApplicationName}/null/configuration/ui I have no idea whats happening under the hood. My guess is that the springfox gui does a call at startup back to the frontend to fetch its configuration settings. If you don't explicitly set the pathMapping it will default build some sort of URL with the value null in it. |
this is the solution
|
:) @Tandolf Now, the the pathMapping works, thank you!!
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
this is still an issue and should not be closed. |
it happens also with: |
@colameo this should be fixed in the 3.0.0-SNAPSHOT that is releasing shortly |
This should now be fixed |
I don't think this is fixed. |
I am getting this in 2.9.2 |
I believe this issue should not be closed , I am still facing same issue with following code changes
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build()
.pathMapping("/");
} Getting Error in infinity loop after starting server : null/swagger-resources/configuration/ui |
I'm also still getting this exception.. very weird. Added Update for no obvious reason, rebooting my computer did the trick. Invalidate cache of IntelliJ did not solve it. |
In my case it was old swagger (from previous app launch) openned in browser who did this calls |
Still an issue, experienced this in 3.0.0 |
In my case, the issue was the same |
To me it seems more like possible timing issue in the frontend code to me? https://github.com/springfox/springfox/blob/2.9.2/springfox-swagger-ui/src/web/js/springfox.js At window load it seems to try to get the base url and I think the result is null at point const getBaseURL = () => { const urlMatches = /(.)/swagger-ui.html./.exec(window.location.href); return urlMatches[1]; }; This result is then used in /* Entry Point */ And inside buildSystemAsync there is a exception catch clause which basically just retries the same thing over and over, although it seems that the intention is to prompt the user for input? Maybe it is a race-condition where other code triggers a page reload which again triggers the code above. } catch (e) { const retryURL = await prompt( "Unable to infer base url. This is common when using dynamic servlet registration or when" + " the API is behind an API Gateway. The base url is the root of where" + " all the swagger resources are served. For e.g. if the api is available at http://example.org/api/v2/api-docs" + " then the base url is http://example.org/api/. Please enter the location manually: ", window.location.href); Not being a frontend developer, I looked up wat the prompt function does and I think that if you combine it with await that it may time out and then use the default value mentioned with the prompt function, in this case window.location.href and that is when the loop starts. But this is purely speculation and needs a frontend dev to look at it. |
In my case with Swagger 3.0.0 - especially io.springfox:springfox-boot-starter - specifying the spring-boot URL context-path solved this loop:
Warning: It will change the base path of all web services, not only Swagger |
Had the same looping issue using springfox-boot-starter version 3.0.0. with windows, and intellij
apparently for me that was the problem. I had opened the local application at the url of the old swagger: And I saw that it was still there, I closed the tab, ran the application again and opened it in the new url of openapi 3.0: I believe that was it, because before I tried to change the application.yml and docket settings according to what the colleagues above said and it didn't work. |
...don't waste your time and switch to spring-doc |
I have the same issue. why PropertySourcedRequestMappingHandlerMapping is loging infinity log for looking up handler for path: /error |
You cant close this issue, it's not be solved. |
SpringFox + Spring Boot 에서 버그가 있음 (springfox/springfox#2907)
Springfox version 2.9.2
Spring boot 2.1.2.RELEASE
im getting an infinite loop when starting up.
@Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2) .useDefaultResponseMessages(false) .select() .apis(RequestHandlerSelectors.basePackage("my.package.yay")) .paths(PathSelectors.any()) .build() .apiInfo(apiInfo());
2019-02-15 17:52:20.702 DEBUG 58784 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet : "ERROR" dispatch for GET "/bank-transfer-calculation-service/error", parameters={} 2019-02-15 17:52:20.703 DEBUG 58784 --- [nio-8080-exec-5] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest) 2019-02-15 17:52:20.703 DEBUG 58784 --- [nio-8080-exec-5] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Using 'application/json', given [application/json] and supported [application/json, application/*+json, application/json, application/*+json] 2019-02-15 17:52:20.703 DEBUG 58784 --- [nio-8080-exec-5] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Writing [{timestamp=Fri Feb 15 17:52:20 CET 2019, status=404, error=Not Found, message=No message available, path=/bank-transfer-calculation-service/null/swagger-resources}] 2019-02-15 17:52:20.704 DEBUG 58784 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet : Exiting from "ERROR" dispatch, status 404 2019-02-15 17:52:20.710 DEBUG 58784 --- [nio-8080-exec-6] o.s.web.servlet.DispatcherServlet : GET "/bank-transfer-calculation-service/null/swagger-resources/configuration/ui", parameters={} 2019-02-15 17:52:20.711 DEBUG 58784 --- [nio-8080-exec-6] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped to ResourceHttpRequestHandler ["classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/", "/"] 2019-02-15 17:52:20.711 DEBUG 58784 --- [nio-8080-exec-6] o.s.w.s.r.ResourceHttpRequestHandler : Resource not found 2019-02-15 17:52:20.711 DEBUG 58784 --- [nio-8080-exec-6] o.s.web.servlet.DispatcherServlet : Completed 404 NOT_FOUND 2019-02-15 17:52:20.712 DEBUG 58784 --- [nio-8080-exec-6] o.s.web.servlet.DispatcherServlet : "ERROR" dispatch for GET "/bank-transfer-calculation-service/error", parameters={} 2019-02-15 17:52:20.712 DEBUG 58784 --- [nio-8080-exec-6] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest) 2019-02-15 17:52:20.713 DEBUG 58784 --- [nio-8080-exec-6] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Using 'application/json', given [application/json] and supported [application/json, application/*+json, application/json, application/*+json] 2019-02-15 17:52:20.713 DEBUG 58784 --- [nio-8080-exec-6] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Writing [{timestamp=Fri Feb 15 17:52:20 CET 2019, status=404, error=Not Found, message=No message available, path=/bank-transfer-calculation-service/null/swagger-resources/configuration/ui}] 2019-02-15 17:52:20.714 DEBUG 58784 --- [nio-8080-exec-6] o.s.web.servlet.DispatcherServlet : Exiting from "ERROR" dispatch, status 404 2019-02-15 17:52:20.718 DEBUG 58784 --- [nio-8080-exec-7] o.s.web.servlet.DispatcherServlet : GET "/bank-transfer-calculation-service/null/swagger-resources/configuration/security", parameters={} 2019-02-15 17:52:20.720 DEBUG 58784 --- [nio-8080-exec-7] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped to ResourceHttpRequestHandler ["classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/", "/"] 2019-02-15 17:52:20.721 DEBUG 58784 --- [nio-8080-exec-7] o.s.w.s.r.ResourceHttpRequestHandler : Resource not found 2019-02-15 17:52:20.721 DEBUG 58784 --- [nio-8080-exec-7] o.s.web.servlet.DispatcherServlet : Completed 404 NOT_FOUND 2019-02-15 17:52:20.722 DEBUG 58784 --- [nio-8080-exec-7] o.s.web.servlet.DispatcherServlet : "ERROR" dispatch for GET "/bank-transfer-calculation-service/error", parameters={} 2019-02-15 17:52:20.724 DEBUG 58784 --- [nio-8080-exec-7] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest) 2019-02-15 17:52:20.726 DEBUG 58784 --- [nio-8080-exec-7] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Using 'application/json', given [application/json] and supported [application/json, application/*+json, application/json, application/*+json] 2019-02-15 17:52:20.726 DEBUG 58784 --- [nio-8080-exec-7] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Writing [{timestamp=Fri Feb 15 17:52:20 CET 2019, status=404, error=Not Found, message=No message available, path=/bank-transfer-calculation-service/null/swagger-resources/configuration/security}] 2019-02-15 17:52:20.727 DEBUG 58784 --- [nio-8080-exec-7] o.s.web.servlet.DispatcherServlet : Exiting from "ERROR" dispatch, status 404 2019-02-15 17:52:20.731 DEBUG 58784 --- [nio-8080-exec-8] o.s.web.servlet.DispatcherServlet : GET "/bank-transfer-calculation-service/null/swagger-resources", parameters={} 2019-02-15 17:52:20.732 DEBUG 58784 --- [nio-8080-exec-8] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped to ResourceHttpRequestHandler ["classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/", "/"] 2019-02-15 17:52:20.733 DEBUG 58784 --- [nio-8080-exec-8] o.s.w.s.r.ResourceHttpRequestHandler : Resource not found 2019-02-15 17:52:20.734 DEBUG 58784 --- [nio-8080-exec-8] o.s.web.servlet.DispatcherServlet : Completed 404 NOT_FOUND 2019-02-15 17:52:20.734 DEBUG 58784 --- [nio-8080-exec-8] o.s.web.servlet.DispatcherServlet : "ERROR" dispatch for GET "/bank-transfer-calculation-service/error", parameters={} 2019-02-15 17:52:20.735 DEBUG 58784 --- [nio-8080-exec-8] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest) 2019-02-15 17:52:20.735 DEBUG 58784 --- [nio-8080-exec-8] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Using 'application/json', given [application/json] and supported [application/json, application/*+json, application/json, application/*+json] 2019-02-15 17:52:20.735 DEBUG 58784 --- [nio-8080-exec-8] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Writing [{timestamp=Fri Feb 15 17:52:20 CET 2019, status=404, error=Not Found, message=No message available, path=/bank-transfer-calculation-service/null/swagger-resources}] 2019-02-15 17:52:20.736 DEBUG 58784 --- [nio-8080-exec-8] o.s.web.servlet.DispatcherServlet : Exiting from "ERROR" dispatch, status 404 2019-02-15 17:52:20.742 DEBUG 58784 --- [nio-8080-exec-9] o.s.web.servlet.DispatcherServlet : GET "/bank-transfer-calculation-service/null/swagger-resources/configuration/ui", parameters={} 2019-02-15 17:52:20.743 DEBUG 58784 --- [nio-8080-exec-9] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped to ResourceHttpRequestHandler ["classpath:/ME
Why is it looking for path: "/bank-transfer-calculation-service/null/swagger-resources/configuration/ui"?
Whats the null value?
The text was updated successfully, but these errors were encountered: