cancel
Showing results for 
Search instead for 
Did you mean: 

Activiti and JDK 1.8

sebas1
Champ in-the-making
Champ in-the-making
Hi,

I was wondering if JDK 1.8 is supported in the latest version of Activiti?

My current processes seem to run fine in 1.8, but I ran into a little problem that probably is related to the new javascript engine (nashorn) in Java 8.

When my process has a

<scriptTask id="scripttask1" name="Set notices 0" scriptFormat="javascript" activiti:autoStoreVariables="true">
<script>nrOfNotices = 0</script>
</scriptTask>


(Javascript instead of javascript same result)

the engine gives a nice error when it encounters that scriptTask:


org.activiti.engine.ActivitiException: Job 228035 failed
        at org.activiti.engine.impl.cmd.ExecuteJobsCmd.execute(ExecuteJobsCmd.java:101) ~[activiti-engine-5.15.1.jar:5.15.1]
        at org.activiti.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:24) ~[activiti-engine-5.15.1.jar:5.15.1]
        at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:57) ~[activiti-engine-5.15.1.jar:5.15.1]
        at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31) ~[activiti-engine-5.15.1.jar:5.15.1]
        at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40) ~[activiti-engine-5.15.1.jar:5.15.1]
        at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35) ~[activiti-engine-5.15.1.jar:5.15.1]
Caused by: org.activiti.engine.ActivitiException: Can't find scripting engine for 'javascript'
        at org.activiti.engine.impl.scripting.ScriptingEngines.getEngineByName(ScriptingEngines.java:124) ~[activiti-engine-5.15.1.jar:5.15.1]
        at org.activiti.engine.impl.scripting.ScriptingEngines.evaluate(ScriptingEngines.java:85) ~[activiti-engine-5.15.1.jar:5.15.1]
        at org.activiti.engine.impl.scripting.ScriptingEngines.evaluate(ScriptingEngines.java:73) ~[activiti-engine-5.15.1.jar:5.15.1]
        at org.activiti.engine.impl.bpmn.behavior.ScriptTaskActivityBehavior.execute(ScriptTaskActivityBehavior.java:63) ~[activiti-engine-5.15.1.jar:5.15.1]
        at org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:54) ~[activiti-engine-5.15.1.jar:5.15.1]
        at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:90) ~[activiti-engine-5.15.1.jar:5.15.1]


Migrating my projects to jdk 1.8, so I would really like it if activiti would play along Smiley Happy

Sebas

7 REPLIES 7

trademak
Star Contributor
Star Contributor
Joram wrote a blogpost about this:

http://www.jorambarrez.be/blog/2014/04/24/running-activiti-on-jdk8/

Best regards,

sebas1
Champ in-the-making
Champ in-the-making
That looks like a solution I can work with. It does not describe the error i'm getting, but according to that page I should not be getting one so I have to look outside of activiti for a solution.

Much appreciated for the reply.

sebas1
Champ in-the-making
Champ in-the-making
Just to close this thread, been digging a bit deeper and I found that in org.activiti.engine.impl.scripting.ScriptingEngines the ScriptEngineManager gets created, and without constructor it uses the classloader from the current thread.
I found that this is a problem in my environment (probably sbt related) since the classloader cannot find nashorn.

frauke
Champ in-the-making
Champ in-the-making
Hello everyone!

I am not so very happy with the solution Joram recommended in his blog (see above), because I do not know how our customers will react when we tell them they have to modify all their proceses.
The problem is that we recommended a script like the following for setting (more than one) process variables.
<code>
    <scriptTask id="scriptInitData" name="Init Process Data" scriptFormat="javascript">
      <script>
        execution.setVariable("MyVariable1", "myValue1")
        execution.setVariable("MyVariable2", "myValue2")
      </script>
</code>
This script throws the serializable exception on a class of Nashorn itself, named ScriptObjectMirror.
And the suggested solution by adding
<code>load("nashorn:mozilla_compat.js");</code>
to the script does not help here!
Don't you have a suggestion how to handle this kind of problem in the code instead of the script?

Best regards
Frauke

frauke
Champ in-the-making
Champ in-the-making
Hello,

now I even tried out the trick you presented in
http://www.jorambarrez.be/blog/2013/03/25/bug-on-jdk-1-7-0_17-when-using-scripttask-in-activiti/
But it didn't help here….I think nashorn is really a problem.

Best regards
Frauke

sebas1
Champ in-the-making
Champ in-the-making
Just fyi, problem was never solved for me, we are just keeping that specific project at java 7.
The framework is supposedly the problem, but the developers from the framework i'm using are telling me nothing changed in the class loading, so it is a dead end.

jbarrez
Star Contributor
Star Contributor
>I am not so very happy with the solution Joram recommended in his blog (see above), because I do not know how our customers will react
>when we tell them they have to modify all their proceses.

I'm not happy neither. But the JDK devs have been changing stuff in the JS engine quite regularly from java 6 onwards. From 7-> 8 is probably the biggest one.

@Frauke: you could help me by providing a unit test that fails on JDK 8, but works on JDK7.