Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camunda BPMN Model API cannot parse models with randomly ordered nodes #3983

Closed
1 task
cdiama opened this issue Nov 29, 2023 · 1 comment
Closed
1 task
Assignees
Labels
type:bug Issues that describe a user-facing bug in the project.

Comments

@cdiama
Copy link

cdiama commented Nov 29, 2023

Environment (Required on creation)

SpringBoot project using camunda-bpmn-model 7.20.0

Description (Required on creation; please attach any relevant screenshots, stacktraces, log files, etc. to the ticket)

Given a sample BPMN diagram (attached below), consisting of a messageStartEvent and a Task only, I can successfully load it in the demo BPMN.io editor but on the other hand, it cannot be parsed in my SpringBoot project using the readModelFromStream(InputStream stream) method of the camunda-bpmn-model library. The following SAXException is thrown:

Caused by: org.xml.sax.SAXException: Error: URI=null Line=1: cvc-complex-type.2.4.a: Invalid content was found starting with element '{"http://www.omg.org/spec/BPMN/20100524/MODEL":outgoing}'. One of '{"http://www.omg.org/spec/BPMN/20100524/MODEL":eventDefinition, "http://www.omg.org/spec/BPMN/20100524/MODEL":eventDefinitionRef}' is expected.
        at org.camunda.bpm.model.xml.impl.util.DomUtil$DomErrorHandler.error(DomUtil.java:202)
        at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:138)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:284)
        at java.xml/com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:512)
        at java.xml/com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3600)
        at java.xml/com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1972)
        at java.xml/com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:830)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:374)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2726)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
        at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:542)
        at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:889)
        at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:825)
        at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)        
        at java.xml/com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:247)        
        at java.xml/com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:342)
        at java.xml/javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:122)
        at org.camunda.bpm.model.xml.impl.util.DomUtil.parseInputStream(DomUtil.java:240)
        ... 153 common frames omitted

Steps to reproduce (Required on creation)

To reproduce the issue one just needs to try to parse the attached BPMN sample using the readModelFromStream(InputStream stream) method
diagram(2).bpmn.txt

Observed Behavior (Required on creation)

The model cannot be read by the Camunda parser as it fails with an org.xml.sax.SAXException exception

Expected behavior (Required on creation)

The model is successfully parsed and a BpmnModelInstance instance is returned

Root Cause (Required on prioritization)

Seems that the issue derives from the fact that the event definition (messageEventDefinition) precedes the outgoing node and that all in all the nodes order is to be strictly defined in the BPMN model.

Solution Ideas

A couple of online editors (including the BPMN.io) modeler can handle such models without issues. Would be possible to apply the same logic in the library as well so to be more flexible? Unfortunately I am not familiar with the source code to come up with a precise proposition.

Hints

Links

Breakdown

Pull Requests

No tasks being tracked yet.

Dev2QA handover

  • Does this ticket need a QA test and the testing goals are not clear from the description? Add a Dev2QA handover comment
@cdiama cdiama added the type:bug Issues that describe a user-facing bug in the project. label Nov 29, 2023
@mboskamp
Copy link
Member

Hi @cdiama,
Thanks for raising a bug report with us. I checked the file you attached (thanks for that!).
I noticed that you used demo.bpmn.io to create the model. While bpmn.io is a product of Camunda, this does not mean all diagrams produced with this tool are executable with the Camunda 7 BPMN engine. This has the following reasons (among others):

  • bpmn.io is a BPMN 2.0 editor, it produces BPMN 2.0 compliant models. The model you showed here is valid BPMN 2.0. However, it is not compliant with an executable BPMN diagram for Camunda 7.
  • When creating a model with any BPMN 2.0 editor, the editor needs to know for which engine the model is created. For example, Camunda 7 and Camunda 8 diagrams are not compatible, even if both read valid BPMN 2.0 diagrams. This has to do with the internals of the engines which are very different from each other.
  • demo.bpmn.io is a demo. It does not produce executable models. Even after fixing your model, it did not show in Camunda 7 because it is missing important pieces.

If you want to create executable BPMN 2.0 diagrams, please use the Camunda Modeler. It is built on top of bpmn.io and supports creating executable models. The Camunda forum is a great place to start when you encounter an issue with any of our products. Most times, people over there can help you quickly.

I will close this issue. If you are certain you encountered a bug, please feel free to reopen or open a new issue. In that case provide as much information as you can and explain why this is a bug with the Camunda 7 engine.

Best,
Miklas

@mboskamp mboskamp closed this as not planned Won't fix, can't repro, duplicate, stale Nov 29, 2023
@mboskamp mboskamp self-assigned this Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Issues that describe a user-facing bug in the project.
Projects
None yet
Development

No branches or pull requests

2 participants