0

I have created a runnable jar containing drools engine functionality (.drl files are also inside jar) while running on windows the output is fine but on ZOS I get the below error with respect to .drl files.

    java.lang.RuntimeException: Error while creating KieBaseÝMessage Ýid=1, kieBase=
rules, level=ERROR, path=rules/Sample.drl, line=1, column=0                     
   text=ÝERR 101¨ Line 1:41 no viable alternative at input ''¨, Message Ýid=2, k
ieBase=rules, level=ERROR, path=rules/Sample.drl, line=1, column=0              
   text=ÝERR 101¨ Line 1:98 no viable alternative at input ''¨, Message Ýid=3, k                                                                              

   text=ÝERR 101¨ Line 1:98 no viable alternative at input ''¨, Message Ýid=3, k
ieBase=rules, level=ERROR, path=rules/Sample.drl, line=1, column=0              
   text=ÝERR 101¨ Line 1:114 no viable alternative at input ''¨, Message Ýid=4, 
kieBase=rules, level=ERROR, path=rules/Sample.drl, line=1, column=0             
   text=ÝERR 101¨ Line 1:115 no viable alternative at input ''¨, Message Ýid=5, 
kieBase=rules, level=ERROR, path=rules/Sample.drl, line=1, column=0             
   text=ÝERR 101¨ Line 1:116 no viable alternative at input ''¨, Message Ýid=6, 
kieBase=rules, level=ERROR, path=rules/Sample.drl, line=1, column=0             
   text=ÝERR 101¨ Line 1:117 no viable alternative at input ''¨, Message Ýid=7, 
kieBase=rules, level=ERROR, path=rules/Sample.drl, line=1, column=0             
   text=ÝERR 101¨ Line 1:118 no viable alternative at input ''¨, Message Ýid=8, 
kieBase=rules, level=ERROR, path=rules/Sample.drl, line=1, column=0             
   text=ÝERR 101¨ Line 1:119 no viable alternative at input ''¨, Message Ýid=9, 
kieBase=rules, level=ERROR, path=rules/Sample.drl, line=1, column=0  `package com.cft.hogan.test.drools.example.drink;`


import com.cft.hogan.test.drools.Person

rule "CanDrink"
when
    p : Person( age >= 21 )
then
    p.setCanDrink(true);
end
kushwah_a
  • 135
  • 2
  • 9
  • The same code works fine on ZOS for a decision table test i.e. using excel files instead of .drl files. – kushwah_a May 17 '17 at 11:57
  • It seems that you have a problem due to different default encodings for text files. Make sure to use the constructor forms providing a Charset. – laune May 17 '17 at 13:21
  • Could you guide me towards that, how do I include charset information for drl files, inside my java code, or kmodule.xml or inside .drl file itself. – kushwah_a May 17 '17 at 14:15
  • You need to describe how you compile the DRL file(s) and/or create the KieBase from your jar. – laune May 18 '17 at 10:37
  • DRL files are also part of the same jar as the java classes and I use the below code to achieve my session `KieServices ks = KieServices.Factory.get(); KieContainer kContainer = ks.getKieClasspathContainer(); KieSession kSession = kContainer.newKieSession("ksession-rules");` – kushwah_a May 18 '17 at 14:44
  • This might be a bug. Could you consider coding the creation of the session explicitly by fetching the DRL file from the jar and passing it to the builder? Could you please edit your question adding the first 130 characters of Sample.drl? – laune May 19 '17 at 04:52

0 Answers0