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

Posted youcong

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了availableProcessors is already set to [8], rejecting [8]相关的知识,希望对你有一定的参考价值。

错误详细信息:

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 elasticsearchClient threw exception;
nested exception is java.lang.IllegalStateException: availableProcessors is already set to [8], rejecting [8]

关键信息如下:

Caused by: java.lang.IllegalStateException: availableProcessors is already set to [8], rejecting [8]

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

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

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

 

以上是关于availableProcessors is already set to [8], rejecting [8]的主要内容,如果未能解决你的问题,请参考以下文章

springboot整合es availableProcessors is already set to [2], rejecting [2]

php WooCommerce助手功能 - 作者:https://faish.al/2014/01/06/check-if-it-is-woocommerce-page/

当我执行多个优于 Runtime.getRuntime().availableProcessors()) 的并行线程时,为啥我的 Java 程序运行得更快?

1442 - Can't update table 'site' in stored functiontrigger because it is al

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.al

PHP 获取数组是几维数组