FlowableException: Could not find org.flowable.http.HttpActivityBehavior:

#1

I have this xml flowable file:

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:flowable="http://flowable.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.flowable.org/processdef">
  <process id="Google" name="Google" isExecutable="true">
    <startEvent id="startEvent1"></startEvent>
    <serviceTask id="sid-37CAB1BE-4153-446F-8FF4-01C44D0A5AA2" flowable:type="http">
      <extensionElements>
        <flowable:field name="requestMethod">
          <flowable:string><![CDATA[GET]]></flowable:string>
        </flowable:field>
        <flowable:field name="requestUrl">
          <flowable:string><![CDATA[https://www.google.com/]]></flowable:string>
        </flowable:field>
		<flowable:field name="httpActivityBehaviorClass">
        <flowable:string>
          <![CDATA[org.example.flowable.HttpActivityBehaviorImpl]]>
        </flowable:string>
    </flowable:field>
      </extensionElements>
    </serviceTask>
    <sequenceFlow id="sid-A8C97364-F4C6-4D77-AADB-9B2358E6C5B5" sourceRef="startEvent1" targetRef="sid-37CAB1BE-4153-446F-8FF4-01C44D0A5AA2"></sequenceFlow>
    <endEvent id="sid-772D660C-9FD8-4AA0-9E5E-0031E7CD0771"></endEvent>
    <sequenceFlow id="sid-D9D5C12A-53A0-47B8-BCEE-D8CD4CCEE876" sourceRef="sid-37CAB1BE-4153-446F-8FF4-01C44D0A5AA2" targetRef="sid-772D660C-9FD8-4AA0-9E5E-0031E7CD0771"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_Google">
    <bpmndi:BPMNPlane bpmnElement="Google" id="BPMNPlane_Google">
      <bpmndi:BPMNShape bpmnElement="startEvent1" id="BPMNShape_startEvent1">
        <omgdc:Bounds height="30.0" width="30.0" x="90.0" y="160.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-37CAB1BE-4153-446F-8FF4-01C44D0A5AA2" id="BPMNShape_sid-37CAB1BE-4153-446F-8FF4-01C44D0A5AA2">
        <omgdc:Bounds height="80.0" width="100.0" x="285.0" y="120.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-772D660C-9FD8-4AA0-9E5E-0031E7CD0771" id="BPMNShape_sid-772D660C-9FD8-4AA0-9E5E-0031E7CD0771">
        <omgdc:Bounds height="28.0" width="28.0" x="430.0" y="146.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="sid-A8C97364-F4C6-4D77-AADB-9B2358E6C5B5" id="BPMNEdge_sid-A8C97364-F4C6-4D77-AADB-9B2358E6C5B5">
        <omgdi:waypoint x="119.91884588950421" y="174.0237777155311"></omgdi:waypoint>
        <omgdi:waypoint x="284.9999999999998" y="163.25760869565218"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-D9D5C12A-53A0-47B8-BCEE-D8CD4CCEE876" id="BPMNEdge_sid-D9D5C12A-53A0-47B8-BCEE-D8CD4CCEE876">
        <omgdi:waypoint x="384.949999999996" y="160.0"></omgdi:waypoint>
        <omgdi:waypoint x="430.0" y="160.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

I’m trying to perform a simple GET request to google.com
In my main class I have this:

             ProcessEngineConfiguration cfg = new StandaloneProcessEngineConfiguration()
				.setJdbcUrl("jdbc:h2:mem:flowable;DB_CLOSE_DELAY=-1")
				.setJdbcUsername("sa")
				.setJdbcPassword("")
				.setJdbcDriver("org.h2.Driver")
			.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);

	ProcessEngine processEngine = cfg.buildProcessEngine();

	RepositoryService repositoryService = processEngine.getRepositoryService(); // per fare il deploy di un process
	Deployment deployment = repositoryService.createDeployment()
			.addClasspathResource("Google.bpmn20.xml")
			.deploy();

	ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
			.deploymentId(deployment.getId())
			.singleResult();
	
	System.out.println("Description " + processDefinition.getName());

But when I run it the following error is thrown:

`FlowableException: Could not find org.flowable.http.HttpActivityBehavior
[...] 

Caused by: java.lang.ClassNotFoundException: org.example.flowable.HttpActivityBehaviorImpl`

I’ve found an answer that says to extend class HttpActivityBehavior and extend perform() method, but the IDE cannot find the correct import for this class.
In my pom.xml I have this:

 <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.flowable</groupId>
  <artifactId>firsttest</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  
  <dependencies>
  <dependency>
    <groupId>org.flowable</groupId>
    <artifactId>flowable-engine</artifactId>
    <version>6.4.1</version>
  </dependency>
  <dependency>
    <groupId>org.flowable</groupId>
    <artifactId>flowable-http</artifactId>
    <version>6.4.1</version>
</dependency>
  <dependency>
    <groupId>com.h2database</groupId>
    <artifactId>h2</artifactId>
    <version>1.3.176</version>
  </dependency>
  <dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>slf4j-api</artifactId>
  <version>1.7.21</version>
</dependency>
<dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>slf4j-log4j12</artifactId>
  <version>1.7.21</version>
</dependency>
</dependencies>
</project>

How can I fix this? And how can I then read the body of the response?

#2

Hi TodoMary.

you can find working test HttpServiceTaskTest

I did not find any org.example.flowable.HttpActivityBehaviorImpl in flowable source.

Don’t use org.example.flowable.HttpActivityBehaviorImpl(or implement some)

Regards
Martin

1 Like