背景资料
我有一个Sping Boot Web应用程序,使用Actuator作为生产实用程序。
应用程序工作正常,管理端口工作得很好。我可以浏览统计数据,检查健康状况等。我还启用了远程关闭端点,它正确地显示在端点的localhost:{mgmt_port}/actuator列表中。
我的问题
当我转到localhost:{mgmt_port}/shutdown时,我看到:
<Map>
<timestamp>1453905900007</timestamp>
<status>500</status>
<error>Internal Server Error</error>
<exception>org.springframework.web.HttpRequestMethodNotSupportedException</exception>
<message>Request method 'GET' not supported</message>
<path>/shutdown</path>
</Map>
有用信息
- 在点击关闭链接后,整个应用程序似乎仍然在运行。我仍然可以从自定义应用程序端点提取数据。
- Spring actuator提供的管理URL在点击关机后似乎仍然运行良好。
下发前控制台输出
10:01:42.496 [main] INFO o.s.b.c.e.t.TomcatEmbeddedServletContainer - Tomcat在端口上启动:8002(http)10:01:42.499 [main] INFO com.xyz.API.Main -启动Main用时5.956秒(JVM运行时间为6.381)
下发后控制台输出
10:03:29.090 [http-nio-8003-exec-1] INFO o.a.c.c.C.[Tomcat-1].[localhost].[/] - Initializing Spring FrameworkServlet 'dispatcherServlet' 10:03:29.090 [http-nio-8003-exec-1] INFO o.s.web.servlet.DispatcherServlet - FrameworkServlet 'dispatcherServlet':initialization started 10:03:29.126 [http-nio-8003-exec-1] INFO o.s.web.servlet.DispatcherServlet - FrameworkServlet 'dispatcherServlet':initialization completed in 36 ms 10:03:29.151 [http-nio-8003-exec-1] ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] - Servlet.service()for servlet [dispatcherServlet] in context with path [] throughed exception [Request method 'GET' not supported] with root cause org.springframework.web.HttpRequestMethodNotSupportedException:org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping.handleNoMatch(RequestMappingInfoHandlerMapping.java:204)~[spring-webmvc-4.2.4.RELEASE.jar!/:4.2.4.RELEASE] at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.lookupHandlerMethod(AbstractHandlerMethodMapping.java:382)~[spring-webmvc-4.2.4.RELEASE.jar!/:4.2.4.RELEASE] at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.getHandlerInternal(AbstractHandlerMethodMapping.java:322)~[spring-webmvc-4.2.4.RELEASE.jar!/:4.2.4.RELEASE] at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.getHandlerInternal(AbstractHandlerMethodMapping.java:60)~[spring-webmvc-4.2.4.RELEASE.jar!/:4.2.4.RELEASE] at org.springframework.web.servlet.handler.AbstractHandlerMapping.getHandler(AbstractHandlerMapping.java:351)~[spring-webmvc-4.2.4.RELEASE.jar!/:4.2.4.RELEASE] at org.springframework. Boot .actuate.autoconfigure.EndpointWebMvcChildContextConfiguration$CompositeHandlerMapping.getHandler(EndpointWebMvcChildContextConfiguration.java:212)~[spring-boot-actuator-1.3.2.RELEASE.jar!/:1.3.2.RELEASE] at org.springframework.web.servlet.DispatcherServlet.getHandler(DispatcherServlet.java:1120)~[spring-webmvc-4.2.4.RELEASE.jar!/:4.2.4.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:932)~[spring-webmvc-4.2.4.RELEASE.jar!/:4.2.4.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)~[spring-webmvc-4.2.4.RELEASE.jar!/:4.2.4.RELEASE] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:969)~[spring-webmvc-4.2.4.RELEASE.jar!/:4.2.4.RELEASE] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:860)~[spring-webmvc-4.2.4.RELEASE.jar!/:4.2.4.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)~[tomcat-embed-core-8.0.30.jar!/:8.0.30] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:845)~[spring-webmvc-4.2.4.RELEASE.jar!/:4.2.4.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)~[tomcat-embed-core-8.0.30.jar!/:8.0.30] at org.apache. Catalina .core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)~[tomcat-embed-core-8.0.30.jar!/:8.0.30] at org.apache. Catalina .core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)~[tomcat-embed-core-8.0.30.jar!/:8.0.30] at org.apache. Catalina .core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)~[tomcat-embed-core-8.0.30.jar!/:8.0.30] at org.apache. Catalina .core.StandardContextValve.invoke(StandardContextValve.java:106)[tomcat-embed-core-8.0.30.jar!/:8.0.30] at org.apache. Catalina .authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)[tomcat-embed-core-8.0.30.jar!/:8.0.30] at org.apache. Catalina .core.StandardHostValve.invoke(StandardHostValve.java:141)[tomcat-embed-core-8.0.30.jar!/:8.0.30] at org.apache. Catalina .valves.ErrorReportValve.invoke(ErrorReportValve.java:79)[tomcat-embed-core-8.0.30.jar!/:8.0.30] at org.apache. Catalina .core.StandardEngineValve.invoke(StandardEngineValve.java:88)[tomcat-embed-core-8.0.30.jar!/:8.0.30] at org.apache. Catalina .connector.CoyoteAdapter.service(CoyoteAdapter.java:521)[tomcat-embed-core-8.0.30.jar!/:8.0.30] at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1096)[tomcat-embed-core-8.0.30.jar!/:8.0.30] at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:674)[tomcat-embed-core-8.0.30.jar!/:8.0.30] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)[tomcat-embed-core-8.0.30.jar!/:8.0.30] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)[tomcat-embed-core-8.0.30.jar!/:8.0.30] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)[na:1.8.0_51] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)[na:1.8.0_51] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)[tomcat-embed-core-8.0.30.jar!/:8.0.30]在java.lang.Thread.run(未知源)[na:1.8.0_51]
1条答案
按热度按时间hgb9j2n61#
回答自己的问题,在未来帮助他人。我是个笨蛋...
/actuator
URL列出了所有可用的命令,所有这些命令都基于GET
请求工作。/shutdown
URL实际上需要发送HTTP POST
才能激活它。我在文档中没有看到这一点。CURL命令示例:
关机命令输出: