How to Debug Flowscripts

Based upon an original email by Marcus Crafter.


The Rhino debugger is a visual debugger that allows you to set break points, step in and out of functions, watch global and local variables, and generally is really useful for debugging and watching what is happening inside of your flowscript.

By default, the debugger is disabled. When enabled, it starts automatically when a flow script is executed. To enable it, add/comment-in the <debugger/> element in your flow.xconf/cocoon.xconf file, eg:

<component-instance name="JavaScript"
  <debugger>enabled</debugger>  <!-- this line enables the flow debugger -->

When the <debugger/> element is present, all threads that create a javascript interpreter will operate via a Rhino visual debugger instance.

Your servlet container needs to have the necessary permissions to interact with the user.

In Windows NT/2000/XP, if your servlet container is running as a service, you must switch on interactivity, by going to control panel/administrative tools/services/<container>/properties/logon and tick the 'allow service to interact with desktop' box.

Here's an example of what this looks like when running:


Well, so far testing in my environment with the flow examples has proved successful, so hopefully others also find it of use, if there's any problems/comments/suggestions, please feel free to let me know.

Last but not least, a big thank you to Yaar Schnitman and Christopher Oliver for their help with the Rhino debugging API's.

See also

Helma van der Linden added:

I've attached a little script to use with Ant and the X!PatchConf class to set the debugger to "enabled".

Attachment: setdebug.xconf

DebugFlowScripts (last edited 2009-09-20 23:41:54 by localhost)