You need to create a change-set containing basic authentication parameters. This change-set could then point to the change-set hosted in guvnor (or any of its resources). Here is an example of a change-set using basic authentication pointing to a package resource:<div>
<br></div><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><change-set> <br> <add> <br> <resource source='<a href="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST">http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST</a>' <br>
type='PKG' <b>basicAuthentication="enabled" username="admin" password="admin" </b><br>/> <br> </add> <br></change-set><div><br clear="all">Best,</div><div><br>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br>
<br>Esteban Aliverti<br>- Developer @ <a href="http://www.plugtree.com" target="_blank">http://www.plugtree.com </a><br>- Blog @ <a href="http://ilesteban.wordpress.com" target="_blank">http://ilesteban.wordpress.com</a><br>
<br><br><div class="gmail_quote">2010/10/27 developer researcher <span dir="ltr"><<a href="mailto:java.developer.researcher@gmail.com">java.developer.researcher@gmail.com</a>></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,</span><br style="color:rgb(0, 0, 153)"><br style="color:rgb(0, 0, 153)"><span style="color:rgb(0, 0, 153)"> I am trying of </span><span style="color:rgb(0, 0, 153)" lang="en"><span title="">follow the instructions of: </span></span><span style="color:rgb(0, 0, 153)">1.4.8.1. The Knowledge Agent in '<a href="http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-guvnor/html_single/index.html" target="_blank">http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-guvnor/html_single/index.html</a>'</span><br style="color:rgb(0, 0, 153)">
<br style="color:rgb(0, 0, 153)"><span style="color:rgb(0, 0, 153)"> I see that after of create the snapshots are generated several URLs:</span><br style="color:rgb(0, 0, 153)"><br style="color:rgb(0, 0, 153)">
<span style="color:rgb(0, 0, 153)">- URL for package documentation</span><br style="color:rgb(0, 0, 153)"><span style="color:rgb(0, 0, 153)">- URL for package source</span><br style="color:rgb(0, 0, 153)"><span style="color:rgb(0, 0, 153)">- URL for package binary</span><br style="color:rgb(0, 0, 153)">
<span style="color:rgb(0, 0, 153)">- URL for running tests</span><br style="color:rgb(0, 0, 153)"><span style="color:rgb(0, 0, 153)">- Change Set: '<a href="http://localhost:8383/drools-guvnor/org.drools.guvnor.Guvnor/package/org.examples/org.examples/ChangeSet.xml" target="_blank">http://localhost:8383/drools-guvnor/org.drools.guvnor.Guvnor/package/org.examples/org.examples/ChangeSet.xml</a>'</span><br style="color:rgb(0, 0, 153)">
<br style="color:rgb(0, 0, 153)"><span style="color:rgb(0, 0, 153)"> I need consume a rule from a java application. I can download the file 'ChangeSet.xml' using the credentials (user="admin" and password="") but I get a HTTP 401 error </span><span style="color:rgb(0, 0, 153)" lang="en"><span title="">even when I use the same credentials in my code</span></span><span style="color:rgb(0, 0, 153)">. I attached the code and the exception.</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/26 developer researcher <span dir="ltr"><<a href="mailto:java.developer.researcher@gmail.com" target="_blank">java.developer.researcher@gmail.com</a>></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"><span style="color:rgb(0, 0, 153)"> </span><span style="color:rgb(0, 0, 153)" lang="en"><span title="">Hi all,<br>
<br>I am using Drools Guvnor </span></span><span style="color:rgb(0, 0, 153)" lang="en"><span title="">as follows:</span></span><br style="color:rgb(0, 0, 153)">
<br style="color:rgb(0, 0, 153)"><span style="color:rgb(0, 0, 153)">1º Security configuration:</span><div><br style="color:rgb(0, 0, 153)"><span style="color:rgb(0, 0, 153)"><security:identity authenticate-method="#{defaultAuthenticator.authenticate}"/></span><br style="color:rgb(0, 0, 153)">
</div><span style="color:rgb(0, 0, 153)"><div><security:role-based-permission-resolver enable-role-based-authorization="true"/><br><br></div>2º User permission: an user as administrator with permissions of:<br>
- Analyst for 'category=examples' <br>
- package.developer for 'package=org.examples'<br><br></span><span style="color:rgb(0, 0, 153)" lang="en"><span title="">What additional configuration is needed to consume a rules from an application using a</span></span> '<span style="color:rgb(0, 0, 153)">Knowledge Agent'?</span><br style="color:rgb(0, 0, 153)">
<br style="color:rgb(0, 0, 153)"><span style="color:rgb(0, 0, 153)" lang="en"><span style="background-color:rgb(230, 236, 249)" title="">Someone has an example or tutorial to use of 'Knowledge Agent'?</span></span><br style="color:rgb(0, 0, 153)">
<br style="color:rgb(0, 0, 153)"><span style="color:rgb(0, 0, 153)" lang="en"><span title="">I hope someone can help me in this issue that is critical to use drools in a real project. I </span></span><span style="color:rgb(0, 0, 153)" lang="en"><span title="">attached the related files</span></span><span style="color:rgb(0, 0, 153)">.</span><br>
<br><span style="color:rgb(0, 0, 153)">Thanks and regards,</span><br><br><div class="gmail_quote">2010/10/22 developer researcher <span dir="ltr"><<a href="mailto:java.developer.researcher@gmail.com" target="_blank">java.developer.researcher@gmail.com</a>></span><div>
<div></div><div><br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex"><span style="color:rgb(0, 0, 153)">Hello Michael,</span><br style="color:rgb(0, 0, 153)">
<br style="color:rgb(0, 0, 153)"><span style="color:rgb(0, 0, 153)">I included the code for authentication but occurs a new exception. I think that is by configuration of Guvnor.</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 exception and the log of guvnor. </span><span style="color:rgb(0, 0, 153)" lang="en"><span title="">I hope you can help me.</span></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/21 Michael Anstis <span dir="ltr"><<a href="mailto:michael.anstis@gmail.com" target="_blank">michael.anstis@gmail.com</a>></span><div>
<div></div><div><br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">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 face="'courier new', monospace"><snip></font></div>
<div><font face="'courier new', monospace"> builder.add(ResourceFactory.newUrlResource(url), ResourceType.PKG);</font></div><div><font face="'courier new', monospace"></snip></font></div>
<div><br></div><div><div><font face="'courier new', monospace"><snip></font></div><div><font face="'courier new', monospace"> UrlResource urlResource = </font><span style="font-family:'courier new',monospace">ResourceFactory.newUrlResource(url);</span></div>
<div><span style="font-family:'courier new',monospace"> urlResource.setBasicAuthentication("enabled");</span></div><div><span style="font-family:'courier new',monospace"> urlResource.setUsername("Smurf");</span></div>
<div><span style="font-family:'courier new',monospace"> urlResource.setPassword("Smurfy");</span></div><div><font face="'courier new', monospace"> builder.add(urlResource, ResourceType.PKG);</font></div>
<div><font face="'courier new', monospace"></snip></font></div><div><font face="'courier new', 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'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"><<a href="mailto:java.developer.researcher@gmail.com" target="_blank">java.developer.researcher@gmail.com</a>></span><div>
<div></div><div><br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);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)"><security:identity authenticate-method="#{defaultAuthenticator.authenticate}"/></span><br style="color:rgb(0, 0, 153)"><span style="color:rgb(0, 0, 153)"><security:role-based-permission-resolver enable-role-based-authorization="true"/></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"><<a href="mailto:subhas.sing@gmail.com" target="_blank">subhas.sing@gmail.com</a>></span><div><div></div><div><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"><<a href="mailto:java.developer.researcher@gmail.com" target="_blank">java.developer.researcher@gmail.com</a>></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 "main" 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" 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>
<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>
</blockquote></div></div></div><br><div style="display:inline"></div>
</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></div>