So you’ve just adopted Apache Ignite for your latest project. Their distribution comes with SQLLine, which you can run to execute SQL statements against your running Ignite nodes. You then deploy your application and Ignite on an Ubuntu server. Thereupon you attempt to run that sqlline.sh file from your server to check your database… However the SQLLine in Apache Ignite doesn’t start!
It doesn’t even give you an error message!
Maybe you must be part of the right Linux group? Indeed, you likely installed Ignite on server using the DEB repository. In that case Linux runs the NoSQL database as an “ignite” user, member of an “ignite” group. Certainly you must become member of that same group, for security reasons…
But nope. Even after granting yourself the membership to the “ignite” group, the utility doesn’t start.
So you start examining that sqlline.sh file for clues. You even add echo statements to see where the script fails…
Of course it has nothing to do with Linux user groups. Indeed you soon find out the sqlline.sh uses JAVA_HOME in its logic. And in order for it to work, you need a JAVA_HOME that actually points to the correct folder!
Fair enough: I haven’t needed to define that environment variable for quite some time. That said, most JDK installation guides will remind you to perform this step, as a good practice.
In this case, the solution is therefore to add the variable to Ubuntu’s
You will probably need to sudo in order to modify that file.
Then reload your variables using
source /etc/environment and test it with
Let’s script that
As a bonus, why not making sure your server deployment scripts add the variable for you! In Ansible you could use something in the lines of:
- name: setup JAVA_HOME lineinfile: path: /etc/environment regexp: '^JAVA_HOME=' line: JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64" register: javahome_out
That will add the JAVA_HOME definition to the environment file, but only if it’s missing.