以下决策表可能出现什么问题?

时间:2016-06-28 10:39:45

标签: java drools business-rules

Decision Table

global
   log 127.0.0.1   local0
   log 127.0.0.1   local1 notice
   #log loghost    local0 info
   maxconn 4096
   chroot /usr/local/etc/haproxy
   uid 99
   gid 99

defaults
    mode http
    timeout connect 5000ms
    timeout client 50000ms
    timeout server 50000ms

frontend http-in
    bind *:8080
    default_backend servers

backend servers
    server server1 10.0.0.4:8080 maxconn 32
    server server1 10.0.0.5:8080 maxconn 32
    server server1 10.0.0.6:8080 maxconn 32

我现在只用一条规则来实现这个决策表。我在规则“Screens_11”中得到“mismatch input'==',text = parser返回null package]]”错误。这是堆栈跟踪:

public class TestDecisionTable {
    public static void main(String[] args)
    {
     try{
         KieServices ks = KieServices.Factory.get();
         KieContainer kContainer = ks.getKieClasspathContainer();
         KieSession kSession = kContainer.newKieSession("ksession-dtables");

         Screens s1 = new Screens();
         s1.setDeliveryChannel("Y");
         s1.setUsePointsAppl("Y");
         s1.setContactDetails("Y");
         s1.setRiskScore("Y");
         s1.setReasonCode(100);
         s1.setCurrentScreen(303);
         kSession.insert(s1);

         Screens s2 = new Screens(); 
         s2.setDeliveryChannel("Y");
         s2.setUsePointsAppl("Y");
         s2.setContactDetails("Y");
         s2.setRiskScore("Y");
         s2.setReasonCode(101);
         s2.setCurrentScreen(303);
         kSession.insert(s2);    

         Screens s3 = new Screens();
         s3.setDeliveryChannel("Y");
         s3.setUsePointsAppl("Y");
         s3.setContactDetails("Y");
         s3.setRiskScore("Y");
         s3.setReasonCode(102);
         s3.setCurrentScreen(303);
         kSession.insert(s3);

         kSession.fireAllRules();

     }
     catch (Throwable t) {
         t.printStackTrace();
     }
     }
}

任何帮助都将不胜感激。

编辑:添加了从电子表格生成的文字

java.lang.RuntimeException: Error while creating KieBase[Message [id=1, level=ERROR, path=Sample.xls, line=8, column=0
   text=[ERR 102] Line 8:16 mismatched input '==' in rule "Screens_11"], Message [id=2, level=ERROR, path=Sample.xls, line=0, column=0
   text=Parser returned a null Package]]
    at org.drools.compiler.kie.builder.impl.KieContainerImpl.getKieBase(KieContainerImpl.java:450)
    at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:604)
    at org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:575)
    at com.sample.TestDecisionTable.main(TestDecisionTable.java:15)

1 个答案:

答案 0 :(得分:0)

第8行已加入单元格。不要在约束列之外加入。

尝试使用此代码并使用完整输出报告。

private void testSpreadsheet(){
  File dtf = new File( dtPath );
  InputStream is;
  try {
    is = new FileInputStream( dtf );
    SpreadsheetCompiler ssComp = new SpreadsheetCompiler();
    String s = ssComp.compile( is, InputType.XLS );
    System.out.println( "=== Begin generated DRL ===" );
    System.out.println( s );
    System.out.println( "=== End generated DRL ===" );
  } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
}