0

I am getting following error from Elasticsearch.

`<html><head><title>Apache Tomcat/7.0.64 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - Request processing failed; nested exception is org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: []</h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u>Request processing failed; nested exception is org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: []</u></p><p><b>description</b> <u>The server encountered an internal error that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: []
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:943)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:822)
javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:807)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
myapp.filter.SimpleCORSFilter.doFilter(SimpleCORSFilter.java:22)
</pre></p><p><b>root cause</b> <pre>org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: []
org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:305)
org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:200)
org.elasticsearch.client.transport.support.InternalTransportIndicesAdminClient.execute(InternalTransportIndicesAdminClient.java:86)
org.elasticsearch.client.support.AbstractIndicesAdminClient.exists(AbstractIndicesAdminClient.java:178)
org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequestBuilder.doExecute(IndicesExistsRequestBuilder.java:53)
org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:91)
org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:65)
myapp.dao.CommonDao.ValidateTenant(CommonDao.java:7)
myapp.dao.CliffDomainDao.viewCliffDomains(CliffDomainDao.java:55)
myapp.service.CliffDomainService.getall(CliffDomainService.java:53)
myapp.controller.CliffDomainController.getall(CliffDomainController.java:79)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:497)
org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:214)
org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:748)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:689)
org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:945)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:876)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:931)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:822)
javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:807)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
myapp.filter.SimpleCORSFilter.doFilter(SimpleCORSFilter.java:22)
</pre></p><p><b>note</b> <u>The full stack trace of the root cause is available in the Apache Tomcat/7.0.64 logs.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.64</h3></body></html>`

I am running Elasticsearch 1.7.2 on Ubuntu.

Changes that I have made in elasticsearch.yml

################################### Cluster ###################################

# Cluster name identifies your cluster for auto-discovery. If you're running
# multiple clusters on the same network, make sure you're using unique names.
#
cluster.name: cliffservice




# Set the address other nodes will use to communicate with this node. If not
# set, it is automatically derived. It must point to an actual IP address.
#
#network.publish_host: 192.168.0.1
network.publish_host: 10.100.10.231
# Set both 'bind_host' and 'publish_host':
#
#network.host: 192.168.0.1

Connection code

public TransportClient getClient() {
    Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name", "cliffservice").build();
    TransportClient client = new TransportClient(settings);
    client = client.addTransportAddress(new InetSocketTransportAddress(this.host, this.port));

    this.esclient = client;

    return client;
}

Get data from elastic client

SearchResponse response = Connection.getEsclient().prepareSearch("testindex").setTypes("testtype").execute()
                .actionGet();

        if (response.getHits().getHits().length > 0) {
            for (SearchHit hit : response.getHits().getHits()) {
                CliffDomain cliffDomain = new CliffDomain();

                assetDomain.setCliffDomainId(hit.getId());
                assetDomain.setCliffDomainName((String) hit.sourceAsMap().get("clifftDomainName"));

                searchResponse.add(cliffDomain);

            }
        }

What wrong I am doing?

user3306669
  • 117
  • 1
  • 11

2 Answers2

1

Your client and service are in different clusters. The client is in assetservice and the server is in cliffservice. Also, make sure that the client can connect to the port 9300 of 10.100.10.231.

imotov
  • 28,277
  • 3
  • 90
  • 82
  • I changed the code `assetservice` to `cliffservice` still getting same error. This is running fine on my local computer but when I am uploading this to ubuntu server there the same error occurs. 9200 & 9300 port is open on server. – user3306669 Oct 14 '15 at 02:03
  • Could you run `curl 10.100.10.231:9200` from the client machine? Did you try printing out and double checking the connection host and port on the client? – imotov Oct 14 '15 at 03:32
  • I tried `telnet localhost 9200` using putty Reply is `root@cliff-dev1:~# telnet localhost 9200` `Trying 127.0.0.1...` `Connected to localhost.` `Escape character is '^]'.` – user3306669 Oct 14 '15 at 05:20
  • Why are you using localhost? Is this the host that you provide to the client? Are client and elasticsearch on the same machine? – imotov Oct 14 '15 at 13:07
  • elasticsearch and the application both are in same server that is why I am using localhost – user3306669 Oct 14 '15 at 15:02
0

Finally i figured out the problem. I was using elasticsearch-1.7.1 in my Java application. In my local computer Elasticsearch-1.7.1 is installed but in server the version of elasticsearch was 1.7.2. That was the problem. I downgraded server's elasticsearch to 1.7.1 and now it is working fine.

user3306669
  • 117
  • 1
  • 11
  • This shouldn't be an issue. Transport client should be compatible with any server within the major version. In other words any 1.X.Y client should be able to connect to any 1.A.B server. I just tested it with 1.7.1 and 1.7.2 and everything works fine as expected. So, I suspect it was some sort of a configuration issue. – imotov Oct 14 '15 at 18:57
  • But believe me this is the only thing that I have changed. I have not changed anything in my code, just stopped elasticsearch 1.7.2 and started 1.7.1 with `cluster.name` as `cliffservice` and it started working. – user3306669 Oct 15 '15 at 07:19
  • Can you reproduce it? – imotov Oct 15 '15 at 14:00