Skip to content

Elasticsearch 6+ packages are missing libjnidispatch.so which means only able to bind ES to localhost.  #93

Description

@gavinwill

Hi.

Elasticsearch 6.1 package will by default try to bind to localhost unless the elasticsearch.yml file is modified. For testing and single node "cluster" this is fine. However when using a multi node cluster we naturally need for Elasticsearch to bind to an address other than localhost to allow inter node communication.

When changing the elasticsearch.yml file and restarting the service we see the errors in the logs:

unable to load JNA native support library, native methods will be disabled.

Elasticsearch service will not start up unless we change the config back to bind to localhost.

With the Elasticsearch 6.1 package there is a jar supplied jna-4.4.0-1.jar locate at /opt/local/lib/elasticsearch/lib which does not contain the required files for smartos and JNA to function (and as such to enable ES to bind to anything other than localhost).

Looking at the contents of JNA we can see the following:

jar tf jna-4.4.0-1.jar | grep lib
com/sun/jna/darwin/libjnidispatch.jnilib
com/sun/jna/linux-aarch64/libjnidispatch.so
com/sun/jna/linux-x86-64/libjnidispatch.so

We can manually update this jna-4.4.0-1.orig.jar file by extracting the contents, obtaining a prebuilt binary of the libjnidispatch.so for sunos and bundling the new jar together.

  • Extract the jar: jar xf jna-4.4.0-1.jar

  • Obtain prebuilt binary for sunos / smartos via: https://github.com/java-native-access/jna/blob/master/lib/native/sunos-x86-64.jar

  • Extract sunos-x86-64.jar jar file to obtain libjnidispatch.so

  • Move libjnidispatch.so into a new folder under com/sun/jna/ called sunos-x86-64

  • Bundle the jar up again with jar cf jna-4.4.0-1.jar com/

  • Sanity check the new jar to see the file is present in the new jar ok:

jar tf jna-4.4.0-1.jar | grep lib
com/sun/jna/darwin/libjnidispatch.jnilib
com/sun/jna/linux-x86-64/libjnidispatch.so
com/sun/jna/sunos-x86-64/libjnidispatch.so
com/sun/jna/linux-aarch64/libjnidispatch.so
  • Move this new jna-4.4.0-1.jar back into the Elasticsearch default install directory at /opt/local/lib/elasticsearch/lib

At this point if we change elasticsearch config to listen to anything other that localhost the service will start up fine and inter node comms between nodes in an Elasticsearch cluster will function fine.

curl 10.24.100.189:9200

{
  "name" : "estest",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "E78fmJ9_TR63_8DicQNTGw",
  "version" : {
    "number" : "6.1.0"
........

We see the same problem in the trunk version of Elasticsearch version 6.2.2 but with a slight variation. We see that sunos is included in the jar file but x86 is not.

jar tf jna-4.5.1.jar | grep sunos
com/sun/jna/sunos-sparcv9/
com/sun/jna/sunos-sparcv9/libjnidispatch.so
com/sun/jna/sunos-sparc/
com/sun/jna/sunos-sparc/libjnidispatch.so

Activity

  1. changed the title [-]Elasticseearch 6+ packages are missing libjnidispatch.so which means only able to bind ES to localhost. [/-] [+]Elasticsearch 6+ packages are missing libjnidispatch.so which means only able to bind ES to localhost. [/+] on Apr 2, 2018
  2. self-assigned this
    on Apr 6, 2018
  3. mamash commented on Apr 6, 2018

    @mamash

    Thanks for the report. I'll have the elasticsearch package pull the sources for JNA and build the lib file from source rather than fetch it.

  4. gavinwill commented on Apr 6, 2018

    @gavinwill
    Author

    Point to note also if needing to bind to other than localhost is that Elasticsearch requires java options to be the same. This is part of the checks ES does and as such need to adjust the service manifest from :

      <propval name='min_heap' type='astring' value='256m' />
      <propval name='max_heap' type='astring' value='1g' />
    

    to:

      <propval name='min_heap' type='astring' value='1g' />
      <propval name='max_heap' type='astring' value='1g' />
    

    This is naturally a configurable the user can set. Its not a bug but just including it here for reference.

  5. mamash commented on Apr 6, 2018

    @mamash

    Thanks for the heads up. The docs suggest the heap size should be uniform for best performance too, so I'll set both values to 1g now.

  6. mamash commented on May 22, 2018

    @mamash

    I've backported this feature to 2017Q4.

  7. added a commit that references this issue on Aug 16, 2018
  8. added a commit that references this issue on Mar 26, 2019
  9. added a commit that references this issue on Dec 3, 2019
  10. added a commit that references this issue on Nov 13, 2020
  11. 90 remaining items

  12. added a commit that references this issue on May 22, 2026
  13. added a commit that references this issue on Jun 12, 2026
  14. added a commit that references this issue on Jul 26, 2026
  15. added a commit that references this issue on Aug 3, 2026
  16. added a commit that references this issue on Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions