The process could not be started. : Cannot instantiate process definition

Hi Team,

Iam getting below error when i try to start process.

The process could not be started. : Cannot instantiate process definition SimpleDemo:3:c5e1aaa8-21fb-11ea-b5c4-9cb6d0c2b847: Unknown property used in expression: #{cflag}. Cause: Cannot resolve identifier ‘cflag’

My java class is below process.bpmn (4.7 KB)

package com.camunda.demo.SimpleDemo;

import java.util.Random;

import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;

public class CheckWeatherDelegate implements JavaDelegate {

@Override
public void execute(DelegateExecution execution) throws Exception {
	
	Random random=new Random();
	
	
	execution.setVariable("cflag", random.nextBoolean());
	// TODO Auto-generated method stub

}

}

Can you please help me on this issue .

Regards
Ravi Babu.

Hi @RaviBabu,

The class attribute of the service task “check Weather” in your model is set to
org.camunda.bpm.engine.delegate.DelegateExecution

Where it should be set to
com.camunda.demo.SimpleDemo.CheckWeatherDelegate

1 Like

Hi ,

Thank you for looking into my error . I changed class attribute as com.camunda.demo.SimpleDemo.CheckWeatherDelegate** but still getting same error .process.bpmn (4.7 KB)

Hi @RaviBabu,

Try to set camunda:asyncAfter=“true” on Service Task

By default process state is only stored to the database when token reaches a wait state.
“A wait state is a task which is performed later , which means that the engine persists the current execution to the database and waits to be triggered again”.

https://docs.camunda.org/manual/latest/user-guide/process-engine/transactions-in-processes/#wait-states

And since service task is not a wait state then asynchronous Continuations can be used to add transaction boundaries.

https://docs.camunda.org/manual/latest/user-guide/process-engine/transactions-in-processes/#transaction-boundaries

I tried camunda:asyncAfter=“true” but still same issue.

process.bpmn (4.7 KB) .

Iam still facing the problem , Can any one please help me on this issue ?

@RaviBabu from your model service task element “Check Weather” is not connected to the exclusive gateway.

image

Try this bpmn file which i corrected it: process.bpmn (5.9 KB)

1 Like

@aravindhrs

Thank you so much , it worked this time .

Hi Aravind,
I agree with the solution. But what should we do to connect to gateway. I mean what is the difference between two diagrams?
What do you mean by exclusive gateway?

@Naveen_Prasad, Gateways are used to control how the process flows.

image

  • An exclusive gateway evaluates the state of the business process and, based on the condition, breaks the flow into one of the two or more mutually exclusive paths.

  • Exclusive gateway is a diversion point of a business process flow.

  • A diverging Exclusive Gateway (Decision) is used to create alternative paths within a Process flow.

  • For a given instance of the process, there is only one of the paths can be taken.

  • In case multiple sequence flow have a condition that evaluates to ‘true’, the first one defined in the XML is exclusively selected for continuing the process.

  • A Decision can be thought of as a question that is asked at a particular point in the Process.

  • The question has a defined set of alternative answers.

  • Each answer is associated with a condition Expression that is associated with a Gateway’s outgoing Sequence Flows.

  • When dividing the flow, it directs the flow exactly to one of the output branches. Although it is common practice to converge, it is optional for the Exclusive gateway and according to Bruce Silver’s modeling style guide, should be avoided.

The suggested modeling of gateways is state the checking (question) in the gateway (diamond shape) and state the condition in the sequence flow. When the business process is executed (either by manual process or with automatic process), the condition will evaluate one by one and once the first condition is fulfilled, we still trigger the connected activity and stop evaluate other condition.

In the example below, an exclusive gateway requires that the mode of transportation be evaluated. In this case, one light will be placed in the Old North Church if the British attack by land, two if by sea.

image


Service Task is not connected with the gateway, instead gateway was directly connected from start event.

Solution:

  • Removed one of the outgoing sequence flow from start event to gateway.

  • Added sequence flow between service task and exclusive gateway.

Thanks Aravind.