Bhaskar Verma
Bhaskar Verma

Reputation: 29

Drools Errors - org.drools.RuleBase

Hi I am migrating my project from java1.6 to Java1.8 . I have updated my Drools jar from 5.2.1.Final to 6.5.0.Final . Now i am getting error in class -

              org.drools.RuleBase
              org.drools.RuleBaseFactory

Error in java code - The import org.drools.RuleBase cannot be resolved--Error in code The import org.drools.RuleBaseFactory cannot be resolved----Error in code

What changes i have to do to make run in Java1.8

Upvotes: 0

Views: 1773

Answers (1)

Roddy of the Frozen Peas
Roddy of the Frozen Peas

Reputation: 15190

Drools 6 is a major change from Drools 5. There was a massive restructuring and some files ceased to exist. Part of this was due to the change in which algorithms Drools was using (rete vs phreak).

At the end of the day, Drools 6 is not a drop-in replacement for Drools 5. You can't just re-version the jars and expect them to work -- some of the jars that were part of Drools 5 don't even exist in Drools 6! For the most part, you can do drop-in replacements within a major version (eg. you can swap 5.x for 5.y. or 6.x for 6.y) up through 7.44 (ish). But major version changes have breaking changes, as do minor versions of 7 greater than 44.

As a concrete example, the class org.drools.RuleBase doesn't exist anymore in Drools 6. If you download the drools-core jar, open it up, and explore, you'll see that there are no classes in org.drools.

It's been a long time since I used Drools 5, but if RuleBase is the class that I think it is, then the Drools 6-specific replacement is KnowledgeBase. That class is available in the knowledge-api jar, which replaced the drools-api jar and serves as a bridge between the deprecated APIs and the new kie apis. In Drools 7, this becomes KieBase.

Version Class Jar
Drools 5 RuleBase drools-api
Drools 6 KnowledgeBase knowledge-api
Drools 7 KieBase kie-api

You need to go in and refactor your code to not rely on the deprecated/removed classes, and update your configurations, code, and rules for the new workflows introduced in Drools 6.

Upvotes: 1

Related Questions