<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Thank you. :)<br>
    <br>
    And how do I catch the exceptions occurring while processing and
    executing the rules?<br>
    <br>
    <br>
    <blockquote
      cite="mid:AANLkTikcdXoyssKZoPJmguMUBCVARqdQVkPM3d6CNOhd@mail.gmail.com"
      type="cite">Hi,
      <div>If you are using 5.1 or greater, you can use
        a&nbsp;KnowledgeAgentEventListener to be notified when resource's
        compilation fails. You can create your own implementation
        of&nbsp;KnowledgeAgentEventListener, or you can
        use&nbsp;DefaultKnowledgeAgentEventListener and override just the
        methods you need:</div>
      <div><br>
      </div>
      <div>kagent.addEventListener(new&nbsp;
        <meta http-equiv="content-type" content="text/html;
          charset=ISO-8859-1">
        DefaultKnowledgeAgentEventListener() {</div>
      <div>&nbsp;&nbsp;&nbsp;public void
        resourceCompilationFailed(ResourceCompilationFailedEvent event)
        {</div>
      <div>&nbsp;&nbsp; &nbsp; &nbsp; //ResourceCompilationFailedEvent contains a reference
        to kagent's kbuilder. You can use it to see what happened.</div>
      <meta http-equiv="content-type" content="text/html;
        charset=ISO-8859-1">
      <div>&nbsp;&nbsp; }</div>
      <div>
        });</div>
      <div><br>
      </div>
      <div>Best,</div>
      <div><br clear="all">
        <br>
        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br>
        <br>
        Esteban Aliverti<br>
        - Developer @ <a moz-do-not-send="true"
          href="http://www.plugtree.com" target="_blank">http://www.plugtree.com
        </a><br>
        - Blog @ <a moz-do-not-send="true"
          href="http://ilesteban.wordpress.com" target="_blank">http://ilesteban.wordpress.com</a><br>
        <br>
        <br>
        <div class="gmail_quote">On Sun, Oct 24, 2010 at 7:55 PM, Tina
          Vie&szlig;mann <span dir="ltr">&lt;<a moz-do-not-send="true"
              href="mailto:tviessmann@stud.hs-bremen.de">tviessmann@stud.hs-bremen.de</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
            0.8ex; border-left: 1px solid rgb(204, 204, 204);
            padding-left: 1ex;">
            What's the best way for checking for errors when using the
            following<br>
            code for creating a kbase?<br>
            <br>
            <br>
            &nbsp; &nbsp; &nbsp; &nbsp; // ResourceChangeScanner<br>
            &nbsp; &nbsp; &nbsp; &nbsp; ResourceChangeScannerConfiguration sconf =<br>
ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration();<br>
            &nbsp; &nbsp; &nbsp; &nbsp;
            sconf.setProperty("drools.resource.scanner.interval", "10");<br>
            &nbsp; &nbsp; &nbsp; &nbsp;
            ResourceFactory.getResourceChangeScannerService().configure(sconf);<br>
            <br>
            &nbsp; &nbsp; &nbsp; &nbsp;
            ResourceFactory.getResourceChangeNotifierService().start();<br>
            &nbsp; &nbsp; &nbsp; &nbsp;
            ResourceFactory.getResourceChangeScannerService().start();<br>
            <br>
            <br>
            &nbsp; &nbsp; &nbsp; &nbsp; // knowledge base<br>
            &nbsp; &nbsp; &nbsp; &nbsp; KnowledgeBaseConfiguration kbaseConf =<br>
            KnowledgeBaseFactory.newKnowledgeBaseConfiguration();<br>
            &nbsp; &nbsp; &nbsp; &nbsp; kbaseConf.setOption(EventProcessingOption.STREAM);<br>
            &nbsp; &nbsp; &nbsp; &nbsp; kbaseConf.setOption(MBeansOption.ENABLED);<br>
            &nbsp; &nbsp; &nbsp; &nbsp; KnowledgeBase kbase =<br>
            KnowledgeBaseFactory.newKnowledgeBase(kbaseConf);<br>
            <br>
            <br>
            &nbsp; &nbsp; &nbsp; &nbsp; // knowledge agent<br>
            &nbsp; &nbsp; &nbsp; &nbsp; KnowledgeAgentConfiguration kagentConf =<br>
            KnowledgeAgentFactory.newKnowledgeAgentConfiguration();<br>
            &nbsp; &nbsp; &nbsp; &nbsp; kagentConf.setProperty("drools.agent.newInstance",
            "false");<br>
            &nbsp; &nbsp; &nbsp; &nbsp; KnowledgeAgent kagent =<br>
            KnowledgeAgentFactory.newKnowledgeAgent("AITS CEP Engine
            Agent", kbase,<br>
            kagentConf);<br>
            <br>
            <br>
kagent.applyChangeSet(ResourceFactory.newClassPathResource(myFile));<br>
            <br>
            <br>
            &nbsp; &nbsp; &nbsp; &nbsp; // session<br>
            &nbsp; &nbsp; &nbsp; &nbsp; fSession = kbase.newStatefulKnowledgeSession();<br>
            <br>
            <br>
            Thank you.<br>
            Tina<br>
            _______________________________________________<br>
            rules-users mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
            <a moz-do-not-send="true"
              href="https://lists.jboss.org/mailman/listinfo/rules-users"
              target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
          </blockquote>
        </div>
        <br>
      </div>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>