【问题标题】:Spring Boot 2.1.6.RELEASE - Actuator not available HTTP 404Spring Boot 2.1.6.RELEASE - 执行器不可用 HTTP 404
【发布时间】:2019-08-07 10:11:38
【问题描述】:

尝试在 Spring Boot Web 应用程序中使用执行器。我不知道这是否重要,但 Web 应用程序作为 WAR 部署在独立的 Tomcat 9 服务器上。

我得到了以下依赖项:

...
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
...
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-tomcat</artifactId>
  <scope>provided</scope>
  <exclusions>
    <exclusion>
      <artifactId>tomcat-embed-el</artifactId>
      <groupId>org.apache.tomcat.embed</groupId>
    </exclusion>
    <exclusion>
      <artifactId>tomcat-embed-core</artifactId>
      <groupId>org.apache.tomcat.embed</groupId>
    </exclusion>
    <exclusion>
      <artifactId>tomcat-embed-websocket</artifactId>
      <groupId>org.apache.tomcat.embed</groupId>
    </exclusion>
  </exclusions>
</dependency>
</dependency>
...
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-web</artifactId>
  <exclusions>
    <exclusion>
      <artifactId>tomcat-embed-el</artifactId>
      <groupId>org.apache.tomcat.embed</groupId>
    </exclusion>
    <exclusion>
      <artifactId>tomcat-embed-core</artifactId>
      <groupId>org.apache.tomcat.embed</groupId>
    </exclusion>
    <exclusion>
      <artifactId>tomcat-embed-websocket</artifactId>
      <groupId>org.apache.tomcat.embed</groupId>
    </exclusion>
  </exclusions>
</dependency>
...

在 application.yml 文件中我有:

...
management:
  server:
    port: 8080
    address: localhost
  endpoints:
    web:
      exposure:
        include: "*"
...

Tomcat 日志文件 (catalina.out) 说:

...
2019-08-07 11:51:04.433  INFO 6913 --- [nio-8080-exec-4] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 15 endpoint(s) beneath base path '/actuator'
...

但是,当我转到 http://localhost:8080/actuator 时,我得到 404。我在这里错过了什么?

非常感谢。

亲切的问候,

尼古拉斯

【问题讨论】:

  • 由于 spring boot 2 执行器属于 actuator/&lt;endpoint&gt; 例如actuator/health
  • 确切地说,执行器属于/actuator,而不同的端点,即健康,属于/actuator/healh。

标签: spring-boot spring-boot-actuator tomcat9


【解决方案1】:

正确的网址是http://host:port/war-name/actuator。

抱歉打扰了。

【讨论】:

    猜你喜欢
    • 2021-08-11
    • 1970-01-01
    • 1970-01-01
    • 2019-11-09
    • 1970-01-01
    • 1970-01-01
    • 2020-04-10
    • 1970-01-01
    • 2018-12-31
    相关资源
    最近更新 更多