]
Edson Tirelli closed JBRULES-2348.
----------------------------------
Fix Version/s: 5.1.0.M2
Resolution: Done
Thanks for reporting and providing fix. Committed to trunk on revision #30411.
unable to resolve Type Declaration class
----------------------------------------
Key: JBRULES-2348
URL:
https://jira.jboss.org/jira/browse/JBRULES-2348
Project: Drools
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: drools-compiler, drools-guvnor
Affects Versions: 5.0.1.FINAL, 5.1.0.M1
Environment: Ubuntu 8.04
Reporter: Richard Ambridge
Assignee: Edson Tirelli
Fix For: 5.1.0.M2
Attachments: repository_export.zip, workbench.tar
Using the following code to create a Knowledge Base from a guvnor compiled pkg, (download
the pkg and put in /tmp/my.pkg)
private static KnowledgeBase readKnowledgeBase() throws Exception {
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
File pkgFile = new File("/tmp/my.pkg");
if (pkgFile.exists() == false) {
System.out.println("Unable to find rule pkg");
} else {
System.out.println("RuleService. adding pkg");
kbuilder.add(ResourceFactory.newFileResource(pkgFile), ResourceType.PKG);
}
KnowledgeBuilderErrors errors = kbuilder.getErrors();
if (errors.size() > 0) {
for (KnowledgeBuilderError error: errors) {
System.err.println(error);
}
throw new IllegalArgumentException("Could not parse knowledge.");
}
KnowledgeBaseConfiguration conf =
KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
conf.setOption(EventProcessingOption.STREAM);
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(conf);
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
return kbase;
}
The pkg was created from Guvnor.
If in the package declaration area in Guvnor, (where you put the import statements)
If I put
import com.sample.Message
declare Message
@role( event )
end
then build the package, save it to disk /tmp/my.pkg
on startup I get:
org.drools.RuntimeDroolsException: unable to resolve Type Declaration class
'Message'
at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:759)
at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:516)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)
at com.sample.DroolsTest.readKnowledgeBase(DroolsTest.java:69)
at com.sample.DroolsTest.main(DroolsTest.java:27)
I am unable to declare an object as an event type in guvnor. This prevents any rules
creation and compiling :(
Attached is the workbench from eclipse, and the guvnor repository export
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: