Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/360.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java springboot HealthActuator NoSuchBean定义异常没有名为';healthEndpoint';可获得的_Java_Spring_Spring Boot_Spring Boot Actuator - Fatal编程技术网

Java springboot HealthActuator NoSuchBean定义异常没有名为';healthEndpoint';可获得的

Java springboot HealthActuator NoSuchBean定义异常没有名为';healthEndpoint';可获得的,java,spring,spring-boot,spring-boot-actuator,Java,Spring,Spring Boot,Spring Boot Actuator,我正在将项目从SpringBootVersion2.1.3迁移到SpringBootVersion2.3.4 在引导运行期间,我得到以下错误 [ERROR] 2021-05-11 14:06:04 o.s.s.s.TaskUtils$LoggingErrorHandler [scheduling-1]: Unexpected error occurred in scheduled task org.springframework.beans.factory.NoSuchBeanDefinitio

我正在将项目从SpringBootVersion2.1.3迁移到SpringBootVersion2.3.4

在引导运行期间,我得到以下错误

[ERROR] 2021-05-11 14:06:04 o.s.s.s.TaskUtils$LoggingErrorHandler [scheduling-1]: Unexpected error occurred in scheduled task
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'healthEndpoint' available
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:816) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1288) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.beans.factory.support.CglibSubclassingInstantiationStrategy$LookupOverrideMethodInterceptor.intercept(CglibSubclassingInstantiationStrategy.java:242) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at com.banato.rate.submit.ok.jmx.HealthActuator$$EnhancerBySpringCGLIB$$67bbc5e4.getActuatorHealthEndpoint(<generated>) ~[main/:?]
        at com.banato.rate.submit.ok.jmx.HealthActuator.health(HealthActuator.java:36) ~[main/:?]
        at jdk.internal.reflect.GeneratedMethodAccessor61.invoke(Unknown Source) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
        at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:84) ~[spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-5.2.9.RELEASE.jar:5.2.9.RELEASE]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) [?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
        at java.lang.Thread.run(Thread.java:834) [?:?]
    <==========---> 80% EXECUTING [8m 35s]
下面是属性

# ----------------------------------------
# ACTUATOR PROPERTIES
# ----------------------------------------
management.security.enabled=false
management.server.ssl.enabled=false
management.endpoints.jmx.exposure.exclude=*
management.endpoints.web.exposure.include=jolokia
management.endpoints.jmx.unique-names=true
management.server.port=9012
management.endpoint.health.show-details=always
这是健康监测MBean

package com.banato.jmx;

import java.io.File;

public class HealthMonitoring implements HealthMonitoringMBean {

    private boolean health = true;
    private String healthReason;
    private boolean busy = true;
    private String busyReason;
    private boolean outOfMemory = false;
    
    public void setHealth(boolean health) {
        this.health = health;
    }

    public void setHealthReason(String healthReason) {
        this.healthReason = healthReason;
    }

    public void setBusy(boolean busy) {
        this.busy = busy;
    }

    public void setBusyReason(String busyReason) {
        this.busyReason = busyReason;
    }

    public void setOutOfMemory(boolean outOfMemory) { this.outOfMemory = outOfMemory; }

    @Override
    public boolean getHealth() {
        return health;
    }

    @Override
    public String getHealthReason() {
        return healthReason;
    }

    @Override
    public boolean getBusy() {
        return busy;
    }

    @Override
    public String getBusyReason() {
        return busyReason;
    }

    @Override
    public boolean getOutOfMemory() { return outOfMemory; }

    public String toString(){
        return "\nHealth: " + health + "\nHealthReason: " + healthReason +
                "\nOutOfMemory: " + outOfMemory +
                "\nBusy: " + busy + "\nBusyReason: " + busyReason + "\n";
    }
}

请将健康监测MBean也张贴在clarity@DineshDontha-发布了HealthMonitoringMBean。您是否在应用程序中定义了HealthEndpoint的bean?Sthg-like
@Bean-public-HealthEndpoint-HealthEndpoint()
package com.banato.jmx;

import java.io.File;

public class HealthMonitoring implements HealthMonitoringMBean {

    private boolean health = true;
    private String healthReason;
    private boolean busy = true;
    private String busyReason;
    private boolean outOfMemory = false;
    
    public void setHealth(boolean health) {
        this.health = health;
    }

    public void setHealthReason(String healthReason) {
        this.healthReason = healthReason;
    }

    public void setBusy(boolean busy) {
        this.busy = busy;
    }

    public void setBusyReason(String busyReason) {
        this.busyReason = busyReason;
    }

    public void setOutOfMemory(boolean outOfMemory) { this.outOfMemory = outOfMemory; }

    @Override
    public boolean getHealth() {
        return health;
    }

    @Override
    public String getHealthReason() {
        return healthReason;
    }

    @Override
    public boolean getBusy() {
        return busy;
    }

    @Override
    public String getBusyReason() {
        return busyReason;
    }

    @Override
    public boolean getOutOfMemory() { return outOfMemory; }

    public String toString(){
        return "\nHealth: " + health + "\nHealthReason: " + healthReason +
                "\nOutOfMemory: " + outOfMemory +
                "\nBusy: " + busy + "\nBusyReason: " + busyReason + "\n";
    }
}