cancel
Showing results for 
Search instead for 
Did you mean: 

problem evaluating script

albertorugnone1
Champ in-the-making
Champ in-the-making
Hello everybody,
this is my second post here.  :mrgreen:
I am pretty newbe in Activiti then I encountered soon some problems that I am not able to solve.
I hope you could help me.

I created an example process named Loan Process. In this, I have a script task with the following code
   
creditCheckOk = false;
if((income / 2) > loanAmount) {
   out:println "credit check is  ok";
   creditCheckOk = true;
}
else
{

   out:println "credit check is not ok";
}
out:println "Checked credit for " + name + " outcome is " + creditCheckOK;

running this process I receive the following exception

org.activiti.engine.ActivitiException: problem evaluating script: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: creditCheckOK for class: Script1

very long stacktrace

Caused by: javax.script.ScriptException: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: creditCheckOK for class: Script1
   at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:117)
   at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:216)
   at org.activiti.engine.impl.scripting.ScriptingEngines.evaluate(ScriptingEngines.java:75)
   … 86 more
Caused by: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: creditCheckOK for class: Script1
   at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:318)
   at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:111)
   … 88 more
Caused by: groovy.lang.MissingPropertyException: No such property: creditCheckOK for class: Script1
   at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:49)
   at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49)
   at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:239)
   at Script1.run(Script1.groovy:13)
   at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:315)
   … 89 more

In my understanding, groovy script should create automatically process variables if def keyword is not used, then also creditCheckOk .
I am quite confused, maybe you could help me.
you can download the project from here
https://www.dropbox.com/s/6q6hifz3rio0mms/LoanRequestFail.zip. The test to be runned is LoanRequestTest.

Thank you very much for your help. :ugeek:
4 REPLIES 4

frederikherema1
Star Contributor
Star Contributor
You have a type on this line, "OK" instead of "Ok" you're using to set the value:


outSmiley Tonguerintln "Checked credit for " + name + " outcome is " + creditCheckOK;

albertorugnone1
Champ in-the-making
Champ in-the-making
Ouch!
sorry!  Smiley Surprisedops:
Thank you very much

ps. Is it planned to have script editors embedding in activiti plugin? It could help to check consistency of coding. Again, the variable created like this or by java code are  not checked then you have data structure spread between bpmn, java code, scripting etc..  have some support by designer plugin to discover at compile time and not at runtime these issues, I think it would be a great help. Something to cover this need is planned or even only considered?

jbarrez
Star Contributor
Star Contributor
No, nothing planned in that area. Also because script type is pluggable, and any scripting engine could be used. Furthermore it would require a massive amount of work … unless there exist packages that already can do it?

albertorugnone1
Champ in-the-making
Champ in-the-making
unless there exist packages that already can do it?
Really I don't know. I know for example that there are a plugin for eclipse to do Groovy project, maybe we could integrate this with designer. Same think for other scripting. Anyway, If I may put my two cents in. it is true that it is a huge amount of work, but I am wondering if the functionality worth taking the effort required. Viceversa if there isn't this functionalities scripting tasks lost a bit of his potentialities.

Kind regards and thank you again  :ugeek: