org.elasticsearch.client.transport.NoNodeAvailableException
SpringBoot连接elasticsearch异常
1 2018-09-11 16:03:43.692 ERROR 8684 --- [ main] o.s.boot.SpringApplication : Application run failed 2 3 java.lang.IllegalStateException: Failed to execute CommandLineRunner 4 at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:826) [spring-boot-2.1.0.M2.jar:2.1.0.M2] 5 at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:807) [spring-boot-2.1.0.M2.jar:2.1.0.M2] 6 at org.springframework.boot.SpringApplication.run(SpringApplication.java:345) [spring-boot-2.1.0.M2.jar:2.1.0.M2] 7 at org.springframework.boot.SpringApplication.run(SpringApplication.java:1269) [spring-boot-2.1.0.M2.jar:2.1.0.M2] 8 at org.springframework.boot.SpringApplication.run(SpringApplication.java:1257) [spring-boot-2.1.0.M2.jar:2.1.0.M2] 9 at sample.data.elasticsearch.SampleElasticsearchApplication.main(SampleElasticsearchApplication.java:68) [classes/:na] 10 Caused by: org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [{#transport#-1}{Yg5eMgPdSqiRy7T4al93qw}{127.0.0.1}{127.0.0.1:9300}] 11 at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:347) ~[elasticsearch-6.3.2.jar:6.3.2] 12 at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:245) ~[elasticsearch-6.3.2.jar:6.3.2] 13 at org.elasticsearch.client.transport.TransportProxyClient.execute(TransportProxyClient.java:60) ~[elasticsearch-6.3.2.jar:6.3.2] 14 at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:378) ~[elasticsearch-6.3.2.jar:6.3.2] 15 at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:405) ~[elasticsearch-6.3.2.jar:6.3.2] 16 at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:394) ~[elasticsearch-6.3.2.jar:6.3.2] 17 at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:46) ~[elasticsearch-6.3.2.jar:6.3.2] 18 at org.springframework.data.elasticsearch.core.ElasticsearchTemplate.getSearchResponse(ElasticsearchTemplate.java:942) ~[spring-data-elasticsearch-3.1.0.RC2.jar:3.1.0.RC2] 19 at org.springframework.data.elasticsearch.core.ElasticsearchTemplate.doScroll(ElasticsearchTemplate.java:807) ~[spring-data-elasticsearch-3.1.0.RC2.jar:3.1.0.RC2] 20 at org.springframework.data.elasticsearch.core.ElasticsearchTemplate.startScroll(ElasticsearchTemplate.java:821) ~[spring-data-elasticsearch-3.1.0.RC2.jar:3.1.0.RC2] 21 at org.springframework.data.elasticsearch.core.ElasticsearchTemplate.delete(ElasticsearchTemplate.java:718) ~[spring-data-elasticsearch-3.1.0.RC2.jar:3.1.0.RC2] 22 at org.springframework.data.elasticsearch.repository.support.AbstractElasticsearchRepository.deleteAll(AbstractElasticsearchRepository.java:257) ~[spring-data-elasticsearch-3.1.0.RC2.jar:3.1.0.RC2] 23 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_05] 24 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_05] 25 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_05] 26 at java.lang.reflect.Method.invoke(Method.java:483) ~[na:1.8.0_05] 27 at org.springframework.data.repository.core.support.RepositoryComposition$RepositoryFragments.invoke(RepositoryComposition.java:359) ~[spring-data-commons-2.1.0.RC2.jar:2.1.0.RC2] 28 at org.springframework.data.repository.core.support.RepositoryComposition.invoke(RepositoryComposition.java:200) ~[spring-data-commons-2.1.0.RC2.jar:2.1.0.RC2] 29 at org.springframework.data.repository.core.support.RepositoryFactorySupport$ImplementationMethodExecutionInterceptor.invoke(RepositoryFactorySupport.java:644) ~[spring-data-commons-2.1.0.RC2.jar:2.1.0.RC2] 30 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.1.0.RC2.jar:5.1.0.RC2] 31 at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:608) ~[spring-data-commons-2.1.0.RC2.jar:2.1.0.RC2] 32 at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.lambda$invoke$3(RepositoryFactorySupport.java:595) ~[spring-data-commons-2.1.0.RC2.jar:2.1.0.RC2] 33 at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor$$Lambda$1251/56840345.get(Unknown Source) ~[na:na] 34 at org.springframework.data.repository.util.QueryExecutionConverters$$Lambda$1250/1996449989.apply(Unknown Source) ~[na:na] 35 at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:595) ~[spring-data-commons-2.1.0.RC2.jar:2.1.0.RC2] 36 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.1.0.RC2.jar:5.1.0.RC2] 37 at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:59) ~[spring-data-commons-2.1.0.RC2.jar:2.1.0.RC2] 38 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.1.0.RC2.jar:5.1.0.RC2] 39 at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:93) ~[spring-aop-5.1.0.RC2.jar:5.1.0.RC2] 40 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.1.0.RC2.jar:5.1.0.RC2] 41 at org.springframework.data.repository.core.support.SurroundingTransactionDetectorMethodInterceptor.invoke(SurroundingTransactionDetectorMethodInterceptor.java:61) ~[spring-data-commons-2.1.0.RC2.jar:2.1.0.RC2] 42 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.1.0.RC2.jar:5.1.0.RC2] 43 at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212) ~[spring-aop-5.1.0.RC2.jar:5.1.0.RC2] 44 at com.sun.proxy.$Proxy44.deleteAll(Unknown Source) ~[na:na] 45 at sample.data.elasticsearch.SampleElasticsearchApplication.run(SampleElasticsearchApplication.java:35) [classes/:na] 46 at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:823) [spring-boot-2.1.0.M2.jar:2.1.0.M2] 47 ... 5 common frames omitted 48 49 2018-09-11 16:03:43.695 INFO 8684 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor'
解决办法注释掉elasticsearch配置文件中 cluster.name。