2 Replies Latest reply on Jun 24, 2010 9:15 AM by Tom Fennelly

    multiple xpath element checking in drl?

    w y Newbie

      In my interface I have (ContentBasedWiretab) rules to route to different destinations. Each rule requires checking of 2 xpath elements rather than one.

       

      I had a drl file as following when I was using JBossAS 4.4 and ESB 4.4, it ran without any problems. Now I have upgraded to JBossAS 5.1 and ESB 4.7 it is giving me exceptions.

       

      {code}

      package com.jboss.soa.esb.routing.cbr

       

      #list any import classes here.
      import org.jboss.soa.esb.message.Message;
      import org.jboss.soa.esb.message.format.MessageType;

       

      expander XPathLanguage.dsl

       

      #declare any global variables here
      global java.util.List destinations;

       

      rule "Unconfirmed Routing Rule Initial"   
          when
              xpathEquals expr "//order:order/@documentStatus", "ORIGINAL" use namespaces "order=urn:ean.ucc:order:2" and xpathEquals "//documentCommandHeader/@type", "ADD"
             
          then
              Destination : "unconfirmed";       
      end

       

      rule "Confirmed Routing Rule Cancelled"   
          when
              xpathEquals expr "//order:order/@documentStatus", "COPY" use namespaces "order=urn:ean.ucc:order:2" and xpathEquals "//documentCommandHeader/@type", "DELETE"
          then
              Destination : "confirmed";
      end

      {code}

       

      The exception:

      org.jboss.soa.esb.actions.ActionProcessingException: org.jboss.soa.esb.services.routing.MessageRouterException: Generation raised the following errors: Duplicate declaration for variable 'msg' in the rule 'Unconfirmed Routing Rule Initial' : [Rule name='Unconfirmed Routing Rule Initial']

            at org.jboss.soa.esb.actions.ContentBasedWiretap.process(ContentBasedWiretap.java:160)
            at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.processPipeline(ActionProcessingPipeline.java:634)
            at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.processPipeline(ActionProcessingPipeline.java:586)
            at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.process(ActionProcessingPipeline.java:420)
            at org.jboss.soa.esb.listeners.message.MessageAwareListener$TransactionalRunner.run(MessageAwareListener.java:540)
            at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
            at java.lang.Thread.run(Thread.java:619)
      Caused by: org.jboss.soa.esb.services.routing.MessageRouterException: Generation raised the following errors: Duplicate declaration for variable 'msg' in the rule 'Unconfirmed Routing Rule Initial' : [Rule name='Unconfirmed Routing Rule Initial']

            at org.jboss.internal.soa.esb.services.routing.cbr.JBossRulesRouter.route(JBossRulesRouter.java:141)
            at org.jboss.internal.soa.esb.services.routing.cbr.JBossRulesRouter.route(JBossRulesRouter.java:120)
            at org.jboss.soa.esb.actions.ContentBasedWiretap.executeRules(ContentBasedWiretap.java:172)
            at org.jboss.soa.esb.actions.ContentBasedWiretap.process(ContentBasedWiretap.java:144)
            at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.processPipeline(ActionProcessingPipeline.java:634)
            at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.processPipeline(ActionProcessingPipeline.java:586)
            at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.process(ActionProcessingPipeline.java:420)
            at org.jboss.soa.esb.listeners.message.MessageAwareListener$TransactionalRunner.run(MessageAwareListener.java:540)
            at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
            at java.lang.Thread.run(Thread.java:619)
      Caused by: org.jboss.internal.soa.esb.services.rules.RuleServiceException: Generation raised the following errors: Duplicate declaration for variable 'msg' in the rule 'Unconfirmed Routing Rule Initial' : [Rule name='Unconfirmed Routing Rule Initial']

            at org.jboss.internal.soa.esb.services.rules.DroolsRuleBaseHelper.getNewRuleBaseWithPackage(DroolsRuleBaseHelper.java:268)
            at org.jboss.internal.soa.esb.services.rules.DroolsRuleBaseHelper.createRuleBaseFromRuleFiles(DroolsRuleBaseHelper.java:135)
            at org.jboss.internal.soa.esb.services.rules.DroolsRuleService.getRuleBaseForFileBasedRules(DroolsRuleService.java:546)
            at org.jboss.internal.soa.esb.services.rules.DroolsRuleService.executeStatelessRules(DroolsRuleService.java:147)
            at org.jboss.internal.soa.esb.services.rules.RuleServiceCallHelper.executeStateless(RuleServiceCallHelper.java:168)
            at org.jboss.internal.soa.esb.services.rules.RuleServiceCallHelper.executeRulesService(RuleServiceCallHelper.java:160)
            at org.jboss.internal.soa.esb.services.routing.cbr.JBossRulesRouter.route(JBossRulesRouter.java:135)
            at org.jboss.internal.soa.esb.services.routing.cbr.JBossRulesRouter.route(JBossRulesRouter.java:120)
            at org.jboss.soa.esb.actions.ContentBasedWiretap.executeRules(ContentBasedWiretap.java:172)
            at org.jboss.soa.esb.actions.ContentBasedWiretap.process(ContentBasedWiretap.java:144)
            at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.processPipeline(ActionProcessingPipeline.java:634)
            at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.processPipeline(ActionProcessingPipeline.java:586)
            at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.process(ActionProcessingPipeline.java:420)
            at org.jboss.soa.esb.listeners.message.MessageAwareListener$TransactionalRunner.run(MessageAwareListener.java:540)
            at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
            at java.lang.Thread.run(Thread.java:619)


      It seems the exception is from the 'and' rule I have. How should I implement rules with more than 1 xpath element checking now?