Posted on 2010-10-05 00:22
斷點 閱讀(611)
評論(0) 編輯 收藏 所屬分類:
Drools
WARNING: Wasn't able to correctly close stream for decision table. nulljava.lang.NullPointerException
at jxl.read.biff.File.<init>(File.java:77)
at jxl.Workbook.getWorkbook(Workbook.java:250)
at jxl.Workbook.getWorkbook(Workbook.java:235)
at org.drools.decisiontable.parser.xls.ExcelParser.parseFile(ExcelParser.java:76)
at org.drools.decisiontable.SpreadsheetCompiler.compile(SpreadsheetCompiler.java:89)
at org.drools.decisiontable.SpreadsheetCompiler.compile(SpreadsheetCompiler.java:68)
at org.drools.decisiontable.SpreadsheetCompiler.compile(SpreadsheetCompiler.java:110)
at com.sample.DecisionTableTest.readDecisionTable(DecisionTableTest.java:57)
at com.sample.DecisionTableTest.main(DecisionTableTest.java:35)
在web項目中的原先的寫法為:
final String drl = converter.compile( "rules\\Sample.xls", InputType.XLS );
參考了下別人的寫法,改為下面的方式進行處理:
InputStream is = DecisionTableTest.class.getClassLoader().getResourceAsStream("rules\\Sample.xls");
final String drl = converter.compile( is, InputType.XLS );