Impossible to run web application in debug mode with intelliJ on ubuntu with glassfish server

I had this same problem too a few weeks ago. I dont remember 100% what I changed but I know it has to do with the file $GLASSFISH_HOME/glassfish/domains/domain1/config/domain.xml. If I recall I think I changed the following line:

<java-config debug-options="-Xdebug -Xrunjdwp:transport=dt_socket,server=n,suspend=y,address=9009" system-classpath="" classpath-suffix="">

In particular server and suspend flags. When I set them like this the error you described above went away.