栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

【Error】Spring整合ElasticSearch启动项目报错:availableProcessors is already set to [8], rejecting [8]

【Error】Spring整合ElasticSearch启动项目报错:availableProcessors is already set to [8], rejecting [8]

详细报错信息:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userController': Unsatisfied dependency expressed through field 'elasticsearchTemplate'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'elasticsearchTemplate' defined in class path resource [spring-es.xml]: Cannot resolve reference to bean 'client' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'client': Invocation of init method failed; nested exception is java.lang.IllegalStateException: availableProcessors is already set to [8], rejecting [8]
错误原因

Spring 的netty和ElasticSearch的netty相关jar包冲突。因此程序启动失败,抛出异常

解决方案 | 1 若为Jetty启动 参考下图

在Runner--VM Options中添加如下代码即可

-Des.set.netty.runtime.available.processors=false

| 2 在SpringBoot的入口类Application的main方法中添加如下代码即可
System.setProperty("es.set.netty.runtime.available.processors", "false");

部分报错信息图示:


Thanks

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/682392.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号