Hmmm.... Rikkola can't replicate so something is broken here.... :(
Hi,
This boiler plate code demonstrates a rather, I suspect large, problem:-
@Test
public void testPackageAttributesFromDRL() {
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add( new ClassPathResource( "org/drools/example.drl" ), ResourceType.DRL ); //<--- Error
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
}
throws:-
java.lang.NullPointerException
at org.drools.compiler.PackageBuilder.generateDeclaredBean(PackageBuilder.java:1433)
at org.drools.compiler.PackageBuilder.processTypeDeclarations(PackageBuilder.java:1272)
at org.drools.compiler.PackageBuilder.mergePackage(PackageBuilder.java:895)
at org.drools.compiler.PackageBuilder.newPackage(PackageBuilder.java:883)
at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:601)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:297)
at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:473)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
at org.drools.BinaryPackage.testPackageAttributesFromDRL(BinaryPackage.java:35)
In org.drools.compiler.PackageBuilder.generateDeclaredBean the call to the following returns null.
JavaDialectRuntimeData dialect = (JavaDialectRuntimeData) pkgRegistry.getDialectRuntimeRegistry().getDialectData( "java" );
DRL is:-
package example
declare Person
age: Integer
name: String
end
rule "Row 1 dtable"
salience 1
dialect "mvel"
when
$p : Person( name == "Bill" , age != "30" )
then
$p.setAge( 12345 );
end
It worked OK yesterday.
Any takers?
With kind regards,
Mike