Bpm Process Testing (IOException parsing XML document from class path resource [activiti.cfg.xml])

Hello People,

I wanted to test the Process.bpmn under Junit for which i had refer Testing | docs.camunda.org
Here is the bpmn which i wanted to test
At the starts it is an embedded task which accepts a business
key and a File.


here is the code which i am using

everything works fine the Camunda server start’s up and it encounters an exception and it shutsdown.
and here is the exception which i am getting

Can Anyone would suggest whats going wrong here

@Shoeb I think you need to add camunda.cfg.xml file in /src/test/resources folder.

The ProcessEngine and the services will be made available to the test class through the getters of the processEngineRule. The processEngine will be initialized by default with the camunda.cfg.xml resource on the classpath.

ProcessEngineRule will look for the default configuration file on the classpath. Process engines are statically cached over multiple unit tests when using the same configuration resource.

Thank you so much for your reply :hugs:

but It is giving some exception again.

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘processEngineConfiguration’ defined in class path resource [camunda.cfg.xml]: Cannot create inner bean ‘org.camunda.connect.plugin.impl.ConnectProcessEnginePlugin#3fa57aa8’ of type [org.camunda.connect.plugin.impl.ConnectProcessEnginePlugin] while setting bean property ‘processEnginePlugins’ with key [0]; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.camunda.connect.plugin.impl.ConnectProcessEnginePlugin] for bean with name ‘org.camunda.connect.plugin.impl.ConnectProcessEnginePlugin#3fa57aa8’ defined in class path resource [camunda.cfg.xml]; nested exception is java.lang.ClassNotFoundException: org.camunda.connect.plugin.impl.ConnectProcessEnginePlugin

@Shoeb, Are you using ConnectProcessEnginePlugin? or added this dependency in classpath? If you’re using you need to register those plugins part of the process engine configuration, otherwise you can remove from classpath.

Nope I am not using any of such plugins :worried: :worried:

can you provide your pom.xml?

Hi @Shoeb,

did your SpringBootTest start the process engine from the camunda-bpm-spring-boot-starter?

If yes, you should inject the process engine into your test instead of creating a new one with a rule.

Running the SpringBootTest is more an integration test than a unit test.

Hope this helps, Ingo

pom.xml (4.2 KB)

+1

this example not work: camunda-bpm-examples/servicetask/rest-service at master · camunda/camunda-bpm-examples · GitHub

I got error

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngineConfiguration' defined in class path resource [camunda.cfg.xml]: Cannot create inner bean 'org.camunda.connect.plugin.impl.ConnectProcessEnginePlugin#11bd0f3b' of type [org.camunda.connect.plugin.impl.ConnectProcessEnginePlugin] while setting bean property 'processEnginePlugins' with key [0]; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.camunda.connect.plugin.impl.ConnectProcessEnginePlugin] for bean with name 'org.camunda.connect.plugin.impl.ConnectProcessEnginePlugin#11bd0f3b' defined in class path resource [camunda.cfg.xml]; nested exception is java.lang.ClassNotFoundException: org.camunda.connect.plugin.impl.ConnectProcessEnginePlugin

my pom.xml

<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>org.camunda.bpm.quickstart</groupId>
  <artifactId>camunda-quickstart-rest-service</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>
  <name>Service Invocation - REST</name>

  <properties>
    <version.camunda>7.15.0</version.camunda>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>


  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.camunda.bpm</groupId>
        <artifactId>camunda-bom</artifactId>
        <scope>import</scope>
        <type>pom</type>
        <version>${version.camunda}</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>org.camunda.bpm</groupId>
      <artifactId>camunda-engine</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.camunda.bpm</groupId>
      <artifactId>camunda-engine-plugin-connect</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.camunda.connect</groupId>
      <artifactId>camunda-connect-http-client</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.camunda.bpm</groupId>
      <artifactId>camunda-engine-plugin-spin</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.camunda.spin</groupId>
      <artifactId>camunda-spin-dataformat-json-jackson</artifactId>
      <scope>provided</scope>
    </dependency>

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

    <dependency>
      <groupId>com.h2database</groupId>
      <artifactId>h2</artifactId>
      <version>1.4.190</version>
      <scope>test</scope>
    </dependency>

    <!-- redirect slf4j logging to jdk logging -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-jdk14</artifactId>
      <version>1.7.26</version>
    </dependency>

  </dependencies>

  <repositories>
    <repository>
      <id>camunda-bpm-nexus</id>
      <name>camunda-bpm-nexus</name>
      <url>https://app.camunda.com/nexus/content/groups/public</url>
    </repository>
  </repositories>

</project>

I found the reason

7.14.0 ok

7.15.0 failed

please fix it

@Ingo_Richtsmeier

Hello @jk2K,

Could you please create a new post for your use case, as it seems to not be relevant to the initial issue in original post.
I tried the example with 7.15.0 and it works for me, so please provide what steps did you perform, an example of your project uploaded to github will be helpful to understand better the issue.

Best regards,
Yana