GET "/null/swagger-resources/configuration/ui", parameters={}

今天又踩到一个坑,我在这里记录下来,如哪一天你碰巧也遇到了,那就是我们的缘分。

大致缘故是:前一天还好好的代码,今天一启动就报错,而且还是不停的循环错误:说是swagger有问题,但swagger之前明明是好的,而且这个错误不影响程序正常使用,虽然报错了但swagger还是可以正常打开。

2020-09-14 09:41:42.506 DEBUG 24652 --- [ XNIO-1 task-50] o.s.w.s.r.ResourceHttpRequestHandler     : Resource not found
2020-09-14 09:41:42.506 DEBUG 24652 --- [ XNIO-1 task-50] o.s.web.servlet.DispatcherServlet        : Completed 404 NOT_FOUND
2020-09-14 09:41:42.506 DEBUG 24652 --- [ XNIO-1 task-50] o.s.web.servlet.DispatcherServlet        : "ERROR" dispatch for GET "/error", parameters={}
2020-09-14 09:41:42.506 DEBUG 24652 --- [ XNIO-1 task-50] pertySourcedRequestMappingHandlerMapping : looking up handler for path: /error
2020-09-14 09:41:42.506 DEBUG 24652 --- [ XNIO-1 task-50] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController#error(HttpServletRequest)
2020-09-14 09:41:42.506 DEBUG 24652 --- [ XNIO-1 task-50] o.s.w.s.m.m.a.HttpEntityMethodProcessor  : Using 'application/json', given [application/json] and supported [application/json, application/*+json, application/json, application/*+json]
2020-09-14 09:41:42.506 DEBUG 24652 --- [ XNIO-1 task-50] o.s.w.s.m.m.a.HttpEntityMethodProcessor  : Writing [{timestamp=Mon Sep 14 09:41:42 CST 2020, status=404, error=Not Found, message=Not Found, path=/null/ (truncated)...]
2020-09-14 09:41:42.507 DEBUG 24652 --- [ XNIO-1 task-50] o.s.web.servlet.DispatcherServlet        : Exiting from "ERROR" dispatch, status 404
2020-09-14 09:41:42.510 DEBUG 24652 --- [ XNIO-1 task-51] io.undertow.request.security             : Attempting to authenticate /null/swagger-resources/configuration/ui, authentication required: false
2020-09-14 09:41:42.510 DEBUG 24652 --- [ XNIO-1 task-51] io.undertow.request.security             : Authentication outcome was NOT_ATTEMPTED with method io.undertow.security.impl.CachedAuthenticatedSessionMechanism@5e2a73e8 for /null/swagger-resources/configuration/ui
2020-09-14 09:41:42.510 DEBUG 24652 --- [ XNIO-1 task-51] io.undertow.request.security             : Authentication result was ATTEMPTED for /null/swagger-resources/configuration/ui
2020-09-14 09:41:42.510 DEBUG 24652 --- [ XNIO-1 task-51] o.s.web.servlet.DispatcherServlet        : GET "/null/swagger-resources/configuration/ui", parameters={}
2020-09-14 09:41:42.510 DEBUG 24652 --- [ XNIO-1 task-51] pertySourcedRequestMappingHandlerMapping : looking up handler for path: /null/swagger-resources/configuration/ui
2020-09-14 09:41:42.511 DEBUG 24652 --- [ XNIO-1 task-51] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped to ResourceHttpRequestHandler ["classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/", "/"]

先说说笔者是怎么掉坑里的。现在的Windows 10系统在关机的时候,如果不主动关闭浏览器,下次开机的时候就会自动帮你恢复上次未关闭的网页。

当笔者为了方便,关机就重来不关浏览器。第二天开机,启动带有swagger的Java程序后,浏览器自动打开了昨天恢复的swagger页面,就会一直出现这个错误了。 出坑办法很简单,把之前的swagger页面关掉,重新打开就可以了。

笔者也是在社区里得到的启示,具体请看这里:https://github.com/SpringForAll/spring-boot-starter-swagger/issues/130

本博客采用 知识共享署名-禁止演绎 4.0 国际许可协议 进行许可

本文标题:GET "/null/swagger-resources/configuration/ui", parameters={}

本文地址:https://jizhong.plus/post/2020/09/swagger-error.html