I am trying to implement drools decision table. When i implemented my own sample code i am getting below error : java.lang.RuntimeException: Error while creating KieBase.
The error visible in console of my Eclipse IDE is :
java.lang.RuntimeException: Error while creating KieBase[Message [id=1, kieBase=patient, level=ERROR, path=PatientDecisionTable.xls, line=10, column=0 text=[ERR 101] Line 10:21 no viable alternative at input ''], Message [id=2, kieBase=patient, level=ERROR, path=PatientDecisionTable.xls, line=10, column=0 text=[ERR 101] Line 10:81 no viable alternative at input ''], Message [id=3, kieBase=patient, level=ERROR, path=PatientDecisionTable.xls, line=0, column=0 text=Parser returned a null Package]] at org.drools.compiler.kie.builder.impl.KieContainerImpl.getKieBase(KieContainerImpl.java:557) at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:682) at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:650) at com.Lab.Genomics.Run.PatientRun.main(PatientRun.java:15)
My Main method is contained in below class:
import org.kie.api.KieServices;
import org.kie.api.runtime.KieContainer;
import org.kie.api.runtime.KieSession;
import com.Lab.Genomics.model.Patient;
public class PatientRun {
public static void main(String[] args) {
// TODO Auto-generated method stub
try{
KieServices ks= KieServices.Factory.get();
KieContainer kContainer=ks.getKieClasspathContainer();
KieSession kSession= kContainer.newKieSession("ksession-patient");
Patient patientObject= new Patient();
patientObject.setBcConfirmed(1);
patientObject.setBcEarlyStage(1);
patientObject.setMetastatisSymptom(1);
patientObject.setName("Sumit");
patientObject.setPatientId(01);
kSession.insert(patientObject);
kSession.fireAllRules();
}catch(Exception e){
e.printStackTrace();
}
}
}
Patient is my pojo. My decision table is as below:
My project directory is as below:
I am unable to find what error is present in the decision table . When i run the main method i get error as mentioned above.
I found a question for drools decision table here decision table error , but this not my case as i checked.
I have tried searching and still trying. Any reference or help is highly appreciated.
Avoid the quotes Excel provides by default. You have them around the string in the println call: LEFT DOUBLE QUOTATION MARK, U+201C RIGHT DOUBLE QUOTATION MARK, U+201D
if I type these keystrokes into an Excel cell: 'A' ' ' 's' ... ':' ' ' '"' 'o' ... 'e' 'e' '"' I'll see this:
A string: “one two three”
Now I copy-paste it into a text file and run a dump program on it:
0000000 41 20 73 74 72 69 6e 67 3a 20 e2 80 9c 6f 6e 65
0000020 20 74 77 6f 20 74 68 72 65 65 e2 80 9d 0a
See the UTF-8 encodings: 0xE2 0x80 0x9C and 0xE2 0x80 0x9D for the quotes, which aren't the ones permitted in DRL code. Make sure to use the quotation mark, code point U+0022. This is it: ->"<-