NoNodeAvailableException, cannot connect Java API and Elasticsearch

The cluster name should be kept in elasticsearch.yml like you said. Though I can't say for sure ES is finding the right file. The default ES cluster name is just "elasticsearch". Try sending a request to that cluster name instead and see what happens.