I am getting below error while using spring data opensearch. I am using docker compose to build the image:
2024-02-19T10:24:24.994Z ERROR 1 --- [nt_sniffer[T#1]] org.opensearch.client.sniff.Sniffer : error while sniffing nodes
os_project |
os_project | java.net.ConnectException: Connection refused
os_project | at org.opensearch.client.RestClient.extractAndWrapCause(RestClient.java:954) ~[opensearch-rest-client-2.11.0.jar:2.11.0]
os_project | at org.opensearch.client.RestClient.performRequest(RestClient.java:333) ~[opensearch-rest-client-2.11.0.jar:2.11.0]
os_project | at org.opensearch.client.RestClient.performRequest(RestClient.java:321) ~[opensearch-rest-client-2.11.0.jar:2.11.0]
os_project | at org.opensearch.client.sniff.OpenSearchNodesSniffer.sniff(OpenSearchNodesSniffer.java:122) ~[opensearch-rest-client-sniffer-2.11.0.jar:2.11.0]
os_project | at org.opensearch.client.sniff.Sniffer.sniff(Sniffer.java:223) ~[opensearch-rest-client-sniffer-2.11.0.jar:2.11.0]
os_project | at org.opensearch.client.sniff.Sniffer$Task.run(Sniffer.java:154) ~[opensearch-rest-client-sniffer-2.11.0.jar:2.11.0]
os_project | at org.opensearch.client.sniff.Sniffer$1.run(Sniffer.java:95) ~[opensearch-rest-client-sniffer-2.11.0.jar:2.11.0]
os_project | at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[na:na]
os_project | at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
os_project | at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[na:na]
os_project | at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[na:na]
os_project | at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[na:na]
os_project | 2024-02-19T10:24:25.182Z WARN 1 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataConfiguration$ReactiveRestClientConfiguration': Lookup method resolution failed
os_project | 2024-02-19T10:24:25.187Z INFO 1 --- [ main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
I want to run my springboot application with latest opensearch integration
The problem is Connection refused
. The reason can be vary. You can check the followings.
curl https://localhost:9200
HTTP or HTTPS
, make sure the springboot using the correct one.network.host: 0.0.0.0
in opensearch yaml can help.