AnsweredAssumed Answered

What is wrong with my jruby script?

Question asked by zloy on Jul 10, 2015
Latest reply on Jul 14, 2015 by jbarrez
Hi, there!
I tried to start processes for two almost identical Vacation Request process definitions. These process definitions differ in script task definition only - one contains jruby script, the other groovy one. Seems jruby script gets an empty environment.

     <scriptTask id="theScriptTask" name="Execute script" scriptFormat="jruby" activiti:autoStoreVariables="false">
        puts "Hello from jruby!"
        puts "local variables = #{local_variables}"
        puts "instance variables = #{instance_variables}"
        puts "methods = #{methods - Object.methods}"
          puts "execution = #{execution}"
          puts "execution rescued"
        puts "self = #{inspect}"

it puts to catalina.log

06:13:09,665 [http-8080-2] INFO  org.activiti.engine.impl.bpmn.deployer.BpmnDeployer  - Processing resource VacationRequest(jruby).bpmn20.xml
Hello from jruby!
local variables = []
instance variables = []
methods = []
execution rescued
self = main

And here is groovy script:

    <scriptTask id="theScriptTask" name="Execute script" scriptFormat="groovy" activiti:autoStoreVariables="false">
        System.err.println("Smoke test passed: " + execution.getVariables().inspect())

which produces:

05:54:18,255 [http-8080-2] INFO  org.activiti.engine.impl.bpmn.deployer.BpmnDeployer  - Processing resource VacationRequest (groovy).bpmn20.xml
Smoke test passed: ['startDate':Thu Jul 16 05:54:00 MSK 2015, 'vacationMotivation':'vcbcbcbvb', 'numberOfDays':5, 'employeeName':'kermit']