标签: spring-boot-admin

Spring Boot管理日志中重复发生的AsyncRequestTimeoutException

我目前正在我的本地计算机上运行Spring Boot Admin以进行测试,并且我得到以下错误不间断.应用程序本身似乎工作正常,但我的日志正在填补这些错误.我不确定为什么......

 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]
Run Code Online (Sandbox Code Playgroud)

java spring spring-boot spring-boot-admin

5
推荐指数
2
解决办法
8326
查看次数

如何在eureka发现环境下正确设置spring boot admin客户端的management.context-path?

我正在使用spring cloud设置spring boot管理员.现在我已经建立了一个独立的eureka服务器和一个spring boot管理员和一些spring boot应用程序作为管理员客户端.如果我没有为所有客户端设置management.context-path,一切正常.但是现在我需要监控所有客户端(一些客户端没有management.context-path,一些客户端不同management.context-path).我知道我应该使用元数据来实现这一点,但在阅读相关文档后,我仍然可以完成这项工作.以下是我在客户端和管理员端的配置.

客户端:

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}}
Run Code Online (Sandbox Code Playgroud)

管理员方面:

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'
Run Code Online (Sandbox Code Playgroud)

问题:

  1. 我设置spring.boot.admin.discovery.converter.management-context-path/mgmt,该值与客户端相同,这只有在我将所有客户端应用程序设置为相同值时才能正常工作,这是不可能的.我该怎么做才能支持不同的management.context-path

PS:我在本地桌面上没有在任何公共云上完成所有这些操作,并且稍后将转移到产品环境(仍然不使用公共云).

netflix-eureka spring-cloud-netflix spring-boot-admin

5
推荐指数
1
解决办法
8081
查看次数

Spring Cloud Stream 和 RabbitMQ 健康检查

我有一个使用 Spring Cloud Stream Rabbit 和 Eureka Discovery Client 的简单 Spring Boot 应用程序。该应用程序与 Eureka Server 一起工作得很好,并且通过 RabbitMQ 的消息传递也工作正常。但是如果我启动一个 Spring Boot Admin Server,应用程序就会开始记录健康检查失败:

2017-06-21 19:47:57.352  INFO 11416 --- [trap-executor-0] c.n.d.s.r.aws.ConfigClusterResolver      : Resolving eureka endpoints via configuration
2017-06-21 19:51:25.047  INFO 11416 --- [nio-8303-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring FrameworkServlet 'dispatcherServlet'
2017-06-21 19:51:25.047  INFO 11416 --- [nio-8303-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization started
2017-06-21 19:51:25.069  INFO 11416 --- [nio-8303-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization completed in 22 ms
2017-06-21 19:51:27.288  WARN 11416 --- [nio-8303-exec-1] …
Run Code Online (Sandbox Code Playgroud)

spring spring-boot spring-cloud-stream spring-boot-admin spring-integration-amqp

5
推荐指数
1
解决办法
6888
查看次数

一个应用程序中的Eureka Server和Spring Boot Admin

我尝试在一个应用程序中运行Eureka Server和Spring Boot Admin Server(SBA Docu说这是可能的)。Eureka可以按预期工作,但Admin App仍显示零个“应用程序”。

Spring Boot版本2.0.3,Spring Boot管理版本2.0.1

尤里卡和SBA服务器

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

服务器bootstrap.yml

spring:
      application:
        name: server
Run Code Online (Sandbox Code Playgroud)

服务器application.yml

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

eureka:
  instance:
    leaseRenewalIntervalInSeconds: 10
  client:
    registerWithEureka: false
    fetchRegistry: false
    serviceUrl:
      defaultZone: http://localhost:8080/eureka
Run Code Online (Sandbox Code Playgroud)

客户

@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()
    }
}
Run Code Online (Sandbox Code Playgroud)

客户端bootstrap.yml

 spring:
      application:
        name: client …
Run Code Online (Sandbox Code Playgroud)

spring-boot netflix-eureka spring-boot-admin

5
推荐指数
1
解决办法
2330
查看次数

更改appender级别而不是记录器级别

我的团队Spring Boot Admin用来控制我们spring application,
Spring Boot Admin我们可以选择更改logger级别Runtime,

我们为每个task(Thread)都有一个单独的记录器,如果我们只想查看一个线程的控制台日志,我们关闭所有其他线程记录器,问题是,每个记录器将它的输出既为STDOUT,也为某个文件,我们要关闭只有标准输出输出.

log4j2.xml配置示例:

<Loggers>
   <Logger name="task1" level="info">
     <AppenderRef ref="Console"/>
     <AppenderRef ref="File"/>
   </Logger>
   <Logger name="task2" level="info">
     <AppenderRef ref="Console"/>
     <AppenderRef ref="File"/>
   </Logger>
</Loggers>
Run Code Online (Sandbox Code Playgroud)

我们尝试了很多解决方案:

  • 使用父记录器结合可加性,并将每个appender分离到不同的记录器,有关它的任何想法?

log4j2 spring-boot spring-boot-admin

5
推荐指数
1
解决办法
197
查看次数

Spring Boot身份验证-管理控制台403对客户端的响应

我正在使用jdk 1.8和Spring Boot 2.1.2。

我想在Spring Boot的管理控制台及其客户端中启用身份验证。

我在管理 application.properties中设置:

spring.security.user.name=admin
spring.security.user.password=secret

spring.boot.admin.discovery.enabled=true

management.endpoints.web.exposure.include=*
management.endpoints.web.cors.allowed-methods=GET,POST
Run Code Online (Sandbox Code Playgroud)

管理项目中,我添加了此类:

@EnableWebSecurity
@Configuration
public class SecuritySecureConfig extends WebSecurityConfigurerAdapter {

    private static final Logger logger = (Logger) LoggerFactory.getLogger(SecuritySecureConfig.class);

    private final String adminContextPath;

    public SecuritySecureConfig(AdminServerProperties adminServerProperties) {
        this.adminContextPath = adminServerProperties.getContextPath();
    }

    @Override
protected void configure(HttpSecurity http) throws Exception {

    SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler();
    successHandler.setTargetUrlParameter("redirectTo");
    successHandler.setDefaultTargetUrl(adminContextPath + "/");

    http.authorizeRequests()
            .antMatchers(adminContextPath + "/assets/**").permitAll()
            .antMatchers(adminContextPath + "/login").permitAll()
            .anyRequest().authenticated()
            .and()
            .formLogin().loginPage(adminContextPath + "/login").successHandler(successHandler).and()
            .logout().logoutUrl(adminContextPath + "/logout").and()
            .httpBasic().and()
            .csrf() …
Run Code Online (Sandbox Code Playgroud)

java maven spring-boot spring-boot-admin

5
推荐指数
1
解决办法
493
查看次数

Cloud Foundry上的Spring-Boot-Admin:将UP应用程序显示为OFFLINE

我们正在使用代码中心提供的spring-boot-admin-server1.4.5版库来开发Boot-Admin仪表板。

一些应用程序正在通过Eureka向服务器注册自己,而一些应用程序直接使用spring-boot-admin-starter-client1.4.5版本。

所有组件都部署在PCF环境中,并且通过HTTPS进行通信。无论采用哪种方式,应用程序都可以向管理员服务器注册,但是仅显示为OFFLINE。日志中未报告任何组件viz的错误。管理员服务器,管理员客户端,尤里卡服务器,尤里卡客户端。

但是,显示为“启动”的唯一应用程序是管理服务器本身。

在PCF中运行的spring-boot-admin-client应用程序的应用程序属性为:

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
Run Code Online (Sandbox Code Playgroud)

由于两种注册方法的结果都是相同的,为了使应用程序通过Eureka路径进行注册,我跳过了此处的配置。

同样在本地工作也很好,管理仪表板可以按预期显示所有应用程序。

是否需要针对Cloud Foundry进行任何配置?还是我可能犯的任何明显错误?

任何建议都是最欢迎的。

- -编辑 - -

这是SBA服务器的日志,显示服务器与客户端之间的通信正常。如果这些日志提供任何错误指示,请指出。

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, …
Run Code Online (Sandbox Code Playgroud)

spring-boot-admin

4
推荐指数
1
解决办法
1748
查看次数

如何在 spring-boot-admin 中显示日志文件?

spring-boot-admin-ui用来监控我的网络应用程序。日志记录配置为log4j2, in log4j2-spring.xml

问题:如何在 admin-ui 中显示这些日志文件?据我所知,它可以logback开箱即用。但是log4j2,如果可能的话,我如何启用支持?

日志文件是这样的:

<Loggers>
   <Root level="DEBUG">
        <AppenderRef ref="APP" />
        <AppenderRef ref="XML" />
        <AppenderRef ... />
    </Root>
</Loggers>
Run Code Online (Sandbox Code Playgroud)

我想在 admin-ui 中查看日志文件的最后 X 行,或者能够通过 ui 直接下载它们。

java spring log4j2 spring-boot-admin

4
推荐指数
1
解决办法
7133
查看次数

Spring Boot Admin Client未注册应用程序

我已经设置了SpringBootAdmin服务器,并尝试使用SpringBootAdmin客户端注册应用程序.它似乎没有注册.我必须在Eureka注册吗?我该如何调试?

adminserver build.gradle上的配置

dependencies {
    compile('de.codecentric:spring-boot-admin-server-ui')
    compile('de.codecentric:spring-boot-admin-server-ui-login')
    compile('de.codecentric:spring-boot-admin-server')
    compile('org.springframework.boot:spring-boot-starter-web-services')
    testCompile('org.springframework.boot:spring-boot-starter-test')
}
Run Code Online (Sandbox Code Playgroud)

application.properties

spring.application.name=Boot-Admin
server.port=8093
security.user.name=admin
security.user.password=admin    
logging.level.de.codecentric.boot.admin.client=DEBUG
logging.level.de.codecentric.boot.admin=DEBUG
Run Code Online (Sandbox Code Playgroud)

应用程序是

@SpringBootApplication
@Configuration
@EnableAdminServer
public class AdminApp {

    public static void main(String[] args) {
        SpringApplication.run(AdminApp.class, args);
    }
}
Run Code Online (Sandbox Code Playgroud)

在客户端,build.gradle

dependencies {
compile('de.codecentric:spring-boot-admin-starter-client')
compile('org.springframework.boot:spring-boot-starter-actuator')
compile('org.springframework.boot:spring-boot-starter-web-services')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
Run Code Online (Sandbox Code Playgroud)

application.properties

server.port=8091
spring.boot.admin.client.enabled=true
spring.boot.admin.url=http://localhost:8093
spring.boot.admin.client.auto-registration=true
spring.boot.admin.username=admin
spring.boot.admin.password=admin
logging.level.de.codecentric.boot.admin.client=DEBUG
Run Code Online (Sandbox Code Playgroud)

代码是

@Configuration
@SpringBootApplication
public class SBACApp {

    public static void main(String[] args) {
        SpringApplication.run(SBACApp.class, args);
    }
}
Run Code Online (Sandbox Code Playgroud)

根据所有Stackoverflow文章和教程,这应该是足够的.即使在客户端设置了日志记录,似乎没有以dc开头的日志行...

我可能缺少什么任何有关如何调试这方面的其他知识可能会有所帮助.

spring-boot-admin

4
推荐指数
1
解决办法
3432
查看次数

忽略 Spring Boot 管理应用程序的 yaml 配置中指定的斜杠字符

我想app.kubernetes.io/part-of: myapp在我的 Spring Boot 管理应用程序中配置 kubernetes 发现的服务标签。

app.kubernetes.io/part-of是一个推荐的标签,所以我认为应该有一种方法来配置它以进行服务发现。

spring:
    cloud:
        kubernetes:
            discovery:
                namespace: myspace
                all-namespaces: true
                service-labels:
                    'app.kubernetes.io/part-of': myapp
Run Code Online (Sandbox Code Playgroud)

不幸的是,我在执行器中注意到,yaml 键中的所有特殊字符都被删除了configprops

我的问题:

  • 如何在 Spring Boot 的 yaml 键中指定斜杠?
  • 是否有替代解决方案来指定我的服务标签?

提示:

  • 其他一般 yaml 问题(建议转义或引用字符)在这里没有帮助。或者我错过了什么。

java spring-boot spring-boot-admin

4
推荐指数
1
解决办法
1427
查看次数