cancel
Showing results for 
Search instead for 
Did you mean: 

Using CallActiviti to another Workflow is bypassing Start Event

root
Champ in-the-making
Champ in-the-making
Hi All.
I am having an issue using callActiviti. The below steps will try to shade some light on the process I am following:

1) Create a basic workflow ( workflowOne)
2) Create a second basic workflow. (workflowTwo)
3) Testing them individually everything is great.
4) Now, using call activiti:

<callActivity id="CallActiviti" name="Call activity - from Workflow 1" calledElement="workflowTwo" />

5) Everything works great, with the exception that if you go in the Workflow2 Details, there are two tasks being displayed in the Current Tasks table:
    a) start1234 (this being the start event of workflowTwo)
    b) 12345  (this being the task in the workflowTwo after the start event)

6) Why is the "Start Event" of the Child workflow executed when the following code is set?
 
<process id="workflowTwo" name="Draft Staff Action" isExecutable="false">

7) In addition continuing with the child workflow upon "Task Done" you get an error, see below:

"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)"


Image one is WorkflowTwo
Image two is WorkflowOne
// these are the actual workflows, the description above states basic workkflows, the same issue still is present)

http://imageshack.us/g/593/oa9i.png/

Sincerely,
/Ed
5 REPLIES 5

jbarrez
Star Contributor
Star Contributor
Smells like a bug. Could you create an executable unit test that demonstrates this?

randallgaz
Champ in-the-making
Champ in-the-making
I have also run into the Query return issue. ("exception": "org.springframework.extensions.webscripts.WebScriptException - 07260017 Wrapped Exception (with status template): Query return 3 results instead of max 1)

The get start task in the alfresco wrapper around the activi call is a get single result. It should be a set.  Any child workflow or parallel join with a looping flow will result in more than one result.    I believe it is a task history accumulator operation, but have not traced it enough to fully tell.

I do have a test case, but it was 4.0.2.  I need to verify that it still exercises the case, and will submit a bug.

Randall

randallgaz
Champ in-the-making
Champ in-the-making
/Ed followed up in this message with the exact location where the issue is:

http://forums.alfresco.com/forum/developer-discussions/workflow/view-details-page-broken-alfresco-us...

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

- Randall

trademak
Star Contributor
Star Contributor
Hi,

The problem is that in Alfresco workflow it always looks for a start event definition and a corresponding form config. I'll have a look with one of my colleagues how this could be implemented.

Best regards,

root
Champ in-the-making
Champ in-the-making
Hi All,

Alfresco support is working in a fix for Alfresco version 4.1.6 and 4.2 Enterprise. I don't know if they will apply that same patch to the community edition, but I assume they may.

Thanks for the info.

/Ed