[rules-users] Guvnor REST API and XLS decision tables

anchi harijana at ovi.com
Mon May 14 07:38:21 EDT 2012


Hi!

I'm wondering how does Guvnor REST api handle Excel decision tables? I'm
using 5.3.1.Final version.

It seems that when I use url for binary e.g.
/http://{guvnor_url}/rest/packages/package_name/assets/excel_table_name/binary/
, I get a source (.xls) file.
And when I use source url e.g.
/http://{guvnor_url}/rest/packages/package_name/assets/excel_table_name/source/
, I get a binary file.
Is this some bug or is it really expected to work this way?


Also, when I try to build binary file (which I get using source url:) )
using knowledge builder I'm getting exceptions, I have tried it in two ways:

1. kbuilder.add(urlResource, ResourceType.DTABLE);

Exception in thread "main"
org.drools.template.parser.DecisionTableParseException: An error occurred
opening the workbook. It is possible that the encoding of the document did
not match the encoding of the reader.
	at
org.drools.decisiontable.parser.xls.ExcelParser.parseFile(ExcelParser.java:90)
	at
org.drools.decisiontable.SpreadsheetCompiler.compile(SpreadsheetCompiler.java:89)
	at
org.drools.decisiontable.SpreadsheetCompiler.compile(SpreadsheetCompiler.java:68)
	at
org.drools.decisiontable.DecisionTableProviderImpl.compileStream(DecisionTableProviderImpl.java:38)
	at
org.drools.decisiontable.DecisionTableProviderImpl.loadFromInputStream(DecisionTableProviderImpl.java:21)
	at
org.drools.compiler.DecisionTableFactory.loadFromInputStream(DecisionTableFactory.java:18)
	at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:613)
	at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:37)
	at Main.main(Main.java:101)
Caused by: jxl.read.biff.BiffException: Unable to recognize OLE stream
	at jxl.read.biff.CompoundFile.<init>(CompoundFile.java:116)
	at jxl.read.biff.File.<init>(File.java:127)
	at jxl.Workbook.getWorkbook(Workbook.java:268)
	at
org.drools.decisiontable.parser.xls.ExcelParser.parseFile(ExcelParser.java:75)
	... 8 more


2. kbuilder.add(urlResource, ResourceType.DRL);

java.lang.IndexOutOfBoundsException: Index: 693, Size: 693
	at java.util.ArrayList.get(ArrayList.java:352)
	at org.antlr.runtime.CommonTokenStream.LT(CommonTokenStream.java:103)
	at org.drools.lang.ParserHelper.reportError(ParserHelper.java:386)
	at org.drools.lang.DRLParser.compilationUnit(DRLParser.java:182)
	at org.drools.compiler.DrlParser.compile(DrlParser.java:225)
	at org.drools.compiler.DrlParser.parse(DrlParser.java:136)
	at org.drools.compiler.DrlParser.parse(DrlParser.java:141)
	at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:394)
	at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:586)
	at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:37)
	at Main.main(Main.java:101)
Exception in thread "main" java.lang.RuntimeException:
org.drools.compiler.DroolsParserException: Unexpected exception raised while
parsing. This is a bug. Please contact the Development team :
Index: 693, Size: 693
	at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:692)
	at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:37)
	at Main.main(Main.java:101)
Caused by: org.drools.compiler.DroolsParserException: Unexpected exception
raised while parsing. This is a bug. Please contact the Development team :
Index: 693, Size: 693
	at org.drools.compiler.DrlParser.compile(DrlParser.java:242)
	at org.drools.compiler.DrlParser.parse(DrlParser.java:136)
	at org.drools.compiler.DrlParser.parse(DrlParser.java:141)
	at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:394)
	at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:586)
	... 2 more


--
View this message in context: http://drools.46999.n3.nabble.com/Guvnor-REST-API-and-XLS-decision-tables-tp3985574.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list