DMN Error resolving external function

340 views
Skip to first unread message

Anthony Nguyen

unread,
Jul 29, 2020, 5:26:38 PM7/29/20
to Kogito development mailing list
Hi,

I have attempted to create a basic DMN Decision with a Java Function, but am running into issues compiling.

While trying to compile, I reach this error. I've tried making multiple adjustments, but nothing seems to have worked so far. What am I doing wrong?

2020-07-29 17:14:47,494 ERROR [org.kie.dmn.cor.com.DMNFEELHelper] (build-21) Error compiling Java function 'checkTerminationDate' on node 'checkTerminationDate': Error resolving external function as defined by: function(Person) external { java: { class: "org.acme.Utilities", method signature: "checkTerminationDate(org.acme.tPerson)" }}
2020-07-29 17:14:49,148 ERROR [org.kie.dmn.cor.com.DMNFEELHelper] (Quarkus Main Thread) Error compiling Java function 'checkTerminationDate' on node 'checkTerminationDate': Error resolving external function as defined by: function(Person) external { java: { class: "org.acme.Utilities", method signature: "checkTerminationDate(org.acme.tPerson)" }}



Pictures below for reference. Thank you.





Matteo Mortari

unread,
Jul 29, 2020, 5:33:38 PM7/29/20
to Kogito development mailing list
Hi Anthony,
this looks very strange, since the screenshot of the editor shows org.acme.Person as the 1st parameter type
but the error message is clear the DMN Engine is trying to resolve during the DMN model compilation where the 1st parameter type fqn is actually org.acme.tPerson (with the lower case T in front)

So the screenshot, somehow, does not correspond to the error message.

Can you kindly confirm you saved the model that you reported in the screenshot?
If the error is persisting, can you kindly share the DMN model to understand the issue better?

Hope this helps!
MM

--
You received this message because you are subscribed to the Google Groups "Kogito development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kogito-developm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kogito-development/652806e4-929b-4cb6-b1c8-c2ae12437a58o%40googlegroups.com.

Michael Anstis

unread,
Jul 29, 2020, 5:44:14 PM7/29/20
to Kogito development mailing list
Can you please also advise if you imported a Business Central Data Object (Person) into the DMN model (and it became tPerson)?

IIRC the import would preserve the original name (Person) but I want to eliminate this potential step in reproducing any issue.



--

Michael Anstis

Principal Software Engineer

Red Hat

Anthony Nguyen

unread,
Jul 29, 2020, 6:24:30 PM7/29/20
to Kogito development mailing list
Hi Matteo, 

I apologize. I had the old logs pasted with tPersons when I tried different variations.

2020-07-29 18:16:28,126 ERROR [org.kie.dmn.cor.com.DMNFEELHelper] (build-5) Error compiling Java function 'checkTerminationDate' on node 'checkTerminationDate': Error resolving external function as defined by: function(Person) external { java: { class: "org.acme.Utilities", method signature: "checkTerminationDate(org.acme.Person)" }}
2020-07-29 18:16:29,680 ERROR [org.kie.dmn.cor.com.DMNFEELHelper] (Quarkus Main Thread) Error compiling Java function 'checkTerminationDate' on node 'checkTerminationDate': Error resolving external function as defined by: function(Person) external { java: { class: "org.acme.Utilities", method signature: "checkTerminationDate(org.acme.Person)" }}

This is the DMN model I have. I created this datatype as tPerson with the guide from the Kogito Documentation.


To unsubscribe from this group and stop receiving emails from it, send an email to kogito-development+unsub...@googlegroups.com.

Matteo Mortari

unread,
Jul 30, 2020, 9:39:54 AM7/30/20
to Kogito development mailing list
Hi Anthony,

I have a number of comments which should help to resolve your issue, or mitigate/workaround it.

This is based on Kogito, I made a sample by hand locally to confirm my observations: https://github.com/tarilabs/sample-dmn-external-java-function20200730/tree/master
I am using Kogito since you mentioned this on this mailing-list and with reference to the documentation
  • to be able to invoke external Java function from DMN, you need the latest version of Kogito which includes fix KOGITO-2567
    you can either wait for a new release of Kogito, or you can use in the meantime master branch
    ref: https://github.com/tarilabs/sample-dmn-external-java-function20200730/blob/5ae53b578e7fa2e9bc3c738d7816b030e9b2dc96/pom.xml#L12-L47

  • you don't need to invoke external Java function to implement your use-case, you can use directly DMN/FEEL and one of our extended built-in function: today() 
    ref:
    image.png

  • since you modeled terminationDate as FEEL: date, then the most appropriate equivalent Java type for it it's LocalDate if you don't need TZ

  • the attached DMN sample performs the same calculation, but using DMN/FEEL allows you more flexibility during test, for instance isolating today's date in its own decision you could override it to mitigate the problem is by its nature a non-deterministic function; if I used your Java Utilities function there was not this possibility ;) 
    ref attached screenshots
I hope this helps you!
MM

To unsubscribe from this group and stop receiving emails from it, send an email to kogito-developm...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Kogito development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kogito-developm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kogito-development/c82b1728-d59e-41c8-8511-64076cec9050o%40googlegroups.com.
Screenshot 2020-07-30 at 15.28.44.png
Screenshot 2020-07-30 at 15.23.42.png
Reply all
Reply to author
Forward
0 new messages