"Error: Failed to compileShared - could not resolve class" when using ArrayList in rules
Issue
When compiling following rule, which uses ArrayList:
import java.util.List;
import java.util.ArrayList;
import fqcn.Model;
global java.util.List<fqcn.Model> sampleGlobal;
rule "sample rule"
dialect "mvel"
when
eval(true)
then
kcontext.getKieRuntime.setGlobal("sampleGlobal",new ArrayList<Model>());
end
An error is thrown:
Analyse Expression kcontext.getKieRuntime.setGlobal("sampleGlobal",new ArrayList<Model>());: [Error: Failed to compileShared: 1 compilation error(s): - (2,54) could not resolve class: ArrayList<Model>] [Near : {... Global("sampleGlobal",new ArrayList<Model ....}] ^ [Line: 12, Column: 0]
Even when using the Fully Qualified Class Name the same error occurs. The imported classes are truly present, so how come this rule can't compile?
Environment
- Red Hat JBoss BRMS
- 6.x
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
