Hi all,
when playing around for the first time with Camunda’s rule engine implementation in the latest 7.4.0-SNAPSHOT, I encounter the following exception:
Exception in thread "main" org.camunda.bpm.dmn.engine.impl.transform.DmnTransformException: DMN-02004 Error while transforming decisions: org.camunda.bpm.model.xml.impl.instance.ModelElementInstanceImpl cannot be cast to org.camunda.bpm.model.dmn.instance.Definitions
at org.camunda.bpm.dmn.engine.impl.transform.DmnTransformLogger.errorWhileTransforming(DmnTransformLogger.java:55)
at org.camunda.bpm.dmn.engine.impl.transform.DefaultDmnTransform.transformDecisions(DefaultDmnTransform.java:137)
at org.camunda.bpm.dmn.engine.impl.DefaultDmnEngine.parseDecisions(DefaultDmnEngine.java:62)
at org.camunda.bpm.dmn.engine.impl.DefaultDmnEngine.parseDecision(DefaultDmnEngine.java:117)
at DecisionStarter.main(DecisionStarter.java:27)
Caused by: java.lang.ClassCastException: org.camunda.bpm.model.xml.impl.instance.ModelElementInstanceImpl cannot be cast to org.camunda.bpm.model.dmn.instance.Definitions
at org.camunda.bpm.model.dmn.impl.DmnModelInstanceImpl.getDefinitions(DmnModelInstanceImpl.java:31)
at org.camunda.bpm.dmn.engine.impl.transform.DefaultDmnTransform.transformDecisions(DefaultDmnTransform.java:124)
... 3 more
I use the following code to setup the rule engine and run a rule evaluation on it, inspired by the code in Bernd's post:
https://groups.google.com/d/msg/camunda-bpm-users/Z2bKes3nIA0/64e24b8FCgAJ
String chargeType = "CC";
Integer freightChargeValue = 15000;
Map<String, Object> variables = Variables.createVariables();
variables.put("chargeType", chargeType);
variables.put("freightChargeValue", freightChargeValue);
LOGGER.debug("Initializing DMN engine");
DmnEngine dmnEngine = new DefaultDmnEngineConfiguration().buildEngine();
DmnDecision decision = dmnEngine.parseDecision("manualCheckNeeded.dmn",
DecisionStarter.class.getResourceAsStream("/manualCheckNeeded.dmn"));
DmnDecisionTableResult decisionResult = dmnEngine.evaluateDecisionTable(decision, variables);
Does anyone have an idea what do I miss to get it running? If needed, I could provide the Eclipse project (but it contains barely more than the Java class, the Maven POM and the attached .dmn file which I created with the dmn-io modeller).
Thanks,
Andre
Andre Hegerath
IT-Systementwickler
E-Mail:
andre.h...@hbt.de
Tel.:
+49 40 369779-21
HBT Hamburger Berater Team GmbH
Stadthausbrücke 3, 20355 Hamburg
Geschäftsführer:
Ilse Habermann, Hans-Joachim Habermann,
Arne Habermann, Daniel Hoffmann
Handelsregister:
HRB 31629 Hamburg