Springboot整合Elasticsearch报错

今天使用SpringBoot整合Elasticsearch时候,相关的配置完成后,启动项目就报错了。

nested exception is java.lang.IllegalStateException: availableProcessors is already set to [4], rejecting [4]

我网上查询了一下,有人是是因为整合了Redis的原因。但是我把Redis相关的配置去掉后,问题还是没有解决,最后有人说是因为netty冲突的问题。
也有人给出了解决方式就是在项目初始化钱设置一下一个属性。在初始化之前加上System.setProperty(“es.set.netty.runtime.available.processors”, “false”);

@Configuration
public class ElasticSearchConfig {
@PostConstruct
void init() {
System.setProperty("es.set.netty.runtime.available.processors", "false");
}
}

我按照这种方法还是没有解决我这边项目的问题。
最后我直接把System.setProperty(“es.set.netty.runtime.available.processors”, “false”);
发现这样可以解决我这边的问题。

@SpringBootApplication
public class EurekaBussnissServiceUserApplication { public static void main(String[] args) {
// System.out.println("===========================================");
/**
* Springboot整合Elasticsearch 在项目启动前设置一下的属性,防止报错
* 解决netty冲突后初始化client时还会抛出异常
* java.lang.IllegalStateException: availableProcessors is already set to [4], rejecting [4]
*/
System.setProperty("es.set.netty.runtime.available.processors", "false");
SpringApplication.run(EurekaBussnissServiceUserApplication.class, args);
}
}

Springboot整合Elasticsearch报错availableProcessors is already set to [4], rejecting [4]的更多相关文章

  1. springboot整合activiti报错[processes/]不存在解决方案

    springboot整合activiti时,启动抛异常 nested exception is java.io.FileNotFoundException: class path resource [ ...

  2. SpringBoot:springboot整合eureka报错 Unable to start embedded Tomcat

    报错信息: org.springframework.context.ApplicationContextException: Unable to start web server; nested ex ...

  3. springboot整合jsp报错

    今天在学springboot整合jsp时遇到了一个问题,虽然jsp不被spring官方推荐使用,但抱着学习的心态还是想解决一下这个问题.在写好了需要pom文件之后,访问网站得到了500的错误提示,后台 ...

  4. springboot整合mybatis报错:Invalid default: public abstract java.lang.Class org.mybatis.spring.annotation...

    <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis- ...

  5. springboot 整合spark-sql报错

    Exception in thread "main" org.spark_project.guava.util.concurrent.ExecutionError: java.la ...

  6. SpringBoot整合Dubbo报错: java.lang.ClassCastException

    com.alibaba.dubbo.rpc.RpcException: Failed to invoke remote proxy method queryGoodsLimitPage to regi ...

  7. springboot整合cache报错org.springframework.cache.ehcache.EhCacheCacheManager cannot be cast to net.sf.ehcache.CacheManager

    原来的代码 private static CacheManager cacheManager = SpringContextHolder.getBean("cacheManager" ...

  8. springboot整合mybatis报错

    java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more ...

  9. ElasticSearch(2)---SpringBoot整合ElasticSearch

    SpringBoot整合ElasticSearch 一.基于spring-boot-starter-data-elasticsearch整合 开发环境:springboot版本:2.0.1,elast ...

随机推荐

  1. idea上 实现了Serializable接口,要自动生成serialVersionUID的方法

    需要点进setting ->搜索Inspections-->右侧选择java 下拉 进入Serialization issue--->勾选Serializable class wit ...

  2. Clipper库中文文档详解

    简介 Clipper Library(以下简称为Clipper库或ClipperLib或Clipper)提供了对线段和多边形的裁剪(Clipping)以及偏置(offseting)的功能 和其他的裁剪 ...

  3. Codeforces Round #609 (Div. 2) D. Domino for Young

    链接: https://codeforces.com/contest/1269/problem/D 题意: You are given a Young diagram. Given diagram i ...

  4. GET和POST的区别【转载】

    GET和POST是HTTP请求的两种基本方法,要说它们的区别,接触过WEB开发的人都能说出一二. 最直观的区别就是GET把参数包含在URL中,POST通过request body传递参数. 你可能自己 ...

  5. Java基础面试题1

    http://blog.csdn.net/jackfrued/article/details/44921941 1.面向对象的特征有哪些方面?  答:面向对象的特征主要有以下几个方面: - 抽象:抽象 ...

  6. 31、[源码]-AOP原理-AnnotationAwareAspectJAutoProxyCreato机

    31.[源码]-AOP原理-AnnotationAwareAspectJAutoProxyCreato机

  7. ajax当有返回值时

    当ajax方法里面有return 值时,无法使用两种精简版的只能使用经典版 因为ajax 方法时异步的,正确的方式时使用经典版中async:false 设置为同步 默认为true  是异步 正确代码如 ...

  8. 使用PS进行切图

    一,设置PS 使用PS进行切图前的设置: 1,打开PS----打开PSD图片----点击窗口-----分别把:历史记录,信息,图层,三个打勾. 历史记录:可以回到之前想要的步骤,特别是不小心把图层的文 ...

  9. html与HTML5的区别

    文档的类型声明不同 html:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.or ...

  10. P3588 [POI2015]PUS

    好题 思路:线段树优化建图+拓扑DP or 差分约束(都差不多): 提交:3次 错因:眼瞎没看题,Inf写的0x3f3f3f3f 题解: 类似差分约束的模型,\(a<b\rightarrow a ...