Error starting new process instance (HTTP 500)

I modeled a simple process to test the HTTP task.

Process definition
<?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="Test">
  <process id="httpDemoProcess" name="HTTP Demo Process" isExecutable="true">
    <startEvent id="startEvent1"></startEvent>
    <serviceTask id="sid-62709370-6606-4B14-9076-8FDCD077EFBF" name="Send Demo Mail" flowable:type="http">
      <extensionElements>
        <flowable:field name="requestMethod">
          <flowable:string><![CDATA[POST]]></flowable:string>
        </flowable:field>
        <flowable:field name="requestUrl">
          <flowable:string><![CDATA[https://sample.api]]></flowable:string>
        </flowable:field>
        <flowable:field name="disallowRedirects">
          <flowable:string><![CDATA[true]]></flowable:string>
        </flowable:field>
        <flowable:field name="resultVariablePrefix">
          <flowable:string><![CDATA[result]]></flowable:string>
        </flowable:field>
        <flowable:field name="saveResponseVariableAsJson">
          <flowable:string><![CDATA[true]]></flowable:string>
        </flowable:field>
      </extensionElements>
    </serviceTask>
    <endEvent id="sid-59FB1E0E-EEF6-439A-ABE2-A8B53ACB7A32"></endEvent>
    <sequenceFlow id="sid-C8759E80-3F37-4A3B-9CBE-745F7D582321" sourceRef="startEvent1" targetRef="sid-62709370-6606-4B14-9076-8FDCD077EFBF"></sequenceFlow>
    <sequenceFlow id="sid-41781D81-212E-4839-AB5B-B869E10FC10F" sourceRef="sid-62709370-6606-4B14-9076-8FDCD077EFBF" targetRef="sid-59FB1E0E-EEF6-439A-ABE2-A8B53ACB7A32"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_httpDemoProcess">
    <bpmndi:BPMNPlane bpmnElement="httpDemoProcess" id="BPMNPlane_httpDemoProcess">
      <bpmndi:BPMNShape bpmnElement="startEvent1" id="BPMNShape_startEvent1">
        <omgdc:Bounds height="30.0" width="30.0" x="15.0" y="150.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-62709370-6606-4B14-9076-8FDCD077EFBF" id="BPMNShape_sid-62709370-6606-4B14-9076-8FDCD077EFBF">
        <omgdc:Bounds height="80.0" width="100.0" x="120.0" y="135.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-59FB1E0E-EEF6-439A-ABE2-A8B53ACB7A32" id="BPMNShape_sid-59FB1E0E-EEF6-439A-ABE2-A8B53ACB7A32">
        <omgdc:Bounds height="28.0" width="28.0" x="360.0" y="161.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="sid-C8759E80-3F37-4A3B-9CBE-745F7D582321" id="BPMNEdge_sid-C8759E80-3F37-4A3B-9CBE-745F7D582321">
        <omgdi:waypoint x="44.949993965335764" y="165.0"></omgdi:waypoint>
        <omgdi:waypoint x="85.0" y="165.0"></omgdi:waypoint>
        <omgdi:waypoint x="85.0" y="175.0"></omgdi:waypoint>
        <omgdi:waypoint x="120.0" y="175.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-41781D81-212E-4839-AB5B-B869E10FC10F" id="BPMNEdge_sid-41781D81-212E-4839-AB5B-B869E10FC10F">
        <omgdi:waypoint x="219.95" y="175.0"></omgdi:waypoint>
        <omgdi:waypoint x="360.0" y="175.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

Every time I try to start a new instance of this process with the REST API

curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ \ 
 "processDefinitionKey":"httpDemoProcess" \ 
 }' 'http://localhost:12080/flowable-rest/service/runtime/process-instances'

I receive an HTTP 500 error with the following result:

 {
   "message": "Internal server error",
   "exception": "Invalid URL exception occurred"
}

I can successfully start other processes (only tested with the demo processes).

What am I missing?

Hi,

I have no answer, but several questions :slight_smile:

  1. is there any stacktrace in the logs?
  2. did you try to start process instance from flowable-task app (it should use the same API).
  3. is

ready?

Martin

Nothing in the Tomcat logs.

I need to test this. Currently, the server is offline (I move to another machine).

Yes, it is. It’s the Mailgun API and I already successfully send a mail with the same HTTP-Request I use in the task.

Can you paste the http task xml?

Please have a look at the process definition above (It’s a summary section - click to expand).

Had the time to try it. It’s not working too.

Solution
The error relates to wrong URL encoding (linked topic)

I’ve got

Caused by: java.net.UnknownHostException: sample.api
	at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
	at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
	at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
	at java.net.InetAddress.getAllByName0(InetAddress.java:1276)
	at java.net.InetAddress.getAllByName(InetAddress.java:1192)

When I tried to execute this process.

Martin

@martin.grofcik: sample.api is in deed a placeholder (for Mailgun REST API). I already found the solution to my problem. It’s related to URL Encoding (especially URL query parameters).

I think the URL should be correctly encoded when saved in the flowable-modeler (Git Issue). I’d love to fix this myself but I’m struggling to understand the project structure and where to add the encoding in the saving process of a model.

I started flowable using the docker statement

docker run -p8080:8080 flowable/all-in-one

And I try to test the http task … added a very simple url:
http://dummy.restapiexample.com/api/v1/employees

And getting this error …
Any idea?
Also encoding?

Caused by: java.net.UnknownHostException: dummy.restapiexample.com: System error
        at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method) ~[?:?]
        at java.net.InetAddress$PlatformNameService.lookupAllHostAddr(Unknown Source) ~[?:?]
        at java.net.InetAddress.getAddressesFromNameService(Unknown Source) ~[?:?]
        at java.net.InetAddress$NameServiceAddresses.get(Unknown Source) ~[?:?]
        at java.net.InetAddress.getAllByName0(Unknown Source) ~[?:?]

Hi.

Can you verify the container is able to resolve the mentioned host?

Regards,

Yvo

My docker skills are limited :frowning: … Quick howto verify something like that ?

start container with name flowable
docker run -d -p8080:8080 --name flowable flowable/all-in-one

execute nc command in container flowable
docker exec -it flowable nc -zv dummy.restapiexample.com 80

expected output
dummy.restapiexample.com (52.47.194.223:80) open

Thanks for that (learned something here :slight_smile: )

So this is the problem then ?

$ docker exec -it flowable nc -zv dummy.restapiexample.com 80

nc: bad address 'dummy.restapiexample.com

Yes. That means the container cannot resolve the hostname.
By default; when running the container on a default Docker set-up; the container uses the host network to communicate to the outside world.
So (probably) either the host cannot find / access dummy.restapiexample.com or there is something ‘wrong’ with your Docker configuration.