[rules-users] Issue with From Clause - Class Cast Error
tosmun
taylor.osmun at ca.ibm.com
Wed Sep 19 12:52:12 EDT 2012
Thanks for the fast response! I'll attempt to post as much as I can, splicing
out any case specific info.
The Java code surrounding my invocation is as follows:
=============================
//Get a list of all knowledgebase resources
List<File> kbList = config.getCompleteKBList(); //Note that this is a simply
a collection of absolute file paths containing DRL and RF files
if(kbList == null)
throw new FrameworksException("Failed to get list of knowledgebase
resources. Configuration returned null");
//Add all of the resources we found
for(File file : kbList)
{
if(file == null)
continue;
if(log.isDebugEnabled())
log.debug("Adding resource file: " + file.getAbsolutePath());
if(file.getName().endsWith(KB_FILE_EXT))
kbBuilder.add(ResourceFactory.newFileResource(file), ResourceType.DRL);
else if(file.getName().endsWith(RF_FILE_EXT))
kbBuilder.add(ResourceFactory.newFileResource(file), ResourceType.DRF);
else
throw new FrameworksException("Found invalid file in our knowledgebase
list! It was: \"" + file.getAbsolutePath() + "\". This extension is not
supported");
// Check the builder for errors
if (kbBuilder.hasErrors())
{
throw new FrameworksException("<" + file.getAbsolutePath() + ">: Unable
to compile knowledge base: " + kbBuilder.getErrors().toString());
}
}
KnowledgeBase kb = kbBuilder.newKnowledgeBase();
kb.addKnowledgePackages(kbBuilder.getKnowledgePackages());
=============================
The above line is the point at which the error occurs.
I am using several other rule files, but I have removed them while I am
debugging this issue. I am left with simply this rule file:
=============================
package <removed>.kb.appliances
import <removed>.ApplianceType;
import <removed>.ApplianceTypeObject;
import <removed>.ApplianceTypeObjectHost;
import <removed>.ApplianceTypeIdentifier;
import java.util.List;
dialect "java";
rule "root_appliance"
ruleflow-group 'initialize-appliance-definitions'
when
not
(
ApplianceType
(
type == ApplianceTypeIdentifier.APPLIANCE_ROOT
);
);
then
ApplianceType appliance = new
ApplianceType(ApplianceTypeIdentifier.APPLIANCE_ROOT, null);
insert(appliance);
end;
rule "root_host"
no-loop true
ruleflow-group 'initialize-appliance-definitions'
when
$app:ApplianceType
(
type == ApplianceTypeIdentifier.APPLIANCE_ROOT
);
not( ApplianceTypeObject() from $app.getObjectTypes());
then
//Do something
end;
==============================
If there is any more information I can provide please let me know. I believe
that is everything.
--
View this message in context: http://drools.46999.n3.nabble.com/Issue-with-From-Clause-Class-Cast-Error-tp4019846p4019848.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
More information about the rules-users
mailing list