Hi there,

I am having problems adding knowledge packages to a kb. For instance I create a kb n' add this drl:

package test

rule "abc" 
then System.out.println("abc"); 
end 

then I want to add another drl with the same package.

package test

rule "123" 
then System.out.println("123"); 
end 

this is the code i'm using for adding

public static void add(KnowledgeBase kb, String content) throws Exception {

(1) KnowledgeBuilder builder = KnowledgeBuilderFactory.newKnowledgeBuilder(kb);
(2) builder.add(
ResourceFactory.newByteArrayResource(content.getBytes()), 
ResourceType.DRL);

if (builder.hasErrors())
throw new Exception(builder.getErrors().toString());

kb.addKnowledgePackages(builder.getKnowledgePackages());
}

please notice i am creating a new builder every time  and the kb is passed in on (1)

the first call to add works fine. but on the second i get a NullPointerException on line (2)

java.lang.NullPointerException
at org.drools.rule.builder.dialect.java.PackageStore.write(PackageStore.java:47)
at org.drools.commons.jci.compilers.EclipseJavaCompiler$3.acceptResult(EclipseJavaCompiler.java:350)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:474)
at org.drools.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJavaCompiler.java:358)
at org.drools.commons.jci.compilers.AbstractJavaCompiler.compile(AbstractJavaCompiler.java:49)
at org.drools.rule.builder.dialect.java.JavaDialect.compileAll(JavaDialect.java:369)
at org.drools.compiler.DialectCompiletimeRegistry.compileAll(DialectCompiletimeRegistry.java:53)
at org.drools.compiler.PackageRegistry.compileAll(PackageRegistry.java:71)
at org.drools.compiler.PackageBuilder.compileAll(PackageBuilder.java:869)
at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:826)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:404)
at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:586)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:37)

thank you very much
mike