[rules-dev] Exception with Drools-XLS and Maven: "An error occured opening the workbook."

Bernd Rücker bernd.ruecker at camunda.com
Tue Aug 11 10:13:46 EDT 2009


Hi all.



I recently had the same exception as reported in
<https://jira.jboss.org/jira/browse/GUVNOR-286>
https://jira.jboss.org/jira/browse/GUVNOR-286, but didn’t find anything on
the web. We currently have the same error with Maven and Drools 5.0.1,
very strange:



Testcode



    public static void main(String[] args) {

           final DecisionTableConfiguration dtableconfiguration =
KnowledgeBuilderFactory.newDecisionTableConfiguration();

            dtableconfiguration.setInputType( DecisionTableInputType.XLS
);



            final KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();

            kbuilder.add(
ResourceFactory.newClassPathResource("Sample.xls", Test.class ),

                                  ResourceType.DTABLE,

                                  dtableconfiguration );



            final KnowledgeBase kbase =
KnowledgeBaseFactory.newKnowledgeBase();

            kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );



            // typical decision tables are used statelessly

            StatefulKnowledgeSession ksession =
kbase.newStatefulKnowledgeSession();

    }



Stacktrace:



org.drools.template.parser.DecisionTableParseException: An error occured
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
:89)

    at
org.drools.decisiontable.SpreadsheetCompiler.compile(SpreadsheetCompiler.j
ava:90)

    at
org.drools.decisiontable.SpreadsheetCompiler.compile(SpreadsheetCompiler.j
ava:69)

    at
org.drools.decisiontable.DecisionTableProviderImpl.compileStream(DecisionT
ableProviderImpl.java:29)

    at
org.drools.decisiontable.DecisionTableProviderImpl.loadFromInputStream(Dec
isionTableProviderImpl.java:19)

    at
org.drools.compiler.DecisionTableFactory.loadFromInputStream(DecisionTable
Factory.java:16)

    at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.jav
a:508)

    at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java
:31)

    at Test.main(Test.java:21)

Caused by: jxl.read.biff.BiffException: Unable to recognize OLE stream

    at jxl.read.biff.CompoundFile.<init>(CompoundFile.java:111)

    at jxl.read.biff.File.<init>(File.java:113)

    at jxl.Workbook.getWorkbook(Workbook.java:250)

    at jxl.Workbook.getWorkbook(Workbook.java:235)

    at
org.drools.decisiontable.parser.xls.ExcelParser.parseFile(ExcelParser.java
:74)

    ... 8 more



The strange thing: When we tried it with Eclipse (3.4.2) and created a
Drools project, everything worked. When we created a maven project and
added exactly the same libraries, the exception was caused.



We tracked it down to the .project file:



<?xml version="1.0" encoding="UTF-8"?>

<projectDescription>

    <name>iks_drools</name>

    <comment></comment>

    <projects>

    </projects>

    <buildSpec>

        <buildCommand>

            <name>org.eclipse.jdt.core.javabuilder</name>

            <arguments>

            </arguments>

        </buildCommand>

        <!-- buildCommand>

            <name>org.maven.ide.eclipse.maven2Builder</name>

            <arguments>

            </arguments>

        </buildCommand -->

        <buildCommand>

            <name>org.drools.eclipse.droolsbuilder</name>

            <arguments>

            </arguments>

        </buildCommand>

    </buildSpec>

    <natures>

        <nature>org.eclipse.jdt.core.javanature</nature>

        <!-- nature>org.maven.ide.eclipse.maven2Nature</nature -->

    </natures>

</projectDescription>



With the comments it works, without the comments and the maven2Builder and
natures it causes the exception. We are puzzled.



Any ideas?



Hopefully it is OK to post that to the dev lists, seems a pretty deep
thing



Thanks a lot and Cheers

Bernd

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-dev/attachments/20090811/34eed067/attachment.html 


More information about the rules-dev mailing list