<b>Hi <br><br> I am trying to learn drools. Please help me with this problem. I am using the HelloWorldExample from drools5.0 examples. <br>I have converted the HelloWorld.drl to HelloWorld.xml using the XmlDumper class as follows: </b><br>
  <br>        final Reader source = new InputStreamReader( HelloWorldExample.class.getResourceAsStream( &quot;HelloWorld.drl&quot; ) );<br>        Reader source = new InputStreamReader(fis );<br>        final DrlParser drlp= new DrlParser();<br>
         final PackageDescr astx = drlp.parse(source); <br>        String hope = new String();<br>          XmlDumper xmldumper = new XmlDumper();<br>          hope = xmldumper.dump(astx);<br>        System.out.print(hope);<br>
        try {<br>            FileWriter fw = new FileWriter(new File(&quot;d://HelloWorld.xml&quot;));<br>            fw.write(hope);<br>            fw.flush();<br>            fw.close();<br>            } catch (IOException e){<br>
            }<br><br><b>Then i am trying to load it as follows: </b><br>final KnowledgeBuilder kbuilder = KnowledgeBuilderFactory<br>                .newKnowledgeBuilder();<br><br>        // this will parse and compile in one step<br>
        kbuilder.add(ResourceFactory.newClassPathResource(&quot;HelloWorld.xml&quot;,<br>                HelloWorldExample.class), ResourceType.XDRL);<br><br>        // Check the builder for errors<br>        if (kbuilder.hasErrors()) {<br>
            System.out.println(kbuilder.getErrors().toString());<br>            throw new RuntimeException(&quot;Unable to compile \&quot;HelloWorld.drl\&quot;.&quot;);<br>        }<br><br>        // get the compiled packages (which are serializable)<br>
        final Collection&lt;KnowledgePackage&gt; pkgs = kbuilder<br>                .getKnowledgePackages();<br><br>        // add the packages to a knowledgebase (deploy the knowledge packages).<br>        final KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();<br>
        kbase.addKnowledgePackages(pkgs);<br><br><b>When i try to run this example, i am getting the error</b><br>null: 5, 77): schema_reference.4: Failed to read schema document &#39;<a href="http://drools.org/drools-5.0.xsd">drools.org/drools-5.0.xsd</a>&#39;, because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not &lt;xsd:schema&gt;.<br>
(null: 5, 77): cvc-elt.1: Cannot find the declaration of element &#39;package&#39;.<br>(null: 6, 64): schema_reference.4: Failed to read schema document &#39;<a href="http://drools.org/drools-5.0.xsd">drools.org/drools-5.0.xsd</a>&#39;, because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not &lt;xsd:schema&gt;.<br>
(null: 8, 51): schema_reference.4: Failed to read schema document &#39;<a href="http://drools.org/drools-5.0.xsd">drools.org/drools-5.0.xsd</a>&#39;, because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not &lt;xsd:schema&gt;.<br>
(null: 12, 26): schema_reference.4: Failed to read schema document &#39;<a href="http://drools.org/drools-5.0.xsd">drools.org/drools-5.0.xsd</a>&#39;, because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not &lt;xsd:schema&gt;.<br>
(null: 13, 47): schema_reference.4: Failed to read schema document &#39;<a href="http://drools.org/drools-5.0.xsd">drools.org/drools-5.0.xsd</a>&#39;, because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not &lt;xsd:schema&gt;.<br>
(null: 15, 6): schema_reference.4: Failed to read schema document &#39;<a href="http://drools.org/drools-5.0.xsd">drools.org/drools-5.0.xsd</a>&#39;, because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not &lt;xsd:schema&gt;.<br>
(null: 15, 53): schema_reference.4: Failed to read schema document &#39;<a href="http://drools.org/drools-5.0.xsd">drools.org/drools-5.0.xsd</a>&#39;, because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not &lt;xsd:schema&gt;.<br>
(null: 16, 39): schema_reference.4: Failed to read schema document &#39;<a href="http://drools.org/drools-5.0.xsd">drools.org/drools-5.0.xsd</a>&#39;, because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not &lt;xsd:schema&gt;.<br>
(null: 17, 50): schema_reference.4: Failed to read schema document &#39;<a href="http://drools.org/drools-5.0.xsd">drools.org/drools-5.0.xsd</a>&#39;, because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not &lt;xsd:schema&gt;.<br>
(null: 20, 60): schema_reference.4: Failed to read schema document &#39;<a href="http://drools.org/drools-5.0.xsd">drools.org/drools-5.0.xsd</a>&#39;, because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not &lt;xsd:schema&gt;.<br>
(null: 27, 12): schema_reference.4: Failed to read schema document &#39;<a href="http://drools.org/drools-5.0.xsd">drools.org/drools-5.0.xsd</a>&#39;, because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not &lt;xsd:schema&gt;.<br>
(null: 31, 30): schema_reference.4: Failed to read schema document &#39;<a href="http://drools.org/drools-5.0.xsd">drools.org/drools-5.0.xsd</a>&#39;, because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not &lt;xsd:schema&gt;.<br>
(null: 32, 47): schema_reference.4: Failed to read schema document &#39;<a href="http://drools.org/drools-5.0.xsd">drools.org/drools-5.0.xsd</a>&#39;, because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not &lt;xsd:schema&gt;.<br>
(null: 34, 6): schema_reference.4: Failed to read schema document &#39;<a href="http://drools.org/drools-5.0.xsd">drools.org/drools-5.0.xsd</a>&#39;, because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not &lt;xsd:schema&gt;.<br>
(null: 34, 38): schema_reference.4: Failed to read schema document &#39;<a href="http://drools.org/drools-5.0.xsd">drools.org/drools-5.0.xsd</a>&#39;, because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not &lt;xsd:schema&gt;.<br>
(null: 35, 39): schema_reference.4: Failed to read schema document &#39;<a href="http://drools.org/drools-5.0.xsd">drools.org/drools-5.0.xsd</a>&#39;, because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not &lt;xsd:schema&gt;.<br>
(null: 36, 50): schema_reference.4: Failed to read schema document &#39;<a href="http://drools.org/drools-5.0.xsd">drools.org/drools-5.0.xsd</a>&#39;, because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not &lt;xsd:schema&gt;.<br>
(null: 39, 60): schema_reference.4: Failed to read schema document &#39;<a href="http://drools.org/drools-5.0.xsd">drools.org/drools-5.0.xsd</a>&#39;, because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not &lt;xsd:schema&gt;.<br>
(null: 46, 12): schema_reference.4: Failed to read schema document &#39;<a href="http://drools.org/drools-5.0.xsd">drools.org/drools-5.0.xsd</a>&#39;, because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not &lt;xsd:schema&gt;.<br>
Unable to create a Field value of type  &#39;ValueType = &#39;int&#39;&#39; and value &#39;Message.HELLO &#39; : [Rule name=&#39;Hello World&#39;]<br>java.lang.NoSuchFieldException: HELLO Unable to create restriction &#39;[QualifiedIndentifierRestr: == Message.HELLO  ]&#39; for field &#39;status&#39; in the rule &#39;Hello World&#39; : [Rule name=&#39;Hello World&#39;]<br>
Unable to create a Field value of type  &#39;ValueType = &#39;int&#39;&#39; and value &#39;Message.GOODBYE &#39; : [Rule name=&#39;Good Bye&#39;]<br>java.lang.NoSuchFieldException: GOODBYE Unable to create restriction &#39;[QualifiedIndentifierRestr: == Message.GOODBYE  ]&#39; for field &#39;status&#39; in the rule &#39;Good Bye&#39; : [Rule name=&#39;Good Bye&#39;]<br>
<br>Exception in thread &quot;main&quot; java.lang.RuntimeException: Unable to compile &quot;HelloWorld.drl&quot;.<br>    at org.drools.examples.HelloWorldExample.main(HelloWorldExample.java:36)<br><br><b>I have included the drools5.0 runtime in the classpath of the project and workspace. Am i missing something? <br>
Is it the right way to load the rules in xml format to KnowledgeBuilder? Is there an alternate way? Please HELP! <br><br>thanks<br>Abarna</b><br><br><br>