Hot questions for Spring Boot Admin

Top 10 Java Open Source / Spring / Spring Boot Admin

Question:

I'm currently running Spring Boot Admin on my local machine for testing purposes and I'm getting the following error nonstop. The application itself seems to be working fine, but my logs are getting filled with these errors. I'm not sure why...

 org.springframework.web.context.request.async.AsyncRequestTimeoutException: null
    at org.springframework.web.context.request.async.TimeoutDeferredResultProcessingInterceptor.handleTimeout(TimeoutDeferredResultProcessingInterceptor.java:42) ~[spring-web-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
    at org.springframework.web.context.request.async.DeferredResultInterceptorChain.triggerAfterTimeout(DeferredResultInterceptorChain.java:75) ~[spring-web-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
    at org.springframework.web.context.request.async.WebAsyncManager$5.run(WebAsyncManager.java:392) ~[spring-web-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
    at org.springframework.web.context.request.async.StandardServletAsyncWebRequest.onTimeout(StandardServletAsyncWebRequest.java:143) ~[spring-web-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]
    at org.apache.catalina.core.AsyncListenerWrapper.fireOnTimeout(AsyncListenerWrapper.java:44) ~[tomcat-embed-core-8.5.5.jar!/:8.5.5]
    at org.apache.catalina.core.AsyncContextImpl.timeout(AsyncContextImpl.java:131) ~[tomcat-embed-core-8.5.5.jar!/:8.5.5]
    at org.apache.catalina.connector.CoyoteAdapter.asyncDispatch(CoyoteAdapter.java:157) ~[tomcat-embed-core-8.5.5.jar!/:8.5.5]
    at org.apache.coyote.AbstractProcessor.dispatch(AbstractProcessor.java:228) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:53) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1410) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_40]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_40]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_40]

Answer:

I also had similar error. try this property in you application.yml

spring:
  mvc:
    async:
      request-timeout: -1  

Question:

I am setting up the spring boot admin using spring cloud. Now I have set up a stand alone eureka server and one spring boot admin and some spring boot apps as admin clients. If I don't set management.context-path for all the clients, everything works fine. But Now I need to monitor all clients(some with no management.context-path, some with different management.context-paths). I know that I should use the meta-data to achieve this, but after reading the relative docs, I still could get this done. Here are my configurations on client and admin sides.

Client side:

spring:
  application:
    instance_id: user
    name: microservice-provider-user
management:
  context-path: '/mgmt'
eureka:
  client:
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/
  instance:
    preferIpAddress: false
    statusPageUrlPath: ${management.context-path}${endpoints.info.path:/info}
    healthCheckUrlPath: ${management.context-path}${endpoints.health.path:/health}
    metadata-map:
      instanceId:
${spring.application.name}:${spring.application.instance_id:${random.value}}

Admin side:

spring:
  application:
    name: wahaha-admin
  boot:
    admin:
      routes:
        endpoints: env,metrics,trace,dump,jolokia,info,configprops,trace,logfile,refresh,flyway,liquibase,heapdump,hystrix.stream,turbine.stream

      url: http://${HOST_NAME:localhost}:${server.port}
      discovery:
        converter.management-context-path: '/mgmt'

Questions:

  1. I set the spring.boot.admin.discovery.converter.management-context-path to be /mgmt, the value is the same as the client side and this only works fine if I set all the client apps with the same value, and this is impossible. How should I do to support different management.context-path?

PS: I did all of these on my local desktop not on any public cloud, and will move to the product env later(still not using public cloud).


Answer:

On the client:

eureka:
  instance:
    metadata-map:
      management.context-path: ${management.context-path}

As described in the docs:

If you want to customize the default conversion of services you can either add health.path, management.port and/or mangament.context-path entries to the services metadata.

Question:

I try to run Eureka Server and Spring Boot Admin Server in one Application (SBA Docu says this is possible). Eureka is working as intended but the Admin App still shows zero Applications.

Spring Boot Version 2.0.3, Spring Boot Admin Version 2.0.1

Eureka and SBA Server

@SpringBootApplication
@EnableEurekaServer
@EnableDiscoveryClient
@EnableAdminServer
class KotlintestApplication
fun main(args: Array<String>) {
    SpringApplication.run(KotlintestApplication::class.java, *args)
}

Server bootstrap.yml

spring:
      application:
        name: server

Server application.yml

spring:
  boot:
   admin:
     context-path: /admin

eureka:
  instance:
    leaseRenewalIntervalInSeconds: 10
  client:
    registerWithEureka: false
    fetchRegistry: false
    serviceUrl:
      defaultZone: http://localhost:8080/eureka

Client

@EnableDiscoveryClient
@SpringBootApplication
class KotlintestApplication

fun main(args: Array<String>) {
    SpringApplication.run(KotlintestApplication::class.java, *args)
}

@Configuration
class SecurityPermitAllConfig : WebSecurityConfigurerAdapter() {
    @Throws(Exception::class)
    override fun configure(http: HttpSecurity) {
        http.authorizeRequests().anyRequest().permitAll()
                .and().csrf().disable()
    }
}

Client bootstrap.yml

 spring:
      application:
        name: client
 server:
    port: 0

Client application.yml

management:
  endpoints:
    web:
      exposure:
        include: "*"
  endpoint:
    health:
      show-details: ALWAYS

eureka:
  instance:
    hostname: localhost
    health-check-url-path: /actuator/health
    status-page-url-path: /actuator/info
  client:
    serviceUrl:
      defaultZone: http://127.0.0.1:8080/eureka/

Answer:

Found the answer myself

Remove the fetchRegistry: false from the server application.yaml. The Server has to fetch the registry to see the clients ...

Btw: You should set an instanceId if you want to run multiple instances with a random port on the same host. Otherwise SBA can't differ between the instances.

eureka:
  instance:
    instanceId : client-${random.uuid}

Question:

We are developing a Boot-Admin dashboard using the codecentric provided library of spring-boot-admin-server version 1.4.5

Some of the applications are registering itself with the server via Eureka, and some directly using the spring-boot-admin-starter-client version 1.4.5.

All components are deployed on a PCF environment and are communication over HTTPS. In either ways, the applications though are able to register themselves with the admin sever but are showing up as OFFLINE only. There are no errors reported in the logs for any of the components viz. admin-server, admin-client, eureka-server, eureka-client.

However the only application showing as Up is the admin server itself.

The application properties for spring-boot-admin-client app to run in PCF is:

spring:
  application:
    name: bootadmin-ms-charlie
  boot:
    admin:
      url: https://bootadmin-dashboard.abc.intl.com

ssl:
  trust_store:
    path: classpath:ssl/sslcacert.jks
    password: a-password

As the result is same for both methods of registration, I've skipped putting the config here for apps registering via Eureka path to keep it simple.

The same is working perfectly fine locally, where the admin dashboard shows all the applications as expected.

Is there any configuration that needs to be done in specific to Cloud Foundry? Or any obvious mistake that I might have made?

Any suggestions are most welcome.

---EDIT---

Here are the logs from SBA server showing that the communication between server and client is working okay. If these logs give any indication of an error, please point out.

OUT 2017-01-23 05:15:15.139 DEBUG 10 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : DispatcherServlet with name 'dispatcherServlet' processing POST request for [/api/applications]
OUT 2017-01-23 05:15:15.151 DEBUG 10 --- [nio-8080-exec-1] m.m.a.RequestResponseBodyMethodProcessor : Read [class de.codecentric.boot.admin.model.Application] as "application/json;charset=UTF-8" with [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter@7df33a9f]
OUT 2017-01-23 05:15:15.163 DEBUG 10 --- [nio-8080-exec-1] o.s.w.s.m.m.a.HttpEntityMethodProcessor  : Written [Application [id=3805ee6a, name=bootadmin-ms-charlie, managementUrl=http://23fcf304-82d6-44cd-7fce-2a5027de9f21:8080, healthUrl=http://23fcf304-82d6-44cd-7fce-2a5027de9f21:8080/health, serviceUrl=http://23fcf304-82d6-44cd-7fce-2a5027de9f21:8080]] as "application/json" using [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter@7df33a9f]
OUT 2017-01-23 05:15:15.166 DEBUG 10 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Null ModelAndView returned to DispatcherServlet with name 'dispatcherServlet': assuming HandlerAdapter completed request handling
OUT 2017-01-23 05:15:15.166 DEBUG 10 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Successfully completed request
OUT bootadmin-dashboard.abc-intl.com - [23/01/2017:05:15:15.140 +0000] "POST /api/applications HTTP/1.1" 201 302 308 "-" "Java/1.8.0_121" 60.16.25.20:43224 x_forwarded_for:"10.10.10.10" x_forwarded_proto:"https" vcap_request_id:a40159e4-543f-40e0-627e-e8f1e7688b99 response_time:0.034164523 app_id:adcc8a33-83f4-448d-9ae2-bf2a2b16ea72
OUT 2017-01-23 05:15:18.719 DEBUG 10 --- [    updateTask1] o.s.web.client.RestTemplate              : Created GET request for "http://23fcf304-82d6-44cd-7fce-2a5027de9f21:8080/health"
OUT 2017-01-23 05:15:18.722 DEBUG 10 --- [    updateTask1] o.s.web.client.RestTemplate              : Setting request Accept header to [application/json, application/*+json]

The logs from client are all clean. It throws warning of "Failed to refister" only when the server is down.


Answer:

Based upon the discussion on https://github.com/codecentric/spring-boot-admin/issues/399 it has been found out that below properties are vital for SBA clients to work with Dashboard on Cloud Foundry or container based architecture: spring: boot: admin: client: management-url: <complete management-url for the client> health-url: <complete health endpoint url for the client> service-url: <complete root/service url for the client>

This is due to the fact that, when a client registers itself with the SBA server it uses the runC container ID to form its service url. Such url is not valid for the Cloud Foundry router. That results in failure of communication between SBA dashboard and the client later on, causing it to show as OFFLINE.

The other approach can be to go ahead with container IPs, using spring.boot.admin.client.prefer-ip=true. That would list all containers/CF instacnes on SBA but not give a clear picture of overall health of the complete app from a site/AZ. Also direct connection to containers is never encouraged in CF as per the principles of cloud-native app and 12-factors.