Problem in start workflow from script written in Process Definition
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2014 10:12 AM
Hi All,
I am getting attached error while starting workflow from the script written in processdefinition.
<blockcode>
var doc_pack = bpm_package.children[0];
var wfdef = workflow.getDefinitionByName("activiti$activitiReview");
var wfparams = new Object();
wfparams["bpm:workflowDescription"] = "Start workflow - ";
wfparams["bpm:assignee"] = people.getPerson(initiator.properties.userName);
var wfpackage = workflow.createPackage();
wfpackage.addNode(doc_pack);
wfdef.startWorkflow(wfpackage,wfparams);
</blockcode>
This problem is happening only in 4.2 version.
In 4.1 it is working fine.
Can anyone help me?
I am getting attached error while starting workflow from the script written in processdefinition.
<blockcode>
var doc_pack = bpm_package.children[0];
var wfdef = workflow.getDefinitionByName("activiti$activitiReview");
var wfparams = new Object();
wfparams["bpm:workflowDescription"] = "Start workflow - ";
wfparams["bpm:assignee"] = people.getPerson(initiator.properties.userName);
var wfpackage = workflow.createPackage();
wfpackage.addNode(doc_pack);
wfdef.startWorkflow(wfpackage,wfparams);
</blockcode>
This problem is happening only in 4.2 version.
In 4.1 it is working fine.
Can anyone help me?
Labels:
- Labels:
-
Archive
7 REPLIES 7
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2014 07:30 AM
Hi,
Can you attache your processDefinition file, from the log it is showing [strong]Wrapped java.lang.NullPointerException (AlfrescoJS#24)[/strong] nullpointer exception at line 24 in javascript.
If I look at you processDefinition I can find the issue.
Can you attache your processDefinition file, from the log it is showing [strong]Wrapped java.lang.NullPointerException (AlfrescoJS#24)[/strong] nullpointer exception at line 24 in javascript.
If I look at you processDefinition I can find the issue.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2014 06:45 AM
We are having the same problem with Alfresco 4.2.f (Activiti 5.13-alf-20130918). We start a new WF in a Alfresco ScriptTask and we are having the same NPE at the line:
We are planning the upgrade from 4.0e and have arround 2000 active workflows, so we cannot change the way the workflows are started in the active workflows.
We have created a minimal workflow to reproduce the behaviour, (WFTEST.bpmn), that has only one task and start an alfresco ootb adhoc workflow.
<strong> So far we have tested: </strong>
- Change the start workflow script for a Java service task (for testing purpose) and the error persist.
- Change the start workflow script for a Java service task (for testing purpose) and start the workflow using an new thread. The new workflow is started.
<strong> Regarding other alfresco versions: </strong>
- In Alfresco 4.2.a (Activiti 5.10), the script task is working, and the new workflow is started.
- In Alfresco 4.2.b (Activiti 5.10), the script task is working, , and the new workflow is started.
- In Alfresco 4.2.c (Activiti 5.10-14112012), Alfresco throws an error when we try to start WFTEST (maybe another alfresco bug)
- In Alfresco 4.2.d (Activiti 5.13-alf-20130709), the same error as in 4.2.f
- In Alfresco 4.2.e (Activiti 5.13-alf-20130918), the same error as in 4.2.f
We have also tryed the lastest activiti-alfresco version (5.13-alf-20140708) with Alfresco 4.2f without luck.
The log attached is generated by activating debug in alfresco/WEB-INF/classes/log4j.properties :
log4j.logger.org.alfresco.repo.jscript=debug
log4j.logger.org.alfresco.repo.jscript.ScriptLogger=debug
log4j.logger.org.activiti.engine=debug
Has anyone any guide to solve the problem?
Thanks in advance!
<strong> Alfresco version </strong> 4.2.f
Caused by: java.lang.NullPointerExceptionat org.alfresco.repo.workflow.activiti.ActivitiTypeConverter.convert(ActivitiTypeConverter.java:300)
We are planning the upgrade from 4.0e and have arround 2000 active workflows, so we cannot change the way the workflows are started in the active workflows.
We have created a minimal workflow to reproduce the behaviour, (WFTEST.bpmn), that has only one task and start an alfresco ootb adhoc workflow.
<strong> So far we have tested: </strong>
- Change the start workflow script for a Java service task (for testing purpose) and the error persist.
- Change the start workflow script for a Java service task (for testing purpose) and start the workflow using an new thread. The new workflow is started.
<strong> Regarding other alfresco versions: </strong>
- In Alfresco 4.2.a (Activiti 5.10), the script task is working, and the new workflow is started.
- In Alfresco 4.2.b (Activiti 5.10), the script task is working, , and the new workflow is started.
- In Alfresco 4.2.c (Activiti 5.10-14112012), Alfresco throws an error when we try to start WFTEST (maybe another alfresco bug)
- In Alfresco 4.2.d (Activiti 5.13-alf-20130709), the same error as in 4.2.f
- In Alfresco 4.2.e (Activiti 5.13-alf-20130918), the same error as in 4.2.f
We have also tryed the lastest activiti-alfresco version (5.13-alf-20140708) with Alfresco 4.2f without luck.
The log attached is generated by activating debug in alfresco/WEB-INF/classes/log4j.properties :
log4j.logger.org.alfresco.repo.jscript=debug
log4j.logger.org.alfresco.repo.jscript.ScriptLogger=debug
log4j.logger.org.activiti.engine=debug
Has anyone any guide to solve the problem?
Thanks in advance!
<strong> Alfresco version </strong> 4.2.f
WFTEST.bpmn_.txt.zip
2 KB
log42e.error_.txt.zip
10 KB
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2014 11:14 AM
Hi,
I have the exact same issue, trying to start a workflow with the workflow service from a Java Delegate…
Did you manage to solve it ?
Has a JIRA been raised for this issue (couldn't find any) ?
I have the exact same issue, trying to start a workflow with the workflow service from a Java Delegate…
Did you manage to solve it ?
Has a JIRA been raised for this issue (couldn't find any) ?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2014 04:30 AM
Ok, now it works for me.
I started a "start-workflow" action asynchronously instead of using the workflow service and it raised no exception…
I started a "start-workflow" action asynchronously instead of using the workflow service and it raised no exception…

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2014 03:27 AM
Hi,
I already found another solution that works.
I compared the activiti-afresco 5.13 with 5.10 to see what has changed and found in activiti-engine that the class:
org/activiti/engine/impl/interceptor/CommandContextInterceptor.java
now reuses the context to execute the commands and the old version (5.10 series) creates a new one always.
So, I changed this class to be as it was in 5.10 and now all the workflow creation issue is gone!
I don't know if this change may affect anything else. I've researched in github and found that this change was made in version 5.11, related to the improvement http://jira.codehaus.org/browse/ACT-1387.
My solution involves recompiling activiti-engine.
Ismael Garcia
I already found another solution that works.
I compared the activiti-afresco 5.13 with 5.10 to see what has changed and found in activiti-engine that the class:
org/activiti/engine/impl/interceptor/CommandContextInterceptor.java
now reuses the context to execute the commands and the old version (5.10 series) creates a new one always.
So, I changed this class to be as it was in 5.10 and now all the workflow creation issue is gone!
I don't know if this change may affect anything else. I've researched in github and found that this change was made in version 5.11, related to the improvement http://jira.codehaus.org/browse/ACT-1387.
My solution involves recompiling activiti-engine.
Ismael Garcia

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2014 10:54 AM
Tony, I'm having the same issue trying to get a Workflow to start from an active workflow. Do you have more details of your solution or a work-around?
Ismael, are you aware of another solution, I don't really want to make any changes to activiti unless it's a last resort? I'm using verion 5.13 of Activiti on Alfresco 4.2 Enterprise.
I've been trying multiple variations of this code (below) but with no success. I keep getting the error "org.mozilla.javascript.WrappedException: Wrapped java.lang.NullPointerException"
Thanks in advance
var docu = userhome.createFile("testingjoebujok.txt");
docu.content = "original text";
var workflowDefinition = workflow.getDefinitionByName("activiti$ps_New_Post_Workflow");
var workflowPackage = workflow.createPackage();
workflowPackage.addNode(docu);
var workflowParameters = [];
workflowParameters["bpm:workflowDescription"] = "Please edit: " + docu.name;
workflowParameters["bpm:assignees"] = [people.getPerson("admin")];
var workflowPath = workflowDefinition.startWorkflow(workflowPackage, workflowParameters);
Ismael, are you aware of another solution, I don't really want to make any changes to activiti unless it's a last resort? I'm using verion 5.13 of Activiti on Alfresco 4.2 Enterprise.
I've been trying multiple variations of this code (below) but with no success. I keep getting the error "org.mozilla.javascript.WrappedException: Wrapped java.lang.NullPointerException"
Thanks in advance
var docu = userhome.createFile("testingjoebujok.txt");
docu.content = "original text";
var workflowDefinition = workflow.getDefinitionByName("activiti$ps_New_Post_Workflow");
var workflowPackage = workflow.createPackage();
workflowPackage.addNode(docu);
var workflowParameters = [];
workflowParameters["bpm:workflowDescription"] = "Please edit: " + docu.name;
workflowParameters["bpm:assignees"] = [people.getPerson("admin")];
var workflowPath = workflowDefinition.startWorkflow(workflowPackage, workflowParameters);

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2014 09:54 AM
I was able to get round this issue by using the CallActivity functionality available within activiti
