The drools we are using is forked from github, the last commit happened at
Apr 24, 2013,
https://github.com/droolsjbpm/drools/commit/c6d3175c013b1a93d5bec99af7521e5d3cfc4e11

Following is the code for building knowledge base:
_kbase = new KnowledgeBaseImpl(new ReteooRuleBase(id, null));

For registering drl code to knowledge base:
Properties props = new Properties();
props.setProperty("drools.dialect.java.compiler", "JANINO");
KnowledgeBuilderConfiguration conf =
KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(props, null);

final KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder(conf);

kbuilder.add(ResourceFactory.newInputStreamResource(new
ByteArrayInputStream(drlCode.getBytes())), ResourceType.DRL);

_ksession.execute(new GenericCommand<Void>() {

    @Override
    public Void execute(Context ctxt) {
        _ksession.getKieBase().addKnowledgePackages(
                kbuilder.getKnowledgePackages());
        try {
            _kbaseStore.saveKnowledgeBase();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        return null;
    }
});

The drl code:
package test_input

declare input
type : String
end

declare output
taskname : String
end

rule "Rule A"
dialect "mvel"
salience 0
no-loop
when
$input:input(type == "a")
$output:output()
then
modify ($output) {taskname = "Hello"};
end

Stace trace(Not full, others are just the logic in our system, such as
router, find rules, etc.):
java.lang.ClassCastException: test_input.input cannot be cast to
test_input.input
        at org.drools.base.test_input.input1271536688$setType.setValue(Unknown
Source) ~[na:na]
        at
org.drools.core.base.ClassFieldWriter.setValue(ClassFieldWriter.java:164)
~[org.drools.core_6.0.0.20130429-0424.jar:6.0.0.024]
        at
org.drools.core.base.ClassFieldAccessor.setValue(ClassFieldAccessor.java:330)
~[org.drools.core_6.0.0.20130429-0424.jar:6.0.0.024]
        at 
org.drools.core.factmodel.ClassDefinition.set(ClassDefinition.java:244)
~[org.drools.core_6.0.0.20130429-0424.jar:6.0.0.024]



--
View this message in context: 
http://drools.46999.n3.nabble.com/Why-disable-properyreactive-if-amount-of-properties-larger-than-or-equals-to-64-tp4026359p4026367.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to