Uploaded image for project: 'Kogito'
  1. Kogito
  2. KOGITO-8279

BPMN file contaning (Java) ServiceTask created using VSCode BPMN Editor causes parser errors in maven build

XMLWordPrintable

    • False
    • None
    • False
    • ---
    • ---
    • 2022 Week 47-49 (from Nov 21), 2022 Week 50-02 (from Dec 12), 2023 Week 03-05 (from Jan 16), 2023 Week 06-08 (from Feb 6), 2023 Week 09-11 (from Feb 27), 2023 Week 12-14 (from Mar 20)

      Component: VSCode BPMN Editor extension

      Error description

      Using BPMN Editor VSCode extention (0.25.0) for designing/editing processes, when we create a (Java) Service Task by reference to our product documentation [1] using the BPMN Editor, the bpmn file for the process causes a specific parser error in maven build.

      I created a reproducer for the same error as the user encountered, and attached it in this JIRA.
      Also, for the steps to reproduce the error, please see (*1).
      By following the steps, you can see 2 issues/errors below, and (2) is the error actually reported by the user.

      Error (1)

      [ERROR] Node Info: id: name:
      Parser message: (null: 2, 718): cvc-elt.1.a: Cannot find the declaration of element 'bpmn2:definitions'.
      java.lang.NullPointerException

      Error (2)

      [ERROR] Node Info: id:_ABEE9B1C-4D57-47FA-8ABC-E69DA5F0FD95_ServiceOperation name:sayHello
      Parser message: (null: 8, 128): cvc-complex-type.2.4.b: The content of element 'bpmn2:operation' is not complete. One of '

      {"[http://www.omg.org/spec/BPMN/20100524/MODEL]":documentation, "[http://www.omg.org/spec/BPMN/20100524/MODEL]":extensionElements, "[http://www.omg.org/spec/BPMN/20100524/MODEL]":inMessageRef}

      ' is expected.
      java.lang.NullPointerException

       

      [1] Red Hat Process Automation Manager > 7.13 > Developing process services in Red Hat Process Automation Manager - 5.3. Creating service tasks
          https://access.redhat.com/documentation/en-us/red_hat_process_automation_manager/7.13/html-single/developing_process_services_in_red_hat_process_automation_manager/index#create-service-task-proc

          ==> In Section 5.3. "Creating service tasks", the user referred to Procedure 1. to 9. and the steps in "Example of creating Java service task"

      [2] KOGITO-5714 - Stunner - every process shows error messages during compilation
          https://issues.redhat.com/browse/KOGITO-5714

      (1) Error detail

      [ERROR] Node Info: id: name:
      Parser message: (null: 2, 718): cvc-elt.1.a: Cannot find the declaration of element 'bpmn2:definitions'.
      java.lang.NullPointerException
          at org.jbpm.bpmn2.xml.ServiceTaskHandler.handleNode(ServiceTaskHandler.java:75)
          at org.jbpm.bpmn2.xml.TaskHandler.end(TaskHandler.java:165)
          .....
      [ERROR] Unable to build KieBaseModel:defaultKieBase
      ProcessLoadError: unable to parse xml : Exception class java.lang.NullPointerException : null

      (2) Error detail (the error reported by the user)

      [ERROR] Node Info: id:_ABEE9B1C-4D57-47FA-8ABC-E69DA5F0FD95_ServiceOperation name:sayHello
      Parser message: (null: 8, 128): cvc-complex-type.2.4.b: The content of element 'bpmn2:operation' is not complete. One of '

      {"[http://www.omg.org/spec/BPMN/20100524/MODEL]":documentation, "[http://www.omg.org/spec/BPMN/20100524/MODEL]":extensionElements, "[http://www.omg.org/spec/BPMN/20100524/MODEL]":inMessageRef}

      ' is expected.
      java.lang.NullPointerException
          at org.jbpm.bpmn2.xml.ServiceTaskHandler.handleNode(ServiceTaskHandler.java:75)
          at org.jbpm.bpmn2.xml.TaskHandler.end(TaskHandler.java:165)
      .....
      [ERROR] Unable to build KieBaseModel:defaultKieBase
      ProcessLoadError: unable to parse xml : Exception class java.lang.NullPointerException : null

      (*1) Steps to reproduce:

          I created the following 2 projects by following the documentation [1]. On Business Central, these projects can be run normally.

              example_servicetask_1a.zip – This contains a bpmn file (process1.bpmn) created using Business Central process designer.
              example_servicetask_1a_support.zip — This contains a Java class which ServiceTask calls.

          To reproduce the errors (1) and (2), please follow the following steps.

          1. Unzip example_servicetask_1a.zip and example_servicetask_1a_support.zip respectively.

          2. Build example_servicetask_1a_support.

              $ cd example_servicetask_1a_support
              $ mvn clean install

          3. Build example_servicetask_1a.

              $ cd example_servicetask_1a
              $ mvn clean package  // Build will succeed at this time because process1.bpmn is a file created using Business Central.

          4. Open process1.bpmn using VSCode with BPMN Editor v0.25.0.

              $ cd example_servicetask_1a
              $ code src/main/resources/com/example/example_servicetask_1a/process1.bpmn

          5. Once process1.bpmn file opened, save the file without modifying anything.

          6. Build example_servicetask_1a again.

              $ mvn clean package  // Build will fail with the error (1) at this time.

          7. Modify the 2nd line of process1.bpmn (starting with <bpmn2:definitions> element) lile below.  ..... (*1-1)

              (from)
              xmlns:xsi="xsi"
              (to)
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.omg.org/bpmn20"

          8. Build example_servicetask_1a again.

              $ mvn clean package  // Build will fail with the error (2) in question this time.

      (*2) process1.bpmn created using Business Central process designer

      <?xml version="1.0" encoding="UTF-8"?>
      <bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.omg.org/bpmn20" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:bpsim="http://www.bpsim.org/schemas/1.0" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:drools="http://www.jboss.org/drools" id="_d3NyQGSWEe2izM122jbhSg" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd http://www.jboss.org/drools drools.xsd http://www.bpsim.org/schemas/1.0 bpsim.xsd http://www.omg.org/spec/DD/20100524/DC DC.xsd http://www.omg.org/spec/DD/20100524/DI DI.xsd " exporter="jBPM Process Modeler" exporterVersion="2.0" targetNamespace="http://www.omg.org/bpmn20">    <---------- (*2-1)
        <bpmn2:itemDefinition id="_nameItem" structureRef="String"/>
        <bpmn2:itemDefinition id="_messageItem" structureRef="String"/>
        <bpmn2:itemDefinition id="_ABEE9B1C-4D57-47FA-8ABC-E69DA5F0FD95_InMessageType" structureRef=""/>                                <---------- (*2-2)
        <bpmn2:itemDefinition id="_ABEE9B1C-4D57-47FA-8ABC-E69DA5F0FD95_OutMessageType" structureRef=""/>                               <---------- (*2-2)
        <bpmn2:itemDefinition id="__ABEE9B1C-4D57-47FA-8ABC-E69DA5F0FD95_ParameterInputXItem" structureRef="String"/>
        <bpmn2:itemDefinition id="__ABEE9B1C-4D57-47FA-8ABC-E69DA5F0FD95_ResultOutputXItem" structureRef="String"/>
        <bpmn2:message id="_ABEE9B1C-4D57-47FA-8ABC-E69DA5F0FD95_InMessage" itemRef="_ABEE9B1C-4D57-47FA-8ABC-E69DA5F0FD95_InMessageType"/>
        <bpmn2:message id="_ABEE9B1C-4D57-47FA-8ABC-E69DA5F0FD95_OutMessage" itemRef="_ABEE9B1C-4D57-47FA-8ABC-E69DA5F0FD95_OutMessageType"/>
        <bpmn2:interface id="_ABEE9B1C-4D57-47FA-8ABC-E69DA5F0FD95_ServiceInterface" name="com.example.example_servicetask_1a_support.HelloWorld" implementationRef="com.example.example_servicetask_1a_support.HelloWorld">
          <bpmn2:operation id="_ABEE9B1C-4D57-47FA-8ABC-E69DA5F0FD95_ServiceOperation" name="sayHello" implementationRef="sayHello">    <---------- (*2-3)
            <bpmn2:inMessageRef>_ABEE9B1C-4D57-47FA-8ABC-E69DA5F0FD95_InMessage</bpmn2:inMessageRef>                                    <---------- (*2-4)
            <bpmn2:outMessageRef>_ABEE9B1C-4D57-47FA-8ABC-E69DA5F0FD95_OutMessage</bpmn2:outMessageRef>                                 <---------- (*2-4)
          </bpmn2:operation>                                                                                                            <---------- (*2-3)
        </bpmn2:interface>
        <bpmn2:process id="example_servicetask_1a.process1" drools:packageName="com.example.example_servicetask_1a" drools:version="1.0" drools:adHoc="false" name="process1" isExecutable="true" processType="Public">
          :
          :
        </bpmn2:process>
        :
        :
      </bpmn2:definitions>

      (*3) process1.bpmn which was saved using BPMN Editor VSCode extension without any changes

      <?xml version="1.0" encoding="UTF-8"?>
      <bpmn2:definitions xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:bpsim="http://www.bpsim.org/schemas/1.0" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:drools="http://www.jboss.org/drools" xmlns:xsi="xsi" id="_cH5OwUbLEDucBtbC4N5jEw" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd http://www.jboss.org/drools drools.xsd http://www.bpsim.org/schemas/1.0 bpsim.xsd http://www.omg.org/spec/DD/20100524/DC DC.xsd http://www.omg.org/spec/DD/20100524/DI DI.xsd " exporter="jBPM Process Modeler" exporterVersion="2.0" targetNamespace="http://www.omg.org/bpmn20">    <---------- (*3-1)
        <bpmn2:itemDefinition id="_nameItem" structureRef="String"/>
        <bpmn2:itemDefinition id="_messageItem" structureRef="String"/>
                                                                                                                                         <---------- (*3-2)
                                                                                                                                         <---------- (*3-2)
        <bpmn2:itemDefinition id="__ABEE9B1C-4D57-47FA-8ABC-E69DA5F0FD95_ParameterInputXItem" structureRef="String"/>
        <bpmn2:itemDefinition id="__ABEE9B1C-4D57-47FA-8ABC-E69DA5F0FD95_ResultOutputXItem" structureRef="String"/>
        <bpmn2:interface id="_ABEE9B1C-4D57-47FA-8ABC-E69DA5F0FD95_ServiceInterface" name="com.example.example_servicetask_1a_support.HelloWorld" implementationRef="com.example.example_servicetask_1a_support.HelloWorld">
          <bpmn2:operation id="_ABEE9B1C-4D57-47FA-8ABC-E69DA5F0FD95_ServiceOperation" name="sayHello" implementationRef="sayHello"/>    <---------- (*3-3)
        </bpmn2:interface>
        <bpmn2:collaboration id="_F761F4B5-28F8-457C-9D53-03329C2B42B8" name="Default Collaboration">
          <bpmn2:participant id="_14B4F30D-4F2E-4113-AE32-935B16CC6BD5" name="Pool Participant" processRef="example_servicetask_1a.process1"/>
        </bpmn2:collaboration>
        <bpmn2:process id="example_servicetask_1a.process1" drools:packageName="com.example.example_servicetask_1a" drools:version="1.0" drools:adHoc="false" name="process1" isExecutable="true" processType="Public">
          :
          :
        </bpmn2:process>
        :
        :
      </bpmn2:definitions>

      (*4) The difference between (*2) and (*3)

          - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.omg.org/bpmn20" in Line (*2-1) was modified to xmlns:xsi="xsi" in Line (*3-1).
            ==> this causes error (1).

          - Lines at (*2-2) were removed in (*3), and also lines at (*2-4) were removed in (*3).
            ==> this causes error (2).

      You can see the error (1) first after saving the bpmn file using BPMN Editor.
      I think (1) is the issue reported in KOGITO-5714 [2].
      We can avoid the error (1) by modifying the bpmn file like (*1-1), but everytime we save the bpmn file, we need to modify it manually.

      After avoiding the error (1) by modifying like (*1-1) manually, then you can see the error (2) in question.
      Regarding (2), it looks for me like that inMessageRef and outMessageRef in bpmn2:operation are actually not used in (Java) Service Task. As far as I look at (*2), (*3), (*4), in BC process designer, however, both inMessageRef and outMessageRef remain in bpmn2:operation as dummy data so as to conform to the BPMN specification (inMessageRef must exist in bpmn2:operation). On the other hand, in BPMN Editor VSCode extension, neither inMessageRef nor outMessageRef are added in bpmn2:operation, so I am suspecting that the issue (2) is a bug in BPMN Editor VSCode extension.

              romartin@redhat.com Roger Martinez
              romartin@redhat.com Roger Martinez
              Lubomir Terifaj Lubomir Terifaj
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: