It is sometimes possible that you need to run X based apps on ubuntu servers that do not have graphical libraries no GUI installed.
The easy way to check whether your ubuntu server is missing any libraries is to run the command recommended on stackoverflow.com:
jvisualvm -J-Dnetbeans.logger.console=true
This command will output names of shared libraries that are required to run the command but are missing. For example these libraries could be: libxrender1, libxtst6, libxi6. Their names can be printed also with .so.
In order to install them you can run:
sudo apt-get install libxrender1
sudo apt-get install libxtst6
sudo apt-get install libxi6
After installing a library keep running the jvisualvm command above to see if there are any libraries still missing.
If all libraries are in order the jvisualvm should start given that you have connected to your ubuntu server with ssh -X command line parameter which will stream the graphical command's GUI output to your client machine.
Have fun monitoring!