Okay, it took some more investigation and one maven specialist of the
company to figure it out, we added this to the maven pom and now it works:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>xls</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
Cheers
Bernd
-----Ursprüngliche Nachricht-----
Von: rules-dev-bounces(a)lists.jboss.org
[mailto:rules-dev-bounces@lists.jboss.org] Im Auftrag von Geoffrey De Smet
Gesendet: Dienstag, 11. August 2009 20:22
An: rules-dev(a)lists.jboss.org
Betreff: Re: [rules-dev] Exception with Drools-XLS and Maven: "An error
occured opening the workbook."
By default the maven resources plugin copies resources in the encoding
of the platform it's build on IRCC.
It's better to lock that down on UTF-8.
It even logs a warning if it's not locked down.
Is that xls file a resource that's being copied?
With kind regards,
Geoffrey De Smet
Bernd Rücker schreef:
Hi all.
I recently had the same exception as reported in
https://jira.jboss.org/jira/browse/GUVNOR-286, but didnt 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
------------------------------------------------------------------------
_______________________________________________
rules-dev mailing list
rules-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev
_______________________________________________
rules-dev mailing list
rules-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev