加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

availableProcessors is already set to [8], rejecting [8]

发布时间:2020-12-15 07:14:02 所属栏目:Java 来源:网络整理
导读:错误详细信息: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ' elasticsearchClient ' defined in class path resource [org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchAutoConfigu

错误详细信息:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'elasticsearchClient' 
defined in class path resource [org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchAutoConfiguration.class]:
Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException:
Failed to instantiate [org.elasticsearch.client.transport.TransportClient]: Factory method ' threw exception;
nested exception is java.lang.IllegalStateException: availableProcessors is already set to [8],rejecting [8]

关键信息如下:

Caused by: java.lang.IllegalStateException: availableProcessors 8]

通过关键字搜索,找到了解决办法,原因是因为SpringBoot的netty和elasticsearch的netty相关jar冲突

只需在启动类加入如下代码即可解决(注意,这段代码要放在SpringApplication.run(Application.class,args)之前才行,否则不会生效):

System.setProperty("es.set.netty.runtime.available.processors",false");

?

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读