cancel
Showing results for 
Search instead for 
Did you mean: 

What is wrong with my jruby script?

zloy
Champ in-the-making
Champ in-the-making
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">
      <script>
        puts "Hello from jruby!"
        puts "local variables = #{local_variables}"
        puts "instance variables = #{instance_variables}"
        puts "methods = #{methods - Object.methods}"
        begin
          puts "execution = #{execution}"
        rescue
          puts "execution rescued"
        end
        puts "self = #{inspect}"
      </script>
    </scriptTask>


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">
      <script>
        System.err.println("Smoke test passed: " + execution.getVariables().inspect())
      </script>
    </scriptTask>


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']
1 REPLY 1

jbarrez
Star Contributor
Star Contributor
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.