Different behavior after startup in background mode

Dear Community,

I’ve developed a Camunda Spring Boot Application and run it on a Windows Server 2019.
If I run the application when I am logged on, Camunda remembers all my existing groups, workflows etc., but if Camunda starts up in Background, triggered by the Windows Task Scheduler I see a different behavior.
Camunda is showing then the default example groups and tasks. See picture below

My CORS setting is also gone. Nothing was written in my logfile. If I execute Camunda again with logged on user, everything is working again as expected. No groups, workflows are lost.

Below my POM file and application.yml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.myCompany</groupId>
  <artifactId>order-process</artifactId>
  <version>1.0-SNAPSHOT</version>

  <name>Camunda Spring Boot Application</name>
  <description>Spring Boot Application using [Camunda](http://docs.camunda.org).</description>

  <properties>
    <camunda.version>7.18.0-alpha5</camunda.version>
    <springBoot.version>2.6.4</springBoot.version>

    <maven.compiler.source>11</maven.compiler.source>
    <maven.compiler.target>11</maven.compiler.target>
    <version.java>11</version.java>

    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <failOnMissingWebXml>false</failOnMissingWebXml>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.camunda.bpm</groupId>
        <artifactId>camunda-bom</artifactId>
        <version>${camunda.version}</version>
        <scope>import</scope>
        <type>pom</type>
      </dependency>
      <dependency>
        <groupId>org.camunda.bpm.dmn</groupId>
        <artifactId>camunda-engine-dmn-bom</artifactId>
        <version>${camunda.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>${springBoot.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>org.camunda.bpm.springboot</groupId>
      <artifactId>camunda-bpm-spring-boot-starter-rest</artifactId>
    </dependency>
    <dependency>
      <groupId>org.camunda.bpm.springboot</groupId>
      <artifactId>camunda-bpm-spring-boot-starter-webapp</artifactId>
    </dependency>
    <dependency>
      <groupId>com.h2database</groupId>
      <artifactId>h2</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-jdbc</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jul-to-slf4j</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>javax.xml.bind</groupId>
      <artifactId>jaxb-api</artifactId>
    </dependency>
    <!-- Use GraalVM JavaScript for JDK > 14 -->
    <dependency>
      <groupId>org.graalvm.js</groupId>
      <artifactId>js</artifactId>
      <version>21.1.0</version>
    </dependency>
    <dependency>
      <groupId>org.graalvm.js</groupId>
      <artifactId>js-scriptengine</artifactId>
      <version>21.1.0</version>
    </dependency>

    <!-- Add your own dependencies here, if in compile scope, they are added to the jar -->
    <dependency>
      <groupId>org.camunda.bpm</groupId>
      <artifactId>camunda-engine-plugin-connect</artifactId>
	</dependency>
	<dependency>
       <groupId>org.camunda.connect</groupId>
       <artifactId>camunda-connect-http-client</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.camunda.bpm.extension</groupId>
      <artifactId>camunda-bpm-junit5</artifactId>
      <version>1.0.2</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.camunda.bpm.assert</groupId>
      <artifactId>camunda-bpm-assert</artifactId>
      <version>12.0.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.camunda.bpm.extension</groupId>
      <artifactId>camunda-bpm-process-test-coverage-junit5</artifactId>
      <version>1.0.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-engine</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.camunda.bpm.extension</groupId>
      <artifactId>camunda-bpm-mail-core</artifactId>
      <version>1.0.0</version>
    </dependency>
  </dependencies>

  <repositories>
    <repository>
      <id>camunda-bpm-nexus</id>
      <name>Camunda Maven Repository</name>
      <url>https://artifacts.camunda.com/artifactory/public/</url>
    </repository>
  </repositories>

  <build>
    <finalName>${project.artifactId}</finalName>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <version>${springBoot.version}</version>
        <configuration>
          <layout>ZIP</layout>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>repackage</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.6.0</version>
        <configuration>
          <mainClass>com.myCompany.CamundaApplication</mainClass>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.22.2</version>
      </plugin>
    </plugins>
  </build>

</project>

My application.yml

  url: jdbc:h2:C:\Users\Public\Camunda\camunda-db;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
  username: xyz
  password: xyz
spring.h2.console.enabled: true
logging:
  level.root: INFO
  file.name: C:\Users\Public\Camunda\camunda-info-log.log
camunda.bpm:
  admin-user:
    id: xxx
    password: xxx
    firstName: x
    lastName: y
  filter:
    create: All Tasks
  job-execution:
    max-wait: 10000
server.port: 8080

Does somebody have any idea what is going wrong.

Thank you very much for any help.

BR

Michael

This sounds like one of the “features” of Windows Task Scheduler.
It doesn’t run under the user id of the user that scheduled it, nor uses the directories of the user that scheduled it.

So… implict directories (eg. %USERHOME% ) point to different directories, which means that you get different configuration files.

Hello and sorry for my late reply.

Thanks for your reply!
After changing the directory to an user unrelated folder I’ve got the same result but I was able now to retrieve an log file.
My Task Scheduler is triggered at system startup. At this time the port 8080 was in use for some minutes by another script. After changing the server port of Camunda everything works as expected.

The topic is solved.