I ran into this same error on my Ubuntu 15.10 server but did not want to install the non-headless version of OpenJDK due to the number of additional dependencies. A simpler solution was to simply disable assistive technologies.
This can be done by editing the
accessibility.properties file for OpenJDK 8 (change the version to whichever is actually in use on your system):
sudo vim /etc/java-8-openjdk/accessibility.properties
Comment out the following line:
Also you can edit this line programmatically:
sudo sed -i -e '/^assistive_technologies=/s/^/#/' /etc/java-*-openjdk/accessibility.properties