[rules-users] Map<String,String> and modify() can't be together
rjh
raojinghai at gmail.com
Fri May 16 20:46:25 EDT 2014
Hi,
I got a weird problem. A Java List/Map with generics can be used together
with modify() in the same rule. For example, a simple rule like the
following:
package com.sample
import java.util.Map;
import java.util.HashMap;
declare TestFact
@propertyReactive
data : String
end
rule "init"
when
not TestFact()
then
insert (new TestFact());
end
rule "Test Rule"
when
$fact : TestFact()
then
System.out.println( "Hello" );
Map<String,String> a = new HashMap<String,String>();
modify ($fact) {setData("0")}
end
I got the following error message:
java.lang.RuntimeException: Error while creating KieBase[Message [id=1,
level=ERROR, path=rules/Sample.drl, line=18, column=0
text=Unable to resolve type Map<String,String>:
Unable to find class 'Map<String,String>']]
at
org.drools.compiler.kie.builder.impl.KieContainerImpl.getKieBase(KieContainerImpl.java:260)
at
org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:400)
at
org.drools.compiler.kie.builder.impl.KieContainerImpl.newKieSession(KieContainerImpl.java:375)
at com.sample.DroolsTest.main(DroolsTest.java:17)
However, if I remove "<String,String>" from "Map<String,String>", or remove
the "modify" line, the code is correct then.
Thank you!
Jinghai
--
View this message in context: http://drools.46999.n3.nabble.com/Map-String-String-and-modify-can-t-be-together-tp4029591.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
More information about the rules-users
mailing list