The rules and the facts are the same.
So i add the source to the project and (try to) debug into the code.
The NPE occurs in the getIndex method (see source fragment below)
and the reader member is NULL. And the only point where reader is set is
in
the setReadAccessor method, but the method is
now i found out, that my problems are in relation to my serialized
KnowledgePackages.
When i use the following code and load the drl files everything is fine !
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource(rules[i] +
now i found out, that my problems are in relation to my serialized
KnowledgePackages.
When i use the following code and load the drl files everything is fine !
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource(rules[i] +
this approach works fine, I use it this way (import / export)
public CollectionKnowledgePackage importPackages(InputStream input) {
CollectionKnowledgePackage pkgs = Collections.emptyList();
try {
Could it be that the fact where the NPE happens during its insert contains a
field of some wrapper type (e.g.)Integer that's null and needs to be
converted to a simple type (e.g. int)?
But the same NPE should happen when you insert the same fact with rules
coming from a single file - but you'll
Mmmh,
i still get an NPE but from a different function within
ClassFieldReader.java
with the 4.07 Api calls it was
at org.drools.base.ClassFieldReader.isNullValue(ClassFieldReader.java:183)
now its
java.lang.NullPointerException
at
Hey,
i have a drl file with round about 100 rules. when i run this single file
everything fine !
When i splip the file into two files and add them seperate into the ruleBase
i get the following Exception
during the inserting of the facts:
java.lang.NullPointerException
at
On 7/23/09, Olaf Raether o.raet...@epro.de wrote:
The code looks like this:
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
for (int i = 0; i rules.length; i++) {
Package pkg = getPackage(i);
ruleBase.addPackage(pkg);
}
I'd expect to find Package pkg = rules[i]; or
I create *.pkg file with the following app:
--
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.ObjectOutputStream;
import java.net.URL;
import
Consider adapting to the new API using KnowledgeBuilder etc. You can use a
ObjectOutput/InputStream with write/readObject on
CollectionKnowledgePackage, which simplifies matters somewhat.
See below, two remarks.
On 7/23/09, Olaf Raether o.raet...@epro.de wrote:
I create *.pkg file with the
Thanks so far - i will change the api calls and post my results.
--
View this message in context:
http://www.nabble.com/Problem-when-using-multiple-rule-files-%28Drools-5%29-tp24623347p24626080.html
Sent from the drools - user mailing list archive at Nabble.com.
11 matches
Mail list logo