<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Serialization bug in scripts with JDK &amp;gt;= 1.6.0_43 in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/serialization-bug-in-scripts-with-jdk-gt-1-6-0-43/m-p/24929#M10812</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm using an ad-hoc test definition and I undeployed every preivous version before trying a new one to be sure just one version is available at a time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll get the stacktrace from the log and paste it in a further message.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 08 May 2017 15:40:54 GMT</pubDate>
    <dc:creator>matutano6</dc:creator>
    <dc:date>2017-05-08T15:40:54Z</dc:date>
    <item>
      <title>Serialization bug in scripts with JDK &gt;= 1.6.0_43</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/serialization-bug-in-scripts-with-jdk-gt-1-6-0-43/m-p/24923#M10806</link>
      <description>Hi,I'm using Activiti 5.17.0, and I recently upgraded to JDK 1.7 from 1.6.0_26 and reached a problem with serialization in scripts. Searching forums, I found several articles regarding the issue. Some of them are:Bug on JDK 1.7.0_17 when using ScriptTask in Activiti | Small steps with big feet&amp;nbsp;could</description>
      <pubDate>Fri, 05 May 2017 17:47:13 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/serialization-bug-in-scripts-with-jdk-gt-1-6-0-43/m-p/24923#M10806</guid>
      <dc:creator>matutano6</dc:creator>
      <dc:date>2017-05-05T17:47:13Z</dc:date>
    </item>
    <item>
      <title>Re: Serialization bug in scripts with JDK &gt;= 1.6.0_43</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/serialization-bug-in-scripts-with-jdk-gt-1-6-0-43/m-p/24924#M10807</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why did you only upgrade from an extremely obsolete Java version to another obsolete Java version? Java 7 will have no more public updates and should be considered out of support for all intents and purposes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you do not use the "resultVariable" parameter on the ScriptExecutionListener it should not try to automatically store the result of the script execution. Then only the explicit setVariable operation will store data. I see no reason you needed to switch to ScriptTask if you did not use "resultVariable" before.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before storing / using any variable from a script it is usually a good idea to check for undefined / null. Despite the tight integration of the JavaScript runtime into Java via JSR-223 you should not assume any value can just be stored. E.g. in the last two of the three links to other issues the specific developer should have made sure to convert the script values to Java values before storing them via a Java API exposed to JavaScript. For JS arrays, Nashorn (Java 8+) provides a utility function in the form of Java.to(array, 'List') to convert a script array to a Java array or List.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 May 2017 10:51:51 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/serialization-bug-in-scripts-with-jdk-gt-1-6-0-43/m-p/24924#M10807</guid>
      <dc:creator>afaust</dc:creator>
      <dc:date>2017-05-06T10:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: Serialization bug in scripts with JDK &gt;= 1.6.0_43</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/serialization-bug-in-scripts-with-jdk-gt-1-6-0-43/m-p/24925#M10808</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Axel,&lt;/P&gt;&lt;P&gt;thanks for you answer. I would like to clarify some of your questions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In production environments, I'm using Debian stable, wich IFAIK has no Java 8 yet. In any case, Java 8 has not corrected the problem. The exception message changes a little, but it's still there until the last version of Java 8 I could try.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regarding checking null and undefined variables, the problem has nothing to do with that. The bug exposes every time the script is executed, havig no null or undefined values at all. For example, this script fails:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;script&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; var rv = "hello";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; rv; // to be assigned to a varible named after parameter "resultVariable"&lt;/P&gt;&lt;P&gt;&amp;lt;/script&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While this one does not:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;scipt&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; "hello"; // to be assigned to a varible named after parameter "resultVariable"&lt;/P&gt;&lt;P&gt;&amp;lt;/script&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like also to share the results of another test I did yesterday: I can reproduce the problem with Oracle JDK &amp;gt;= 1.6.0_43 (1.7 and 1.8 too) and some version of IBM JDK 1.6, but it does work well with OpenJDK 1.7.0_121, and I assume with greater versions of OpenJDK will work too. This may help to others in my situation, who can migrate to OpenJDK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At least for me, the doubt is still out there: is it a bug or is it a decision? And in the second scenario, shouldn't Activiti Engine provide a fix or removing "resultVariable" as an option?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again,&lt;/P&gt;&lt;P&gt;M&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 May 2017 17:13:06 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/serialization-bug-in-scripts-with-jdk-gt-1-6-0-43/m-p/24925#M10808</guid>
      <dc:creator>matutano6</dc:creator>
      <dc:date>2017-05-06T17:13:06Z</dc:date>
    </item>
    <item>
      <title>Re: Serialization bug in scripts with JDK &gt;= 1.6.0_43</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/serialization-bug-in-scripts-with-jdk-gt-1-6-0-43/m-p/24926#M10809</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The problem is that Activiti Engine cannot provide a fix for the way script engines are integrated in Java - they can only remove remove it as "too easy to shoot yourself in the foot with". The problem with the "resultVariable" handling is that it relies on the implicit return value of the last statement in the script. Depending on the script engine as well as its internal optimisations (e.g. compiling away code lines that don't "do anything") the result value might be something the developer / user did not consider (undefined in the case of this issue). Likely the Java 7 release has seen an update to the integrated Rhino engine that added optimisations / superflous code elimination to change the implicit return value in your scripts.&lt;/P&gt;&lt;P&gt;From what I know about the various script engines it should neither be considered a bug nor a specific decision - it is more a matter of poor documentation of conceptional limits / poor expectation management. For that reason I consider setVariable not as a workaround, but the canonical / correct approach in the first place, and have used it as such since starting with Activiti in 2012.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 May 2017 15:59:55 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/serialization-bug-in-scripts-with-jdk-gt-1-6-0-43/m-p/24926#M10809</guid>
      <dc:creator>afaust</dc:creator>
      <dc:date>2017-05-07T15:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: Serialization bug in scripts with JDK &gt;= 1.6.0_43</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/serialization-bug-in-scripts-with-jdk-gt-1-6-0-43/m-p/24927#M10810</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, I tried avoiding "resultVariable" parameter and the problem still happens. The same process definition running with Sun JDK &amp;lt; 1.6.0_43 or OpenJDK works fine, but whe I use the above mentioned JVM, I get the exception.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, at the moment, I cannot make script listeners to work. I tried this script without success (and without "resultVariable" parameter):&lt;/P&gt;&lt;P&gt;&amp;lt;script&amp;gt;&lt;/P&gt;&lt;P&gt;var rv = "hello";&lt;BR /&gt;execution.setVariable("result", rv);&lt;/P&gt;&lt;P&gt;&amp;lt;/script&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The exception message says:&lt;/P&gt;&lt;P&gt;"couldn't find a variable type that is able to serialize &lt;A href="mailto:sun.org.mozilla.javascript.internal.Undefined@1b437790&amp;quot;" rel="nofollow noopener noreferrer"&gt;sun.org.mozilla.javascript.internal.Undefined@1b437790"&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am facing another issue?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;M&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 May 2017 15:29:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/serialization-bug-in-scripts-with-jdk-gt-1-6-0-43/m-p/24927#M10810</guid>
      <dc:creator>matutano6</dc:creator>
      <dc:date>2017-05-08T15:29:00Z</dc:date>
    </item>
    <item>
      <title>Re: Serialization bug in scripts with JDK &gt;= 1.6.0_43</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/serialization-bug-in-scripts-with-jdk-gt-1-6-0-43/m-p/24928#M10811</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hmm - are you sure you are running the process in the correct definition version? Now there definitely should not be an undefined anywhere. Can you try to get a stacktrace for the error to check that it is using the correct code path?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 May 2017 15:31:20 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/serialization-bug-in-scripts-with-jdk-gt-1-6-0-43/m-p/24928#M10811</guid>
      <dc:creator>afaust</dc:creator>
      <dc:date>2017-05-08T15:31:20Z</dc:date>
    </item>
    <item>
      <title>Re: Serialization bug in scripts with JDK &gt;= 1.6.0_43</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/serialization-bug-in-scripts-with-jdk-gt-1-6-0-43/m-p/24929#M10812</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm using an ad-hoc test definition and I undeployed every preivous version before trying a new one to be sure just one version is available at a time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll get the stacktrace from the log and paste it in a further message.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 May 2017 15:40:54 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/serialization-bug-in-scripts-with-jdk-gt-1-6-0-43/m-p/24929#M10812</guid>
      <dc:creator>matutano6</dc:creator>
      <dc:date>2017-05-08T15:40:54Z</dc:date>
    </item>
    <item>
      <title>Re: Serialization bug in scripts with JDK &gt;= 1.6.0_43</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/serialization-bug-in-scripts-with-jdk-gt-1-6-0-43/m-p/24930#M10813</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I uploaded the test definition I'm using, if you would like to see it. I'm pretty sure there are no undefines anywhere.&lt;/P&gt;&lt;P&gt;&lt;A __default_attr="6856" __jive_macro_name="document" _jive_internal="true" class="jive_macro jive_macro_document link-titled" href="https://community.alfresco.com/docs/DOC-6856-testjava7serializationbugbpmn" rel="nofollow noopener noreferrer"&gt;&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 May 2017 15:52:13 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/serialization-bug-in-scripts-with-jdk-gt-1-6-0-43/m-p/24930#M10813</guid>
      <dc:creator>matutano6</dc:creator>
      <dc:date>2017-05-08T15:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: Serialization bug in scripts with JDK &gt;= 1.6.0_43</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/serialization-bug-in-scripts-with-jdk-gt-1-6-0-43/m-p/24931#M10814</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And below is the relevant part of the stacktrace.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code involved is this:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;public VariableType findVariableType(Object value) {&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;for (VariableType type : typesList) {&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if (type.isAbleToStore(value)) {&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;return type;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;throw new ActivitiException("couldn't find a variable type that is able to serialize " + value);&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I should do some debug to see what types are in "typesList" and why aren't any of them able to store the value, wich BTW, seems to be undefined regardless I cannot see how could that happen with the definition I'm using.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;org.activiti.engine.ActivitiException: couldn't find a variable type that is able to serialize sun.org.mozilla.javascript.internal.Undefined@1b437790 &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at org.activiti.engine.impl.variable.DefaultVariableTypes.findVariableType(DefaultVariableTypes.java:62) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at org.activiti.engine.impl.persistence.entity.VariableScopeImpl.createVariableInstance(VariableScopeImpl.java:690) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at org.activiti.engine.impl.persistence.entity.ExecutionEntity.createVariableInstance(ExecutionEntity.java:1171) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at org.activiti.engine.impl.persistence.entity.VariableScopeImpl.createVariableLocal(VariableScopeImpl.java:604) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at org.activiti.engine.impl.persistence.entity.VariableScopeImpl.createVariableLocal(VariableScopeImpl.java:591) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at org.activiti.engine.impl.persistence.entity.VariableScopeImpl.setVariable(VariableScopeImpl.java:485) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at org.activiti.engine.impl.persistence.entity.VariableScopeImpl.setVariable(VariableScopeImpl.java:442) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at org.activiti.engine.impl.scripting.ScriptBindings.put(ScriptBindings.java:83) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at javax.script.SimpleScriptContext.setAttribute(SimpleScriptContext.java:228) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at com.sun.script.javascript.ExternalScriptable.put(ExternalScriptable.java:182) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at sun.org.mozilla.javascript.internal.ScriptableObject.defineProperty(ScriptableObject.java:1396) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at sun.org.mozilla.javascript.internal.ScriptRuntime.initScript(ScriptRuntime.java:3238) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at sun.org.mozilla.javascript.internal.Interpreter.initFrame(Interpreter.java:2695) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at sun.org.mozilla.javascript.internal.Interpreter.interpret(Interpreter.java:844) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at sun.org.mozilla.javascript.internal.InterpretedFunction.call(InterpretedFunction.java:162) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at sun.org.mozilla.javascript.internal.ContextFactory.doTopCall(ContextFactory.java:430) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at com.sun.script.javascript.RhinoScriptEngine$1.superDoTopCall(RhinoScriptEngine.java:116) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at com.sun.script.javascript.RhinoScriptEngine$1.doTopCall(RhinoScriptEngine.java:109) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at sun.org.mozilla.javascript.internal.ScriptRuntime.doTopCall(ScriptRuntime.java:3160) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at sun.org.mozilla.javascript.internal.InterpretedFunction.exec(InterpretedFunction.java:173) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at sun.org.mozilla.javascript.internal.Context.evaluateReader(Context.java:1169) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:214) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:240) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at org.activiti.engine.impl.scripting.ScriptingEngines.evaluate(ScriptingEngines.java:87) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at org.activiti.engine.impl.scripting.ScriptingEngines.evaluate(ScriptingEngines.java:69) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at org.activiti.engine.impl.bpmn.listener.ScriptExecutionListener.notify(ScriptExecutionListener.java:45)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 May 2017 16:02:54 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/serialization-bug-in-scripts-with-jdk-gt-1-6-0-43/m-p/24931#M10814</guid>
      <dc:creator>matutano6</dc:creator>
      <dc:date>2017-05-08T16:02:54Z</dc:date>
    </item>
    <item>
      <title>Re: Serialization bug in scripts with JDK &gt;= 1.6.0_43</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/serialization-bug-in-scripts-with-jdk-gt-1-6-0-43/m-p/24932#M10815</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ahh, too bad the script is interpreted and not compiled. It looks like the problem in your case has nothing to do with the setVariable() and/or resultVariable at all. The issue originates from SimpleScriptContext.setAttribute which is only called for variable local variable assignments. The Activiti engine creates a custom script binding linked to the current execution. Whenever a local variable is defined in a script it will store that variable in the execution. The cause may be your use of the "var" keyword. In JavaScript all variables defined via "var" will be initialised with "undefined" at the start of their enclosing scope (script file / function). The statement&lt;/P&gt;&lt;PRE class="language-javascript line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; rv &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"hello"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;actually results in two distinct runtime instructions&lt;/P&gt;&lt;PRE class="language-javascript line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; rv&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;rv &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"hellO"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please try running your process without the "var" keyword. Note that Activiti will still store all variables in the execution by default.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another option would be to wrap the listener code in an anonymous function to avoid adding to the implicit global scope&lt;/P&gt;&lt;PRE class="language-javascript line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; rv &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"hello"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; execution&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;setVariable&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"result"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; rv&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have only ever used the Alfresco ECM specific script execution listener and this does behave quite a bit different in this context, without requiring any of these shenanigans (even after upgrades from Java 6 to 7 or 8).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 May 2017 16:21:51 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/serialization-bug-in-scripts-with-jdk-gt-1-6-0-43/m-p/24932#M10815</guid>
      <dc:creator>afaust</dc:creator>
      <dc:date>2017-05-08T16:21:51Z</dc:date>
    </item>
    <item>
      <title>Re: Serialization bug in scripts with JDK &gt;= 1.6.0_43</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/serialization-bug-in-scripts-with-jdk-gt-1-6-0-43/m-p/24933#M10816</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great explanation and great solution!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Without the "var" keyword, both ways worked (using "resultVariable" parameter and with "setVariable")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Allright, just to clarify: the problem is really related to the JVM behaviour, but it fires at the variable declaration using "var" keyword, not while returning the result. Am I right? This may help other in the future.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;&lt;P&gt;M&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 May 2017 17:00:34 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/serialization-bug-in-scripts-with-jdk-gt-1-6-0-43/m-p/24933#M10816</guid>
      <dc:creator>matutano6</dc:creator>
      <dc:date>2017-05-08T17:00:34Z</dc:date>
    </item>
    <item>
      <title>Re: Serialization bug in scripts with JDK &gt;= 1.6.0_43</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/serialization-bug-in-scripts-with-jdk-gt-1-6-0-43/m-p/24934#M10817</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your understanding is correct. I would want to separate the script engine behaviour from the JVM behaviour. Effectively, Sun/Oracle only licensed and integrated an already existing open source JavaScript engine from Mozilla (Rhino) which runs "on" the JVM but should not be considered part of the JVM. Essentially it is just a reference implementation for JSR-223 that is shipped with the JRE/JDK.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 May 2017 23:31:58 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/serialization-bug-in-scripts-with-jdk-gt-1-6-0-43/m-p/24934#M10817</guid>
      <dc:creator>afaust</dc:creator>
      <dc:date>2017-05-08T23:31:58Z</dc:date>
    </item>
    <item>
      <title>Re: Serialization bug in scripts with JDK &gt;= 1.6.0_43</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/serialization-bug-in-scripts-with-jdk-gt-1-6-0-43/m-p/24935#M10818</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi again! I now upgraded from JDK 1.7 to JDK 1.8 and found myself with Nashorn and the resurrection of the issue (I'm still using Activiti engine 5.17.0 for production)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The ScriptTasks do work with the precaussion of not using the var keyword neither the "resultVariable" for the implicit result. But now, ScriptExecutionListeners fail no matter what with the following exception:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;org.activiti.engine.ActivitiException: couldn't find a variable type that is able to serialize [object global]&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;at org.activiti.engine.impl.variable.DefaultVariableTypes.findVariableType(DefaultVariableTypes.java:62)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to deal with that? Is there a workarround other than extracting ScriptExecutionListeners into ScriptTasks? I'm evaluating the use of groovy instead of JS too, but it would be very painful for definition's designers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;M&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Feb 2018 22:06:03 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/serialization-bug-in-scripts-with-jdk-gt-1-6-0-43/m-p/24935#M10818</guid>
      <dc:creator>matutano6</dc:creator>
      <dc:date>2018-02-26T22:06:03Z</dc:date>
    </item>
  </channel>
</rss>

