Alfresco Javascript Debugger

When developing on Alfresco, you’ll want to use the Alfresco Javascript Debugger to debug server-side Javascript.

On a local install this is available through URLs like this:

  • http://localhost:8080/alfresco/s/api/javascript/debugger
  • http://localhost:8080/share/page/api/javascript/debugger

However, on certain installations, for example the Mac OSX, when you go to turn on the Javascript debugger you’ll get the following error:

The Web Script /share/page/api/javascript/debugger has responded with a status of 500 - Internal Error.

In the relevant log, you’ll also see a message along these lines:

Caused by java.awt.HeadlessException
at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:159)
...

This is actually caused by a setting passed to Java in the tomcat ctl.sh script which starts Alfresco and sets java.awt.headless to true, disabling graphical interfaces like the Javascript Debugger.

So to get the Javascript Debugger working, open up tomcat/scripts/ctl.sh and remove
-Djava.awt.headless=true in export JAVA_OPTS= in the start_tomcat() and daemon_tomat() functions.