4

我有三个应用程序,一个是 spring-cloud-config 服务器点,另一个是 spring-cloud-config 客户端点。我相互配置了 spring-cloud-bus 以使我的客户端点自动刷新发生变化,但是在我的应用程序运行中,我得到了一个异常

    c.netflix.discovery.TimedSupervisorTask  : task supervisor rejected the task

java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.FutureTask@17834c50 rejected from java.util.concurrent.ThreadPoolExecutor@1944b0d0[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]
    at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2047) ~[na:1.8.0_92]
    at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:823) [na:1.8.0_92]
    at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1369) [na:1.8.0_92]
    at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112) ~[na:1.8.0_92]
    at com.netflix.discovery.TimedSupervisorTask.run(TimedSupervisorTask.java:62) ~[eureka-client-1.4.6.jar:1.4.6]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_92]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_92]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_92]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_92]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_92]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_92]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_92]

这是我的 spring-cloud-server 配置

#git config
spring.cloud.config.server.git.uri = ###
spring.cloud.config.server.git.username=###
spring.cloud.config.server.git.password=###
spring.cloud.config.server.git.search-paths = puhui-cloud-config-client

#spring.active.profile
spring.profiles.active=dev

#spring-cloud-bus-amqp config
spring.rabbitmq.host=localhost
spring.rabbitmq.port=5672
spring.rabbitmq.virtual-host=/

这是我的 spring-cloud-config 服务器 pom

<dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-config-server</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-eureka</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-stream-rabbit</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-config-monitor</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-bus-amqp</artifactId>
        </dependency>

    </dependencies>

这是我的 spring-cloud-config 客户端配置

#spring-cloud-config
spring.cloud.config.discovery.serviceId = PUHUI-CLOUD-CONFIG-SERVER
spring.cloud.config.name = @project.artifactId@
spring.cloud.config.profile = @profiles.active@
spring.cloud.config.label= master

spring.rabbitmq.host = localhost
spring.rabbitmq.port = 5672

这是我的 spring-cloud-config 客户端点 pom

<dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-config</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-bus-amqp</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-eureka</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-hystrix</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
        </dependency>
</dependencies>

这个异常不会影响应用程序的操作,但是想知道应用程序为什么会抛出异常

4

4 回答 4

2

这是 Eureka 本身的问题,请尝试升级您正在使用的 eureka 版本。您可以查看此https://github.com/spring-cloud/spring-cloud-netflix/issues/2228

于 2019-05-02T15:14:41.827 回答
2

尝试在发现服务器中为客户端启用注册和获取注册表

eureka.client.registerWithEureka=true

eureka.client.fetchRegistry=true
于 2016-10-27T19:48:02.870 回答
0

如果您使用application.yml文件进行项目配置,您可以在发现服务器中为客户端启用注册和获取注册表:

eureka:
  client:
    fetch-registry: true
    register-with-eureka: true
于 2020-02-10T11:03:28.920 回答
0

我认为错误日志与 Eureka 有关。你在运行尤里卡服务器吗?您在 pom 文件中添加了 Eureka 依赖项,但我在您的属性文件中没有看到任何与 Eureka 相关的配置。尝试不使用这些依赖项,或者构建一个 Eureka 服务器并使用它们运行。或者至少,在您的配置文件中添加以下属性。

eureka.client.enabled=false
于 2016-06-13T00:29:51.807 回答