Hi,<div><br></div><div>#2</div><div><br></div><div>You could try setting the basicAuthentication, Username and Password properties on UrlResource before adding it to the builder:-</div><div><br></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">&lt;snip&gt;</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    builder.add(ResourceFactory.newUrlResource(url), ResourceType.PKG);</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">&lt;/snip&gt;</font></div>
<div><br></div><div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">&lt;snip&gt;</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    UrlResource urlResource = </font><span class="Apple-style-span" style="font-family: &#39;courier new&#39;, monospace; ">ResourceFactory.newUrlResource(url);</span></div>
<div><span class="Apple-style-span" style="font-family: &#39;courier new&#39;, monospace; ">    urlResource.setBasicAuthentication(&quot;enabled&quot;);</span></div><div><span class="Apple-style-span" style="font-family: &#39;courier new&#39;, monospace; ">    urlResource.setUsername(&quot;Smurf&quot;);</span></div>
<div><span class="Apple-style-span" style="font-family: &#39;courier new&#39;, monospace; ">    urlResource.setPassword(&quot;Smurfy&quot;);</span></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">    builder.add(urlResource, ResourceType.PKG);</font></div>
<div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">&lt;/snip&gt;</font></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><br></font></div>When you shift to using change-sets you should be able to embed the basic authentication in the change-set.xml file (as per my previous link) - your example code isn&#39;t using KnowledgeAgent yet; simply a URL resource.</div>
<div><br></div><div><br><div class="gmail_quote">2010/10/21 developer researcher <span dir="ltr">&lt;<a href="mailto:java.developer.researcher@gmail.com">java.developer.researcher@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<span style="color:rgb(0, 0, 153)">Hello Michael and Subhas, thanks for your answers.</span><br style="color:rgb(0, 0, 153)"><br style="color:rgb(0, 0, 153)"><span style="color:rgb(0, 0, 153)">Apparently the problem is due to permission. I am using the next configuration:</span><br style="color:rgb(0, 0, 153)">

<br style="color:rgb(0, 0, 153)"><span style="color:rgb(0, 0, 153)">&lt;security:identity authenticate-method=&quot;#{defaultAuthenticator.authenticate}&quot;/&gt;</span><br style="color:rgb(0, 0, 153)"><span style="color:rgb(0, 0, 153)">&lt;security:role-based-permission-resolver enable-role-based-authorization=&quot;true&quot;/&gt;</span><br style="color:rgb(0, 0, 153)">

<br style="color:rgb(0, 0, 153)"><span style="color:rgb(0, 0, 153)">I attached the class that use for my test, in this code not included code for authenticate. In that sense I have new questions:</span><br style="color:rgb(0, 0, 153)">

<br style="color:rgb(0, 0, 153)"><span style="color:rgb(0, 0, 153)">1º What is the minimal configuration of Guvnor for use the Knowledge Agent?</span><br style="color:rgb(0, 0, 153)"><br style="color:rgb(0, 0, 153)">
<span style="color:rgb(0, 0, 153)">2º What code should be included for authentication?</span><br style="color:rgb(0, 0, 153)"><br style="color:rgb(0, 0, 153)"><span style="color:rgb(0, 0, 153)">Thanks and regards,</span><br>

<br><div class="gmail_quote">2010/10/20 Subhas <span dir="ltr">&lt;<a href="mailto:subhas.sing@gmail.com" target="_blank">subhas.sing@gmail.com</a>&gt;</span><div><div></div><div class="h5"><br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">

Give some more details like code and jars in build path. I use KnowledgeBase and working fine for me.<br><br>Thanks,<br><font color="#888888">Subhas</font><div><div></div><div><br><br><div class="gmail_quote">On Wed, Oct 20, 2010 at 12:54 PM, java.developer.researcher <span dir="ltr">&lt;<a href="mailto:java.developer.researcher@gmail.com" target="_blank">java.developer.researcher@gmail.com</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"><div><div></div><div><br>
Hello,<br>
<br>
I am trying of integrate Drools Guvnor with an java web application. I am<br>
using KnowledgeAgent, but occurs the next exception when execute the code:<br>
<br>
java.lang.RuntimeException: java.io.IOException: Server returned HTTP<br>
response code: 401 for URL:<br>
<a href="http://localhost:8383/drools-guvnor/org.drools.guvnor.Guvnor/package/org.examples/org.examples" target="_blank">http://localhost:8383/drools-guvnor/org.drools.guvnor.Guvnor/package/org.examples/org.examples</a><br>



        at<br>
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:559)<br>
        at<br>
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)<br>
        at<br>
org.examples.test.TestKnowledgeAgent.getKnowledgeBase(TestKnowledgeAgent.java:63)<br>
        at<br>
org.examples.test.TestKnowledgeAgent.main(TestKnowledgeAgent.java:28)<br>
Caused by: java.io.IOException: Server returned HTTP response code: 401 for<br>
URL:<br>
<a href="http://localhost:8383/drools-guvnor/org.drools.guvnor.Guvnor/package/org.examples/org.examples" target="_blank">http://localhost:8383/drools-guvnor/org.drools.guvnor.Guvnor/package/org.examples/org.examples</a><br>



        at<br>
sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)<br>
        at<br>
org.drools.io.impl.UrlResource.getInputStream(UrlResource.java:76)<br>
        at<br>
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:512)<br>
        ... 3 more<br>
Exception in thread &quot;main&quot; java.lang.NullPointerException<br>
        at<br>
org.examples.test.TestKnowledgeAgent.main(TestKnowledgeAgent.java:37)<br>
<br>
     What is the cause of this exception? How can I solved it?<br>
<br>
Any help is welcome.<br>
<br>
</div></div>Regards,<br>
<font color="#888888">--<br>
View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/Use-Knowledge-Agent-tp1741354p1741354.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/Use-Knowledge-Agent-tp1741354p1741354.html</a><br>



Sent from the Drools - User mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</font></blockquote></div><br>
</div></div><br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div></div></div><br><div style="display:inline"></div>
<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br></div>