Optimize and ElasticSearch problem

I am trying to connect Optimize and ElasticSearch and I cant understand what I am getting this error:

18:21:07.126 [main] INFO  o.c.o.s.e.OptimizeElasticsearchClientFactory - Initializing Elasticsearch rest client...
18:21:09.756 [main] ERROR o.c.o.s.e.OptimizeElasticsearchClientFactory - Failed getting number of cluster nodes.
java.net.ConnectException: Connection refused: no further information
	at org.elasticsearch.client.RestClient.extractAndWrapCause(RestClient.java:865)
	at org.elasticsearch.client.RestClient.performRequest(RestClient.java:275)
	at org.elasticsearch.client.RestClient.performRequest(RestClient.java:262)
	at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1628)
	at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1598)
	at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:1568)
	at org.elasticsearch.client.ClusterClient.health(ClusterClient.java:130)
	at org.camunda.optimize.service.es.OptimizeElasticsearchClientFactory.getNumberOfClusterNodes(OptimizeElasticsearchClientFactory.java:68)
	at org.camunda.optimize.service.es.OptimizeElasticsearchClientFactory.waitForElasticsearch(OptimizeElasticsearchClientFactory.java:51)
	at org.camunda.optimize.service.es.OptimizeElasticsearchClientFactory.create(OptimizeElasticsearchClientFactory.java:34)
	at org.camunda.optimize.service.es.OptimizeElasticsearchClientConfiguration.optimizeElasticsearchClient(OptimizeElasticsearchClientConfiguration.java:29)
	at org.camunda.optimize.service.es.OptimizeElasticsearchClientConfiguration$$EnhancerBySpringCGLIB$$7ed0f69c.CGLIB$optimizeElasticsearchClient$0(<generated>)
	at org.camunda.optimize.service.es.OptimizeElasticsearchClientConfiguration$$EnhancerBySpringCGLIB$$7ed0f69c$$FastClassBySpringCGLIB$$3329bf79.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
	at org.camunda.optimize.service.es.OptimizeElasticsearchClientConfiguration$$EnhancerBySpringCGLIB$$7ed0f69c.optimizeElasticsearchClient(<generated>)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1179)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:571)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:531)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)

Hi @hahi

could you share your configuration (e.g. environment-config) of Optimize?
How are you trying to run Optimize - are you using Docker or Demo Distro?

Thanks & Best
Felix

1 Like

Yes here it is:

  • I have an Local Engine started and it is working, then I am trying to run Optimize locally via optimize.bat and it automatically starts ElasticSearch. I downloaded only ElasticSearch and first started it and then I run the bat file of Optimize but it still did not work.

    engines:
    # An alias of the engine, which will be used for internal purposes like
    # logging and displaying which data belong to which engine.
    ‘camunda-bpm’:
    # The process engines name on the platform, this is the unique engine identifier on the platforms REST API.
    name: default
    # A default tenant to the be injected on data from this engine where no tenant is configured in the engine itself.
    # This property is only relevant in the context of a One Process Engine Per Tenant.
    # For details consult the Multi-Tenancy documentation.
    defaultTenant:
    # the id used for this default tenant on persisted entities
    id: null
    # the name used for this tenant when displayed in the UI
    name: null
    # A base URL that will be used for connections to the Camunda Engine REST API.
    rest: ‘http://localhost:8080/apmpf-oha/camunda/rest
    # Determines whether this instance of Optimize should import definition & historical data from this engine.
    importEnabled: true
    # Determines whether this instance of Optimize should convert historical data to event data
    # usable for event based processes.
    eventImportEnabled: false
    authentication:
    # Toggles basic authentication on or off. When enabling basic
    # authentication, please be aware that you also need to adjust the values
    # of the user and password.
    # Also note, when enabled, it is required that the user has
    # * READ & READ_HISTORY permission on the Process and Decision Definition resources
    # * READ permission on the Authorization, Group, User, Deployment & Tenant resources
    # to enable users to log in and Optimize to import the engine data.
    enabled: false
    #When basic authentication is enabled, this password is used to
    #authenticate against the engine.
    password: ‘’
    #When basic authentication is enabled, this user is used to authenticate
    #against the engine.
    user: ‘’
    # The webapps configuration allows Optimize to directly link
    # to the other Camunda Web Applications, e.g. to jump from
    # Optimize directly to a dedicated process instance in Cockpit
    webapps:
    # Defines the endpoint where to find the camunda webapps
    endpoint: ‘http://localhost:8080/apmpf-oha/camunda/app/cockpit/
    # Enables/disables linking to other Camunda Web Applications
    enabled: true

    everything that is related with configuring Elasticsearch or creating

    a connection to it.

    es:
    connection:
    # a list of Elasticsearch nodes Optimize can connect to. If you have built
    # an Elasticsearch cluster with several nodes it is recommended to define
    # several connection points in case one node fails.
    nodes:
    # the address/hostname under which the Elasticsearch node is available.
    - host: ‘localhost’
    # A port number used by Elasticsearch to accept HTTP connections.
    httpPort: 9200
    # HTTP forward proxy configuration
    proxy:
    # whether an HTTP proxy should be used for requests to elasticsearch
    enabled: false
    # the host of the proxy to use
    host: null
    # the port of the proxy to use
    port: null
    # whether this proxy is using a secured connection
    sslEnabled: false

Hey Felix what do you think, the problem can be?

14:17:49.491 [main] INFO o.c.o.s.e.OptimizeElasticsearchClientFactory - Initializing Elasticsearch rest client…
14:17:52.100 [main] ERROR o.c.o.s.e.OptimizeElasticsearchClientFactory - Failed getting number of cluster nodes.
java.net.ConnectException: Connection refused: no further information
at org.elasticsearch.client.RestClient.extractAndWrapCause(RestClient.java:865)
at org.elasticsearch.client.RestClient.performRequest(RestClient.java:275)
at org.elasticsearch.client.RestClient.performRequest(RestClient.java:262)

at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)
at org.eclipse.jetty.server.Server.doStart(Server.java:387)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
at org.camunda.optimize.jetty.EmbeddedCamundaOptimize.startOptimize(EmbeddedCamundaOptimize.java:195)
at org.camunda.optimize.Main.main(Main.java:17)

Caused by: java.net.ConnectException: Connection refused: no further information
at java.base/sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at java.base/sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:779)
at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvent(DefaultConnectingIOReactor.java:174)
at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:148)
at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:351)
at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.execute(PoolingNHttpClientConnectionManager.java:221)
at org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase$1.run(CloseableHttpAsyncClientBase.java:64)
at java.base/java.lang.Thread.run(Thread.java:834)
14:17:52.101 [main] INFO o.c.o.s.e.OptimizeElasticsearchClientFactory - No elasticsearch nodes available, waiting [1500] ms to retry connecting
14:17:55.610 [main] ERROR o.c.o.s.e.OptimizeElasticsearchClientFactory - Failed getting number of cluster nodes.
java.net.ConnectException: Connection refused: no further information
at org.elasticsearch.client.RestClient.extractAndWrapCause(RestClient.java:865)
at org.elasticsearch.client.RestClient.performRequest(RestClient.java:275)
at org.elasticsearch.client.RestClient.performRequest(RestClient.java:262)

Hi @hahi

Can you take a look at the Style Guide? It’ll help you understand how to format code correctly and also help you create questions that are easy to understand and also easier to answer :slight_smile:

I found the error so basically when I start Optimize together with ElasticSearch with the optimize-demo.bat file it does not find ElasticSearch that is why I start first ElasticSearch from the elastic search folder which is located inside the folder of optimize and then once I had started it then I start Optimize via the elasticsearch.bat file and it is working now.

2 Likes