When starting the glassfish server via IntelliJ I always got a Null-Pointer exception with JDK 8 (it was for sure not 9).
I had to set the environment variable AS_JAVA in <<glassfish_home>>\glassfish\config\asenv.bat to the full path of my JDK in order to get rid of it.
set AS_JAVA=C:\Program Files (x86)\Java\jdk1.8.0_144
I can just guess, that this is probably a problem when starting IntelliJ 64bit and glassfish? is probably 32bit?