RHS cannot find a sub class method when a fact extends java.util.Date

Solution Unverified - Updated -

Issue

We created a fact that extends from Date and added a function named "CalculateDays()" but I can't use it.
I get an error when trying to run this with drools 6.

java.lang.RuntimeException: Error while creating KieBase[Message [id=1, level=ERROR, path=rules/Sample.drl, line=35, column=0
   text=Rule Compilation error The method CalculateDays() is undefined for the type Date]]
    at org.drools.compiler.kie.builder.impl.KieContainerImpl.getKieBase(KieContainerImpl.java:337)
    at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:486)
    at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:457)
    at com.sample.DroolsTest.main(DroolsTest.java:19)
     [main] ERROR Unable to build KieBaseModel:rules
Rule Compilation error : [Rule name='MyRule']
    com/sample/Rule_MyRule329300170.java (7:546) : The method CalculateDays() is undefined for the type Date

Environment

  • Red Hat JBoss BRMS
    • 6.0.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In