Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Activiti : no processes deployed with key

Tags:

java

activiti

I get an exception no processes deployed with key 'Process_MohitWorkflow' while executing:

ProcessInstance instance =
runtimeService.startProcessInstanceByKey(workflowName, businessKey, variables);

I do have an entry in my act_re_procdef table for this workflow

"Process_MohitWorkflow:1:14";1;"http://www.activiti.org/processdef";"Mohit Trust";"Process_MohitWorkflow";1;"11";"MyBPMN.bpmn20.xml";"MyBPMN.Process_MohitWorkflow.png";"";FALSE;TRUE;1;"603"

<code>enter image description here</code>

I deployed my MyBPMN.bpmn20.xml file using the following code:

      public void deployProcessFile(String name, InputStream io, long tenantId) {
        RepositoryService repositoryService = processEngine.getRepositoryService();
        repositoryService.createDeployment()
                .addInputStream(name, io)
                .name(name.substring(0, name.indexOf(".")))
                .enableDuplicateFiltering()
                .tenantId(String.valueOf(tenantId))
                .deploy();
      }

StackTrace:

Caused by: org.activiti.engine.ActivitiObjectNotFoundException: no processes deployed with key 'Process_MohitWorkflow'
    at org.activiti.engine.impl.persistence.deploy.DeploymentManager.findDeployedLatestProcessDefinitionByKey(DeploymentManager.java:125)
    at org.activiti.engine.impl.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:79)
    at org.activiti.engine.impl.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:37)
    at org.activiti.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:24)
    at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:57)
    at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)
    at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40)
    at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35)
    at org.activiti.engine.impl.RuntimeServiceImpl.startProcessInstanceByKey(RuntimeServiceImpl.java:81)
    at com.vernuso.trust.server.service.ProcessService.startWorkFlowInstanceForEntity(ProcessService.java:265)
    at com.vernuso.trust.server.service.ProcessService.startOnboardingForOrganisation(ProcessService.java:221)
    at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:70)
    at com.vernuso.trust.server.governance.client.OnboardOrganisationActionHandler.executeTransaction(OnboardOrganisationActionHandler.java:44)
    at com.vernuso.trust.server.governance.client.OnboardOrganisationActionHandler.executeTransaction(OnboardOrganisationActionHandler.java:25)
    at com.vernuso.trust.server.SecuredActionHandler.execute(SecuredActionHandler.java:31)
    at com.gwtplatform.dispatch.rpc.server.AbstractDispatchImpl.doExecute(AbstractDispatchImpl.java:154)
    ... 48 more

Any thoughts on what I might be missing?

Regards.

like image 764
EMM Avatar asked May 31 '16 06:05

EMM


1 Answers

I managed to solve this issue by using:

ProcessInstance instance = runtimeService.startProcessInstanceByKey(
  workflowName, businessKey, variables, tenantId);

Instead of:

ProcessInstance instance = runtimeService.startProcessInstanceByKey(
  workflowName, businessKey, variables);

Initially, I was relying only on:

processEngine.getRepositoryService().createProcessDefinitionQuery() .processDefinitionTenantId(tenantId) .singleResult()

to filter out the processes based on tenantId but I guess it was not sufficient.

Not sure how this works(why we must provide extra param i.e. tenantId to startProcessInstance) or what I should have done to see this before posting here.

like image 181
EMM Avatar answered Oct 30 '22 18:10

EMM