'Not getting any response and error to invoke actuator and prometheus endpoints

Upgrading spring boot kafka console application spring boot and gradle.

  • Spring boot : 2.2.7-RELEASE to 2.4.6
  • gradle: 4.10.3 to 6.9.2

build.gradle

plugins{
   id 'org.springframework.boot' version '2.4.6'
   id 'io.spring.dependency-management' version '1.0.11.RELESE'
   id 'java'
}
sourceCompatibility ='1.8'

dependency-management{
    import {
    mavenBom "org.springframework.cloud:spring-cloud-dependencies:2020.0.4"
    }
}
dependencies{
              implmentation 'org.springframework.boot:spring-boot-starter-data-jdbc'
              implmentation 'org.springframework.boot:spring-boot-starter-web'
              implmentation 'org.springframework.kafka:spring-kafka'
              implmentation 'org.projectlombok.lombok'
              testImplmentation 'org.springframework.boot:spring-boot-starter-test'
              implmentation 'org.springframework.cloud:spring-cloud-starter-config'
              implmentation 'org.springframework.cloud:spring-cloud-starter-bootstrap'
              compile 'org.springframework.boot:spring-boot-starter-webflux'
              implmentation 'org.springframework.boot:spring-boot-starter-data-jpa'
              compile(group: 'org.springframework.boot', name: 'spring-boot-configuaration-processor')
              compile(group: 'com.microsoft.sqlserver', name: 'mssql-jdbc' version: '8.3.1.jre8-preview')
              runtimeOnly 'com.microsoft.sqlserver:mysql-jdbc'
              implmentation 'io.springfox:springfox-swagger2:2.9.2'
              implmentation 'io.springfox:springfox-swagger-ui:2.9.2'
              compile 'org.springframework.boot:spring-boot-starter-actuator'
              compile 'org.projectreactor:reactor-spring'
              implmentation 'io.micrometer:micrometer-registry-prometheus'
              implmentation 'javax.mail:mail:1.4'
              testImplmentation 'junit:junit'
              annotationProcessor 'org.projectlombok:lombok'
              
}
wrapper{
  distribuationUrl = "https://services.gradle.org/distributions/gradle-6.9.2-bin"

}

Main class:

@SpringBootApplication(exclude={DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class,HibernateJpaAutoConfiguration.class})
@EnableKafka
@EnableScheduling
public class SpringBootMainClassApplication {
    public static void main(String[] args) {
    
        SpringApplication.run(SpringBootMainClassApplication.class, args);
    }
}

Application.properties file

server.port=8181
springdoc.show.actuator=true
management.server.port= 9090
management.endpoints.web.base-path=/
management.endpoints.web.path-mapping.prometheus=.metrics
management.endpoints.web.exposure.include=health,mappings,beans,metrics,prometheus
management.endpoints.beans.enabled=true
management.endpoints.health.show-details=always
management.health.ldap.enabled=false

spring.main.web-application-type=none

Application was started fine with older version and without add spring.main.web-application-type=none property, more details to refer Spring boot kafka application is not start as console app after upgrading gradle and spring boot version

Now prometheus endpoints are not retuning any response and error, not found any error to app console

Endpoints:

http://localhost:9090/.metrics http://localhost:9090/health

We have removed all above management properties and tried to invoke actuator endpoints but there also same issue.

Endpoints: http://localhost:8181/actuator/health http://localhost:8181/actuator

Actuator and Prometheus endpoints were working fine with older version and gradle, Can you please help us in that?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source