Seeing the template .drl would help to resolve this. Are all @{parameter}s declared in the template header?
-W

2010/11/9 Roger Smith <rogersmith1711@gmail.com>
 
All -
 
I tried out Drools rule template with a with a proptotype app. Drools is throwing NullPointerException as below. I would much appreciate if someone on this list can help.  

java.lang.NullPointerException
    at org.drools.template.parser.DefaultTemplateColumn.createCellCondition(DefaultTemplateColumn.java:68)
    at org.drools.template.parser.DefaultTemplateColumn.addCondition(DefaultTemplateColumn.java:91)
    at org.drools.template.parser.DefaultTemplateRuleBase.createColumnConditions(DefaultTemplateRuleBase.java:105)
    at org.drools.template.parser.DefaultTemplateRuleBase.createTemplateRule(DefaultTemplateRuleBase.java:98)
    at org.drools.template.parser.DefaultTemplateRuleBase.getDTRules(DefaultTemplateRuleBase.java:85)
    at org.drools.template.parser.DefaultTemplateRuleBase.<init>(DefaultTemplateRuleBase.java:64)
    at org.drools.template.parser.TemplateDataListener.<init>(TemplateDataListener.java:76)
    at org.drools.template.parser.TemplateDataListener.<init>(TemplateDataListener.java:52)
    at org.drools.template.ObjectDataCompiler.compile(ObjectDataCompiler.java:44)
 
 
Here is my code

        KnowledgeBuilder kBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
        ObjectDataCompiler converter = new ObjectDataCompiler();
        InputStream dis = new FileInputStream( new File( "/home/pranab/Projects/gridx/ct11_1.drl" ) );
        if (null == dis){
          System.out.println("null rule template stream");
          return;
        }

        Collection<Map<String,Object>> paramMaps = new ArrayList<Map<String,Object>>();

        Map<String,Object> params = new HashMap<String,Object>();

        params.put("summerOnPeakPrimaryRate", new Integer(299));
        params.put("summerOnPeakSecondaryRate", new Integer(524));
        params.put("summerSemiPeakPrimaryRate", new Integer(176));
        params.put("summerSemiPeakSecondaryRate", new Integer(305));
        params.put("summerOffPeakPrimaryRate", new Integer(139));
        params.put("summerOffPeakSecondaryRate", new Integer(243));
        params.put("winterOnPeakPrimaryRate", new Integer(249));
        params.put("winterOnPeakSecondaryRate", new Integer(438));
        params.put("winterSemiPeakPrimaryRate", new Integer(176));
        params.put("winterSemiPeakSecondaryRate", new Integer(305));
        params.put("winterOffPeakPrimaryRate", new Integer(139));
        params.put("winterOffPeakSecondaryRate", new Integer(243));
        paramMaps.add(params);

        String drl = converter.compile(paramMaps, dis);
        Reader rdr = new StringReader( drl );
        kBuilder.add( ResourceFactory.newReaderResource(rdr), ResourceType.DRL);


The line in blue is throwing the exception. This code is very similar to the example code in Drools Expert guide.
 
Best,
 
Roger

 

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users