Fix groovy script invocation using the nuxeo shell script command
-----------------------------------------------------------------

                 Key: NXP-4888
                 URL: https://jira.nuxeo.org/browse/NXP-4888
             Project: Nuxeo Enterprise Platform
          Issue Type: Bug
    Affects Versions: 5.3 GA
            Reporter: Benoit Delbosc


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
...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://jira.nuxeo.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
ECM-tickets mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm-tickets

Reply via email to