Exception in thread “Thread-99“ java.net.BindException: Address already in use: bind

xxljob配置好之后总会有这个错,但不影响启动

版本2.2.0出现这个问题,2.3.0无这个问题 xxl-job配置遇到的坑:java.net.BindException:
Address already in use: bind
最初以为端口被占用了,排查发现不是端口问题,xxl-job在版本更新之后//@Bean(initMethod = “start”,
destroyMethod = “destroy”)不需要加 改成@Bean

看一了篇文章,它里面用的是 @ConditionalOnClass()代替了@Bean(initMethod = “start”, destroyMethod = “destroy”),启动是没错啦,但是定时不能用了。最后换成 @Bean了 就好了

    @Bean
//    @Bean(initMethod = "start", destroyMethod = "destroy")
//    @ConditionalOnClass()
    public XxlJobSpringExecutor xxlJobExecutor() {
        logger.info(">>>>>>>>>>> xxl-job config init.");
        XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
        xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
        xxlJobSpringExecutor.setAppname(appname);
        xxlJobSpringExecutor.setAddress(addresses);
        xxlJobSpringExecutor.setIp(ip);
        xxlJobSpringExecutor.setPort(port);
        xxlJobSpringExecutor.setAccessToken(accessToken);
        xxlJobSpringExecutor.setLogPath(logPath);
        xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays);
        return xxlJobSpringExecutor;
    }