Drools and Java

131 views
Skip to first unread message

Gibran Castillo

unread,
May 17, 2018, 9:25:21 AM5/17/18
to Drools Usage
Greetings,

I am using Drools for my Java back-end job, my current set up works properly with Java 1.7.0_21 using drools-compiler 5.2.1.Final, drools-decisiontables 5.4.0.Final, and drools-templates 5.4.0.Final; jbpm-flow 5.1.1.Final, jbpm-bmpn2 5.1.1.Final and with their respective dependencies


This works fine when build and running with Java 1.7.0_21 but not with Java 1.8.0_162.   My project builds successfully with Java 1.8.0_162 and it runs fine except when it tries to load the drools rule xls file


I am not getting an exception in the last line that gets executed:

Properties props = new Properties();

KnowledgeBuilderConfiguration configuration = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(props);

KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newDecisionTableConfiguration(configuration);

DecisionTableConfiguration config = KnowledgeBuilderFactory.newDecisionTableConfiguration();

config.setInputType(DecisionTableInputType.XLS);

kbuilder.add(ResourceFactory.newClassPathResource(spreadsheetFile), ResourcType.DTABLE, config);  // last line executed and then job exists and completes successfully.


The job just completes, it is almost like it exists.


Prior to the last line getting executed I put some debug logs and they show the following:

>> Properties (props):  {}

>> KnowledgeBuilderConfiguration (configuration): org.drools.compiler.PackageBuilderConfiguration@630cb4a4

>> KnowledgeBuilder (kbuilder):  org.drools.builder.impl.KnowledgeBuilderImpl@239bof9d

>> ResourceFactory.newClassPathResource(spreadsheetFile):  [ClassPathResource path='spreadsheet.xls']

>> ResourceType.DTABLE:  ResourceType = 'Decision Table'

>> DecisionTableConfiguration (config):  org.drools.builder.conf.impl.DecisionTableConfigurationImpl@150ab4ed

>> DecisionTableConfiguration (config.getInputType()):  XLS



I try using knowledge-api-5.2.1.Final.jar and then with knowledge-api-5.4.0.Final.jar






So I decided to upgrade from drools 5.5.0 to 7.5.0; I had to do some refactoring because now drools is part of the KIE (Knowledge Is Everything) umbrella, the fact is inserted and it seems like all the rules fire up, but I think not.  I believe the issue is that I am using


InternalKnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();

kbase.addPackages(kbuilder.getKnowledgePackager());

KieSession ksession = kbase.newKieSession();


Instead, I should be using

KieBase kbase = kbuilder.newKieBase();

//kbase.addPackages(kbuilder.getKnowledgePackager());

KieSession ksession = kbase.newKieSession();


Any suggestions are welcome.


Thanks,

Gibran



Mario Fusco

unread,
May 17, 2018, 10:29:38 AM5/17/18
to Drools Usage
Hi Gibran,

sorry if I make you notice this, but you're using a version of Drools that is 7 or 8 years old. Do you expect Java 8 support on it?

Regards,
Mario

--
You received this message because you are subscribed to the Google Groups "Drools Usage" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-usage+unsubscribe@googlegroups.com.
To post to this group, send email to drools...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-usage/0c78089d-b913-40fd-8ba1-45bf58ffdc5e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gibran Castillo

unread,
May 17, 2018, 10:44:41 AM5/17/18
to Drools Usage
I am new to drools.  Does drools 7.5.0 support or works with Java 8?
To unsubscribe from this group and stop receiving emails from it, send an email to drools-usage...@googlegroups.com.

Mario Fusco

unread,
May 17, 2018, 10:46:34 AM5/17/18
to Drools Usage
Yes. Out of curiosity, since you're new to drools, why did you choose a so old version?

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

To post to this group, send email to drools...@googlegroups.com.

Gibran Castillo

unread,
May 17, 2018, 10:49:55 AM5/17/18
to Drools Usage
I inherited the java app (back-end job) with drools 5.5.0 and Java 7.  I am migrating everything to Java 8 and hence I need to upgrade drools.  I upgrade drools to 7.5.0

Now I am trying to get java app (back-end job) to work with drools 7.5.0 and Java 8.

Gibran Castillo

unread,
May 18, 2018, 11:56:45 AM5/18/18
to Drools Usage
Dear Mario - do you have any other suggestions?
Reply all
Reply to author
Forward
0 new messages