The error message says StatefulRuleSession, but I'd say you have a StatefulKnowledgeSession ksession.

Do a cast:
   org.drools.runtime.rule.StatefulRuleSession sfrs = (org.drools.runtime.rule.StatefulRuleSession)ksession;
and use this one for firing all rules with an agenda filter.

-W


On 23 August 2010 14:32, Sanjib Karmakar <sanjibk@skytechsolutions.co.in> wrote:

import org.drools.runtime.StatefulKnowledgeSession;
import org.drools.spi.Activation;
import org.drools.spi.AgendaFilter;


.
.
.

  KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
  kbuilder.add(
               ResourceFactory.newClassPathResource(resourceIndicator),
               ResourceType.XDRL
             );
  KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
  kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
.
.
.

  public Object getSpecificRuleReport(
                               Object requestDTO,
                               Object responseDTO,
                               final String ruleAry[]
                                )
  throws Exception
  {
     AgendaFilter agendafilter =
           new StatefulKnowledgeSessionImpl.AgendaFilterWrapper(null)
       {
           public boolean accept(Activation activation)
           {
              boolean returnFlag = false;
              int ruleArySize = ruleAry.length;

                   for (int cnt=0; cnt<ruleArySize; cnt++)
                {
               if (activation.getRule().getName().equals(ruleAry[cnt]))
                       returnFlag =  false;
               else
                       returnFlag =  true;
                }

               return returnFlag;
           }
       };

       try
        {
           ksession.insert(requestDTO);
           ksession.insert(responseDTO);
           ksession.fireAllRules(agendafilter);
        }catch(Exception t)
         {
            _logger.error(t.getMessage()+"\n"+t);
         }

       return responseDTO;
    }

Eclipse is showing that there is a method fireAllRules() which takes
AgendaFilter as a parameter
but I am getting error "The method fireAllRules(int) in the type
StatefulRuleSession is not applicable for the arguments (AgendaFilter)" at
'ksession.fireAllRules(agendafilter);'

I am trying to execute specific rules out of set of rules. Please help me to
fix this issue.


--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Please-help-me-to-fix-the-AgendaFilter-related-issue-tp1289855p1289855.html
Sent from the Drools - User mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users