Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-4888

Fix groovy script invocation using the nuxeo shell script command

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Cannot Reproduce
    • Affects Version/s: 5.3 GA
    • Fix Version/s: 5.7.1
    • Component/s: Shell

      Description

      The nuxeo shell "script" command:is not working as expected

      cd nuxeo-shell
      ./nxshell.sh -h localhost

      > help script
      Command: script - Executes scripts
      Aliases: s
      Options:
      --file [shortcut: -f]
      A path to the
      script file to execute
      > script -f scripts/select.groovy "select * from Document"
      Command failed.
      javax.script.ScriptException: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: ctx for class: Script1
      at com.sun.script.groovy.GroovyScriptEngine.eval(GroovyScriptEngine.java:87)
      at com.sun.script.groovy.GroovyScriptEngine.eval(GroovyScriptEngine.java:75)
      at org.nuxeo.ecm.shell.commands.ScriptCommand.eval(ScriptCommand.java:78)
      at org.nuxeo.ecm.shell.commands.ScriptCommand.run(ScriptCommand.java:59)
      at org.nuxeo.ecm.shell.CommandLineService.runCommand(CommandLineService.java:329)
      at org.nuxeo.ecm.shell.commands.InteractiveCommand.runCommand(InteractiveCommand.java:137)
      at org.nuxeo.ecm.shell.commands.InteractiveCommand.processInput(InteractiveCommand.java:117)
      at org.nuxeo.ecm.shell.commands.InteractiveCommand.run(InteractiveCommand.java:97)
      at org.nuxeo.ecm.shell.CommandLineService.runCommand(CommandLineService.java:329)
      at org.nuxeo.ecm.shell.Main.main(Main.java:101)

      the workaround is to put the scripts inside the nuxeo-shell/scripts directory and to invoke the script without the "script" command:

      > select * from Document
      ...

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              bdelbosc Benoit Delbosc
              Participants:
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: