Variables not getting resolved in process

I am accurately following your video tutorials, in one tutorial Java class sets variable - the variables is not resolved in process and there is “cannot resolve variable” error on console.

Hi @Ismail,

Can you please tells in details about the error and how exactly you are setting the variables.

Error in Taslist: The process could not be started. : Cannot instantiate process definition CamundaArchetype:4:37feb77b-5d78-11ea-aac7-9cebe871449a: Unknown property used in expression: #{ weatherOk }. Cause: Cannot resolve identifier ‘weatherOk’

Code:
public class CheckWeatherDelegate implements JavaDelegate {

@Override
public void execute(DelegateExecution execution) throws Exception {

    Random rando = new Random();
    execution.setVariable("name","Ismail");
    //execution.setVariable("weatherOk",rando.nextBoolean());
    execution.setVariable("weatherOk",false);

}

}

here everything looks fine. Can you just try to remove the space in expression, i mean used expression like #{weatherOk}

initially it was without space, same error - so nI tried with space --> same result.

I did this project with CamundaArchetype maven plugin - does this have to do with a dependency issue - below is the bpom.xml:

<?xml version="1.0" encoding="UTF-8"?> 4.0.0

org.example
CamundaArchetype
1.0-SNAPSHOT

war

Camunda BPM Process Application
A Process Application for Camunda BPM. [The project has been generated by the Maven archetype ‘camunda-archetype-servlet-war-7.9.2’]

7.9.0 1.8 1.8 UTF-8 false org.camunda.bpm camunda-bom ${camunda.version} import pom org.camunda.bpm.dmn camunda-engine-dmn-bom ${camunda.version} pom import org.camunda.bpm camunda-engine provided org.camunda.bpm.dmn camunda-engine-dmn provided
<dependency>
  <!-- AssertJ Testing Library -->
  <groupId>org.camunda.bpm.extension</groupId>
  <artifactId>camunda-bpm-assert</artifactId>
  <version>1.2</version>
  <scope>test</scope>
</dependency>

<!-- Required to use Spin dataformat support in unit tests -->
<dependency>
  <groupId>org.camunda.spin</groupId>
  <artifactId>camunda-spin-dataformat-all</artifactId>
  <scope> test</scope>
</dependency>
<dependency>
  <groupId>org.camunda.bpm</groupId>
  <artifactId>camunda-engine-plugin-spin</artifactId>
  <scope>test</scope>
</dependency>

<!-- Required to use Templates in unit tests -->
<dependency>
  <groupId>org.camunda.template-engines</groupId>
  <artifactId>camunda-template-engines-freemarker</artifactId>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>org.camunda.template-engines</groupId>
  <artifactId>camunda-template-engines-velocity</artifactId>
  <scope>test</scope>
</dependency>

<dependency>
  <groupId>javax.servlet</groupId>
  <artifactId>javax.servlet-api</artifactId>
  <version>3.1.0</version>
  <scope>provided</scope>
</dependency>

<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>4.12</version>
  <scope>test</scope>
</dependency>

<dependency>
  <!-- Needed for InMemoryH2Test -->
  <groupId>com.h2database</groupId>
  <artifactId>h2</artifactId>
  <version>1.4.197</version>
  <scope>test</scope>
</dependency>

<dependency>
  <!-- Used to generate test coverage reports, see https://github.com/camunda/camunda-consulting/tree/master/snippets/camunda-bpm-process-test-coverage -->
  <groupId>org.camunda.bpm.extension</groupId>
  <artifactId>camunda-bpm-process-test-coverage</artifactId>
  <version>0.3.2</version>
  <scope>test</scope>
</dependency>

<dependency>
  <!-- use logback as logger -->
  <groupId>ch.qos.logback</groupId>
  <artifactId>logback-classic</artifactId>
  <version>1.1.3</version>
  <scope>test</scope>
</dependency>

<dependency>
  <groupId>org.slf4j</groupId>
  <!-- apache commons logging => slf4j -->
  <artifactId>jcl-over-slf4j</artifactId>
  <version>1.7.25</version>
  <scope>test</scope>
</dependency>

<dependency>
  <!--  java util logging => slf4j -->
  <groupId>org.slf4j</groupId>
  <artifactId>jul-to-slf4j</artifactId>
  <version>1.7.25</version>
  <scope>test</scope>
</dependency>

<!-- Add your own dependencies here, if in compile scope, they are added to the war -->
camunda-bpm-nexus Camunda Maven Repository https://app.camunda.com/nexus/content/groups/public ${project.artifactId} org.apache.maven.plugins maven-antrun-plugin <!-- Tomcat Maven Plugin
  Deploy to Tomcat using:
  mvn clean tomcat7:deploy

  Redeploy:
  mvn clean tomcat7:redeploy

  Undeploy:
  mvn tomcat7:undeploy

       To use this plugin, add these lines to your tomcat-users.xml: (inside the <tomcat-users>-tag)
       <role rolename="manager-script"/>
       <user username="admin" password="admin" roles="manager-script"/>

   -->
  <plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.2</version>
    <configuration>
      <url>http://localhost:8080/manager/text</url>
      <username>admin</username>
      <password>admin</password>
    </configuration>
  </plugin>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version> 2.22.2</version>
  </plugin>
</plugins>

Hi @Ismail,

afaik, expressions are used with a dollar sign, i.e. ${weatherOk}.
Does that work for you?

Can you upload your model?

${weatherOk} → gave the same error

process.bpmn (5.3 KB)

uploaded, see below above

Your problem is that you have a sequence flow running from your start event to the gateway. you’ll see it if you move the sequence flow:
image

I’ve fixed it in the below model

process.bpmn (5.2 KB)