So, my code is doing this:
KnowledgeBaseConfiguration conf =
KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
conf.setOption(EventProcessingOption.STREAM);
KnowledgeBuilder builder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
try {
File f = new File("/tmp/my.pkg");
InputStream stream = new FileInputStream(f);
if (stream == null) {
jlog.fatal("Unable to find rule pkg");
} else {
jlog.info("adding pkg");
builder.add(ResourceFactory.newInputStreamResource(stream),
ResourceType.PKG);
}
} catch (Exception e) {
e.printStackTrace();
}
KnowledgeBase kbase =
KnowledgeBaseFactory.newKnowledgeBase(conf);
kbase.addKnowledgePackages(builder.getKnowledgePackages());
jlog.info("setup creating knowledge session");
ksession = kbase.newStatefulKnowledgeSession();
jlog.info(" setup ksession created");
The pkg was created from Guvnor.
If in the package declaration area in Guvnor, (where you put the import
statements)
If I put
declare Signature
@role ( event )
end
then build the package, save it to disk /tmp/my.pkg
on startup I get:
[#|2009-11-24T14:50:38.944+0000|WARNING|sun-appserver2.1|javax.enterprise.system.stream.err|_ThreadID=12;_ThreadName=pool-1-thread-3;_RequestID=7c35064d-757e-4519-b5eb-433db89e168d;|org.drools.RuntimeDroolsException:
unable to resolve Type Declaration class 'Signature'
at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:754)
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:515)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)
I need to declare 'Signature' as an 'event'
Am I doing this wrong?
If I do this all in Eclipse and load the DRL files manually it all works.
--
View this message in context:
http://old.nabble.com/unable-to-resolve-Type-Declaration-class-tp26497326...
Sent from the drools - user mailing list archive at
Nabble.com.