cancel
Showing results for 
Search instead for 
Did you mean: 

BUG in Activiti or not?

irenailievska1
Champ in-the-making
Champ in-the-making
I created a very advanced custom workflow. The diagram is shown on this picture https://www.dropbox.com/s/9phdey2pd976weo/fullProcess.bmp?dl=0

The process works as it is intended - no problem with the logic.

It appears that if the user task is inside of an subprocess- alfresco stops showing the tasks the user finished. I tried to go and see the completed tasks and I had the red line "Error loading items". When I undeployed the workflow everything worked just fine.
I fixed my workflow by removing the subprocesses, but still I'd like to be able to use them.

Is this a bug in Activiti, or Alfresco, or was there something I wasn't doing as I should?

The error I was getting was null pointer exception

10:32:46,031 ERROR [org.springframework.extensions.webscripts.AbstractRuntime] Exception from executeScript - redirecting to status template error: 00130003 Wrapped Exception (with status template): null
org.springframework.extensions.webscripts.WebScriptException: 00130003 Wrapped Exception (with status template): null
   at org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:1067)
   at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:171)
   at org.alfresco.repo.web.scripts.RepositoryContainer$3.execute(RepositoryContainer.java:422)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:452)
   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:491)
   at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:529)
   at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:341)
   at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:378)
   at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)
   at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:132)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
   at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:61)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
   at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
   at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
   at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
   at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
   at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
   at org.alfresco.service.cmr.workflow.LazyActivitiWorkflowTask.<init>(LazyActivitiWorkflowTask.java:91)
   at org.alfresco.repo.workflow.activiti.ActivitiWorkflowEngine.getAssignedTasks(ActivitiWorkflowEngine.java:1406)
   at org.alfresco.repo.workflow.WorkflowServiceImpl.getAssignedTasks(WorkflowServiceImpl.java:818)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:483)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
   at org.alfresco.service.cmr.workflow.WorkflowPermissionInterceptor.invoke(WorkflowPermissionInterceptor.java:127)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:46)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:161)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
   at com.sun.proxy.$Proxy74.getAssignedTasks(Unknown Source)
   at org.alfresco.repo.web.scripts.workflow.TaskInstancesGet.buildModel(TaskInstancesGet.java:130)
   at org.alfresco.repo.web.scripts.workflow.AbstractWorkflowWebscript.executeImpl(AbstractWorkflowWebscript.java:81)
   at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:64)
   … 28 more


I'd like for some of the Activiti developers to see if this is really a bug, because Activiti rocks and it would be a shame to let something like this slip.

Thanks,
Irena
6 REPLIES 6

jbarrez
Star Contributor
Star Contributor
Thanks for the kind words 🙂

It's hard to say … but it seems to be happening  in the LazyActivitiWorkflowTask … which definitely is not an Activiti class.

The process, altough rich in exclusive gateways … doesn't seem to have anything odd in it.

Do you have perhaps some idea what could be the problem?
I solved it in another way- so it won't show the red line, but I am still curious as to the reason behind this. I found another post like this and it wasn't solved either. I also wasn't able to find this LazyActivitiWorkflowTask class. It is strange. I also replaced the regular end events with TerminatedEndEvent, but it made no difference.
Thanks Smiley Happy

bjx123
Champ in-the-making
Champ in-the-making
And how did you solf your probleme I have the same probleme with the subprocesses?

Hi,
I replied to your message, but here it goes again:
I removed the subprocesses and also changed the code where I was assigning variables to null from the custom content model. This triggered the error in the places where I am in a loop.
Hope this helps Smiley Happy

hoecake
Champ in-the-making
Champ in-the-making
We have same problem , our process has bit complex defination with 3 level subprocess, looking forward to a way to resolve this error.

tas100
Champ in-the-making
Champ in-the-making

Same issue here, after a bit of investigation we have worked out the following:

It throws the NPE when a workflow has a user task defined in a subprocess.

The NPE is being thrown because taskDefinition is null in LazyActivitiWorkflowTask.

          // Fetch task-definition and a partially-initialized WorkflowTask (not including properties and path)
          WorkflowTaskDefinition taskDefinition = activitiTypeConverter.getTaskDefinition(historicTask.getTaskDefinitionKey(), historicTask.getProcessDefinitionId());
          
          String workflowDefinitionName = activitiTypeConverter.getWorkflowDefinitionName(historicTask.getProcessDefinitionId());
          workflowDefinitionName = tenantService.getBaseName(workflowDefinitionName);
          
          WorkflowTask partiallyInitialized = typeConverter.getWorkflowObjectFactory().createTask(historicTask.getId(), taskDefinition, taskDefinition.getId(), historicTask.getName(),
                    historicTask.getDescription(), WorkflowTaskState.COMPLETED, null, workflowDefinitionName , lazyPropertiesMap);

ActivitiTypeConverter.getTaskDefinition should populate taskDefinition:

    /**
     * Get the taskDefinition key based on the Activiti task definition id,
     * @param taskDefinitionKey String
     * @param processDefinitionId String
     * @return WorkflowTaskDefinition
     */

    public WorkflowTaskDefinition getTaskDefinition(String taskDefinitionKey, String processDefinitionId)
    {
          ProcessDefinitionEntity procDef = (ProcessDefinitionEntity) activitiUtil.getDeployedProcessDefinition(processDefinitionId);
          Collection<PvmActivity> userTasks = findUserTasks(procDef.getInitial());
         
          TaskDefinition taskDefinition = null;
          for(PvmActivity activity : userTasks)
          {
               taskDefinition = procDef.getTaskDefinitions().get(activity.getId());
               if(taskDefinitionKey.equals(taskDefinition.getKey()))
               {
                    String formKey = getFormKey(taskDefinition);
                    WorkflowNode node = convert(activity);
                    return factory.createTaskDefinition(formKey, node, formKey, false);
               }
          }
         
          return null;
    }

However this does not happen because ActivitiTypeConverter.findUserTasks does not find user tasks that have been defined under a subprocess:

    private void findUserTasks(PvmActivity currentActivity, Map<String, PvmActivity> userTasks, Set<String> processedActivities)
    {
        // Only process activity if not already processed, to prevent endless loops
        if(!processedActivities.contains(currentActivity.getId()))
        {
            processedActivities.add(currentActivity.getId());
            if(isUserTask(currentActivity))
            {
                userTasks.put(currentActivity.getId(), currentActivity);
            }
           
            // Process outgoing transitions
            if(currentActivity.getOutgoingTransitions() != null)
            {
                for(PvmTransition transition : currentActivity.getOutgoingTransitions())
                {
                    if(transition.getDestination() != null)
                    {
                        findUserTasks(transition.getDestination(), userTasks, processedActivities);
                    }
                }
            }
        }
    }

Looks like there is a bug in the above method as it is not looking for nested tasks.