AnsweredAssumed Answered

View details page broken on alfresco Using CallActiviti to call another workflow

Question asked by root on Aug 28, 2013
Latest reply on Sep 13, 2013 by root
Hi All,

Having an issue when I try to make use of callActiviti.


<callActivity id="sjsActionCallActiviti" name="Call activity - Sjs Action" calledElement="sjsWorkflow">
      <extensionElements>
        <activiti:in sourceExpression="${edtrmwf_requiredGroupAssignee}" target="edtrmwf_requiredGroupAssignee"></activiti:in>
        <activiti:in sourceExpression="${bpm_package}" target="bpm_package"></activiti:in>
        <activiti:in sourceExpression="${bpm_workflowDescription}" target="bpm_workflowDescription"></activiti:in>
        <activiti:out sourceExpression="${bpm_package}" target="bpm_package"></activiti:out>
      </extensionElements>
    </callActivity>


If you run the workflows as standalone workflows they work just fine.The issue at hand is presented when you actually try to invoke another workflow using callActiviti

Using callACtiviti workflow 1 calls workflow 2. At this point when workflow 2 is executed two tasks are created: the Start Task/Event as well as the following task after the start event task. If you attempt to view the Workflow 2 Details page, under the "Current Tasks" table, there are 2 active tasks:

the startTask (start1234) and (following1235) task which is the task coming after the start event/task.

At this point you can still view the details of the Workflow 2. Completing the next Task (1235) and attempting to view the Workflow details page, an error is thrown: "Failure"

Below is the log information following the error:


message": "07260017 Wrapped Exception (with status template): Query return 3 results instead of max 1",
"exception": "org.springframework.extensions.webscripts.WebScriptException - 07260017 Wrapped Exception (with status template): Query return 3 results instead of max 1",
"callstack": [

    "",
    "org.activiti.engine.ActivitiException: Query return 3 results instead of max 1",
    "org.activiti.engine.impl.AbstractQuery.executeSingleResult(AbstractQuery.java:161)",
    "org.activiti.engine.impl.AbstractQuery.execute(AbstractQuery.java:140)",
    "org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)",
    "org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)",
    "org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)",
    "org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)",
    "org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)",
    "org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)",
    "org.activiti.engine.impl.AbstractQuery.singleResult(AbstractQuery.java:103)",
    "org.alfresco.repo.workflow.activiti.properties.ActivitiPropertyConverter.getStartVariables(ActivitiPropertyConverter.java:500)",
    "org.alfresco.repo.workflow.activiti.properties.ActivitiPropertyConverter.getStartTaskProperties(ActivitiPropertyConverter.java:439)",
    "org.alfresco.repo.workflow.activiti.ActivitiTypeConverter.getVirtualStartTask(ActivitiTypeConverter.java:429)",
    "org.alfresco.repo.workflow.activiti.ActivitiTypeConverter.getVirtualStartTask(ActivitiTypeConverter.java:382)",
    "org.alfresco.repo.workflow.activiti.ActivitiWorkflowEngine.getStartTask(ActivitiWorkflowEngine.java:2158)",
    "org.alfresco.repo.workflow.WorkflowServiceImpl.getStartTask(WorkflowServiceImpl.java:691)",
    "sun.reflect.GeneratedMethodAccessor1413.invoke(Unknown Source)",
    "sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)",
    "java.lang.reflect.Method.invoke(Method.java:597)",
    "org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)",
    "org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)",
    "org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)",
    "org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:34)",
    "org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)",
    "org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:46)",
    "org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)",
    "org.alfresco.repo.audit.AuditMethodInterceptor.proceedWithAudit(AuditMethodInterceptor.java:245)",
    "org.alfresco.repo.audit.AuditMethodInterceptor.proceed(AuditMethodInterceptor.java:211)",
    "org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:164)",
    "org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)",
    "org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)",
    "org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)",
    "org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)",
    "com.sun.proxy.$Proxy365.getStartTask(Unknown Source)",
    "org.alfresco.repo.web.scripts.workflow.WorkflowModelBuilder.buildDetailed(WorkflowModelBuilder.java:305)",
    "org.alfresco.repo.web.scripts.workflow.WorkflowInstanceGet.buildModel(WorkflowInstanceGet.java:60)",
    "org.alfresco.repo.web.scripts.workflow.AbstractWorkflowWebscript.executeImpl(AbstractWorkflowWebscript.java:80)",
    "org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:64)",
    "org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryContainer.java:410)",
    "org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:388)",
    "org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:479)",
    "org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:517)",
    "org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:333)",
    "org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:377)",
    "org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)",
    "org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)",
    "javax.servlet.http.HttpServlet.service(HttpServlet.java:717)",
    "org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)",
    "org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)",
    "org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:61)",
    "org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)",
    "org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)",
    "org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)",
    "org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)",
    "org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)",
    "org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)",
    "org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)",
    "org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:183)",
    "org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)",
    "org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:95)",
    "org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)",
    "org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)",
    "org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)",
    "org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)",
    "org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)",
    "org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)",
    "org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)",
    "org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)",
    "org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:599)",
    "org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:451)",
    "java.lang.Thread.run(Thread.java:662)",
    "org.springframework.extensions.webscripts.WebScriptException: 07260017 Wrapped Exception (with status template): Query return 3 results instead of max 1",
    "org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:1050)"



The above error is only thrown when you attempt to view the Workflow 2 Details Page. You can view the (workflow 1) details page at anytime with no issues.

EDIT:

After further debuging I was able to pinpoint the code where the issue is taking place. I may be wrong but the error occurs at this piece of code.


package org.alfresco.repo.workflow.activiti.properties;

ActivitiPropertyConverter.java


    /**
     * @param historicProcessInstance
     * @return
     */
    public Map<String, Object> getStartVariables(HistoricProcessInstance historicProcessInstance)
    {
        // Get historic variable values for start-event
        HistoricActivityInstance startEvent = activitiUtil.getHistoryService()
            .createHistoricActivityInstanceQuery()
            .processInstanceId(historicProcessInstance.getId())
            .activityId(historicProcessInstance.getStartActivityId())
            .singleResult();
       
        Map<String, Object> variables = getHistoricActivityVariables(startEvent.getId());
        return variables;
    }



Sincerely,
/Ed

Attachments

Outcomes