springcloud 中的zuul整合Elasticsearch报错availableProcessors is already set to [4], rejecting [4]...

今天使用springboot整合springcloud zuul和elasticsearch时,报错。

仅仅使用springboot和elasticsearch没有问题,springboot和eureka和elasticsearch整合也没有问题,springboot和eureka和elasticsearch和zuul整合出现了问题,

原因是SpringBoot的netty和elasticsearch的netty相关jar冲突
解决办法:
在启动类添加:
System.setProperty("es.set.netty.runtime.available.processors", "false");

package cn.ac.iie;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
@EnableZuulProxy
public class App {
    public static void main(String[] args) {
        System.setProperty("es.set.netty.runtime.available.processors", "false");
        ConfigurableApplicationContext run = SpringApplication.run(App.class, args);
    }
}

 

转载于:https://my.oschina.net/duanvincent/blog/3063162

你可能感兴趣的:(springcloud 中的zuul整合Elasticsearch报错availableProcessors is already set to [4], rejecting [4]...)