cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in start workflow from script written in Process Definition

yogeshpj
Star Contributor
Star Contributor
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?
7 REPLIES 7

lementree
Champ on-the-rise
Champ on-the-rise
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.

ismaelgarcia
Champ in-the-making
Champ in-the-making
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:

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

tonyrivet
Champ in-the-making
Champ in-the-making
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) ?

tonyrivet
Champ in-the-making
Champ in-the-making
Ok, now it works for me.
I started a "start-workflow" action asynchronously instead of using the workflow service and it raised no exception…

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

nickc
Champ in-the-making
Champ in-the-making
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);

nickc
Champ in-the-making
Champ in-the-making
I was able to get round this issue by using the CallActivity functionality available within activiti