4

I am trying to debug JavaScript that is stored in the JCR and run on the server with Rhino, by the Sightly templating language's JavaScript UseAPI.

As per the instructions provided in sling.properties:

# To enable the current server side debugging in the Rhino interpreter
# set the org.apache.sling.scripting.javascript.debug property to true.
# This will open a Swing window for Rhino JavaScript debugging on the
# server platform.

When I do this, I can see the Swing window for Rhino. However, if I try to set a breakpoint on a JavaScript file, or trigger the debugger by adding a debugger; line, the debugger breaks but does not show me the correct file.

Similarly, if I select 'Break on function enter' from the Debug menu, the debugger will break but using 'Step Into/Over/Out' seems to jump to random points in the code.

Is this working for anyone else? I'm using v2.0.14 of org.apache.sling.scripting.javascript which seems to be the latest.

Alasdair McLeay
  • 2,572
  • 4
  • 27
  • 50

2 Answers2

1

As you already alluded to in one of your comments, it appears this feature hasn't actually been implemented.

Here on the main Sightly docs they list the following con for using the javascript Use API over the Java Use API:

no debugger (yet)

Jordan Shurmer
  • 946
  • 7
  • 21
0

Since the rhino script finally compiles to a java class, you can add java.lang.System.out.println("Resource path: " + resource.getPath()) statements and log values for debugging purpose, you should see the values written to crx-quickstart/logs/stdout.log

SubSul
  • 2,523
  • 1
  • 17
  • 27