【spring boot】【elasticsearch】spring boot整合elasticsearch,启动报错Caused by: java.lang.IllegalStateException: availableProcessors is already set to [8], rejecting [8

时间:2022-08-27 21:04:33

spring boot整合elasticsearch,

启动报错:

Caused by: java.lang.IllegalStateException: availableProcessors is already set to [], rejecting []
at io.netty.util.NettyRuntime$AvailableProcessorsHolder.setAvailableProcessors(NettyRuntime.java:) ~[netty-common-4.1..Final.jar:4.1..Final]
at io.netty.util.NettyRuntime.setAvailableProcessors(NettyRuntime.java:) ~[netty-common-4.1..Final.jar:4.1..Final]
at org.elasticsearch.transport.netty4.Netty4Utils.setAvailableProcessors(Netty4Utils.java:) ~[transport-netty4-client-5.6..jar:5.6.]
at org.elasticsearch.transport.netty4.Netty4Transport.<init>(Netty4Transport.java:) ~[transport-netty4-client-5.6..jar:5.6.]
at org.elasticsearch.transport.Netty4Plugin.lambda$getTransports$(Netty4Plugin.java:) ~[transport-netty4-client-5.6..jar:5.6.]
at org.elasticsearch.client.transport.TransportClient.buildTemplate(TransportClient.java:) ~[elasticsearch-5.6..jar:5.6.]
at org.elasticsearch.client.transport.TransportClient.<init>(TransportClient.java:) ~[elasticsearch-5.6..jar:5.6.]
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:) ~[transport-5.6..jar:5.6.]
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:) ~[transport-5.6..jar:5.6.]
at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:) ~[transport-5.6..jar:5.6.]
at org.springframework.data.elasticsearch.client.TransportClientFactoryBean.buildClient(TransportClientFactoryBean.java:) ~[spring-data-elasticsearch-3.0..RELEASE.jar:3.0..RELEASE]
at org.springframework.data.elasticsearch.client.TransportClientFactoryBean.afterPropertiesSet(TransportClientFactoryBean.java:) ~[spring-data-elasticsearch-3.0..RELEASE.jar:3.0..RELEASE]
at org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration.elasticsearchClient(ElasticsearchAutoConfiguration.java:) ~[spring-boot-autoconfigure-2.0..RELEASE.jar:2.0..RELEASE]
at org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration$$EnhancerBySpringCGLIB$$13fe0eee.CGLIB$elasticsearchClient$(<generated>) ~[spring-boot-autoconfigure-2.0..RELEASE.jar:2.0..RELEASE]
at org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration$$EnhancerBySpringCGLIB$$13fe0eee$$FastClassBySpringCGLIB$$480cb39c.invoke(<generated>) ~[spring-boot-autoconfigure-2.0..RELEASE.jar:2.0..RELEASE]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:) ~[spring-core-5.0..RELEASE.jar:5.0..RELEASE]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:) ~[spring-context-5.0..RELEASE.jar:5.0..RELEASE]
at org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration$$EnhancerBySpringCGLIB$$13fe0eee.elasticsearchClient(<generated>) ~[spring-boot-autoconfigure-2.0..RELEASE.jar:2.0..RELEASE]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_171]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:) ~[na:1.8.0_171]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:) ~[na:1.8.0_171]
at java.lang.reflect.Method.invoke(Method.java:) ~[na:1.8.0_171]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:) ~[spring-beans-5.0..RELEASE.jar:5.0..RELEASE]
... common frames omitted

解决方案:

在启动类添加

@EnableScheduling
@SpringBootApplication
@MapperScan("com.sxd.swapping.dao.mybatis")
public class SwappingApplication { public static void main(String[] args) {
/**
* 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(SwappingApplication.class, args);
}
}

【spring boot】【elasticsearch】spring boot整合elasticsearch,启动报错Caused by: java.lang.IllegalStateException: availableProcessors is already set to [8], rejecting [8的更多相关文章

  1. 【spring cloud】spring cloud 使用feign调用,1&period;fallback熔断器不起作用,2&period;启动报错Caused by&colon; java&period;lang&period;ClassNotFoundException&colon; com&period;netflix&period;hystrix&period;contrib&period;javanica&period;aop&period;aspectj&period;Hystri解决

    示例GitHub源码地址:https://github.com/AngelSXD/springcloud 1.首先使用feign调用,需要配置熔断器 2.配置熔断器需要将熔断器注入Bean,熔断器类上 ...

  2. SpringBoot整合Elasticsearch启动报错处理 nested exception is java&period;lang&period;IllegalStateException&colon; availableProcessors is already set to &lbrack;8&rsqb;&comma; rejecting &lbrack;8&rsqb;

    Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean wit ...

  3. SpringBoot启动报:Caused by&colon; java&period;lang&period;IllegalArgumentException&colon; At least one JPA metamodel must be present&excl;

    使用spring boot对项目改造,启动报错: Caused by: java.lang.IllegalArgumentException: At least one JPA metamodel m ...

  4. springboot整合mybatis的时候报错Caused by&colon; java&period;lang&period;IllegalArgumentException&colon; Property &&num;39&semi;sqlSessionFactory&&num;39&semi; or &&num;39&semi;sqlSessionTemplate&&num;39&semi; are required

    今天闲来无事,学习springboot整合mybatis,在bilibili看视频学的,视频中在dao层的interface上面加上org.apache.ibatis.annotations.Mapp ...

  5. springcloud中config启动时候报错Caused by&colon; java&period;lang&period;IllegalArgumentException&colon; Could not resolve placeholder &&num;39&semi;config&period;info&&num;39&semi; in value &quot&semi;&dollar;&lbrace;config&period;info&rcub;&quot&semi;

    -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dcom.sun.management.jm ...

  6. tomcat启动报错 关键字:java&period;lang&period;NoClassDefFoundError和 java&period;lang&period;ClassNotFoundExceeption

    启动tomcat时报错情况如下图所示:实际上就是依赖的bean出错,百度上很多方法都说是tomcat没有部署正确,项目-->右键----->proterties----->Targe ...

  7. Flume启动时报错Caused by&colon; java&period;lang&period;InterruptedException&colon; Timed out before HDFS call was made&period; Your hdfs&period;callTimeout might be set too low or HDFS calls are taking too long&period;解决办法(图文详解)

    前期博客 Flume自定义拦截器(Interceptors)或自带拦截器时的一些经验技巧总结(图文详解) 问题详情 -- ::, (agent-shutdown-hook) [INFO - org.a ...

  8. tomcat启动时检测到循环继承而栈溢出的问题&colon;Caused by&colon; java&period;lang&period;IllegalStateException&colon; Unable to complete the scan for annotations for web application &lbrack;&sol;test&rsqb; due to a *Error&period; Possible root causes include

    最近在公司更新一个老项目的时候,发现部署项目后tomcat报错,错误如下: Caused by: java.lang.IllegalStateException: Unable to complete ...

  9. SpringBoot整合nacos启动报错:java&period;lang&period;NoClassDefFoundError&colon; org&sol;springframework&sol;boot&sol;context&sol;properties&sol;ConfigurationBeanFactoryMetadata

    报错信息 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'nacosCo ...

随机推荐

  1. 简单的js菜单

    <!DOCTYPE html> <html> <head> <title>hovertree</title><base target= ...

  2. OSI七层与TCP&sol;IP五层网络架构详解

      引用自:http://www.2cto.com/net/201310/252965.html   OSI和TCP/IP是很基础但又非常重要的网络基础知识,理解得透彻对运维工程师来说非常有帮助.今天 ...

  3. java中dao层和service层的区别是什么?

    首先解释面上意思,service是业务层,dao是数据访问层.呵呵,这个问题我曾经也有过,记得以前刚学编程的时候,都是在service里直接调用dao,service里面就new一个dao类对象,调用 ...

  4. android 49 广播接收者中启动其他组件

    main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" andro ...

  5. python nonloacal

    Python 3 添加了 nonlocal 关键字,把 None.True 和 False 提升为关键字,废弃了 print 和 exec.今天细说下 nonlocal 的用法 nonloacal是最 ...

  6. java byte 梳理

    最近写编解码的代码比较多,抽一点时间梳理下java下byte的解析.在例子代码中主要涉及的知识点就两块: 1.byte代表8个bit,其中最高位是符号位: 2.当我们用String类的getBytes ...

  7. 20&period;多线程&period;join&lpar;&rpar;和setDaemon&lpar;&rpar;的使用

    1.join()方法 join ()方法:主线程A中,创建了子线程B,并且在主线程A中调用了B.join(),那么,主线程A会在调用的地方等待,直到子线程B完成操作后,才可以接着往下执行,那么在调用这 ...

  8. django from表单基础知识点

    今日概要: - 内容拾遗 - 分页 - Form验证 1.内容拾遗 - 新URL -提交时,保留之前的内容? - 对话框 - var data = $('#fmForm表单的ID').serializ ...

  9. &lbrack;HEOI2015&rsqb;兔子与樱花&lbrack;贪心&rsqb;

    4027: [HEOI2015]兔子与樱花 Time Limit: 10 Sec  Memory Limit: 256 MBSubmit: 1043  Solved: 598[Submit][Stat ...

  10. HDU - 2842

    要拆第n个环要求保留第n-1拆除前n-2 对于n,先拆掉n-2再去掉n再放回n-2,然后规模降为n-1 f(n)=2f(n-2)+f(n-1)+1 inline ll mod(ll a){return ...