You can include username/pwd in your ChangeSet, see below:
<add>
<resource
source='http://localhost:8081/jboss-brms/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST'
type='PKG' basicAuthentication='enabled' username='admin'
password='pwd'/>
</add>
Details can be found from
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-compiler...
Cheers,
Jervis
mmquelo massi wrote:
Hi everybody,
I am using Guvnor 501M2 on JBoss standalone.
I am accessing the PKG resource from my java code as follows:
ResourceBundle resourceBundle =
ResourceBundle.getBundle("guvnoragent"); Properties props = new
Properties();
props.setProperty("drools.resource.scanner.interval",
resourceBundle.getString("poll")); ResourceChangeScanner service =
ResourceFactory.getResourceChangeScannerService();
ResourceChangeScannerConfiguration rconf =
service.newResourceChangeScannerConfiguration(props);
service.configure( rconf ); //Agent Conf
KnowledgeAgentConfiguration aconf =
KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
aconf.setProperty("drools.agent.scanDirectories",
resourceBundle.getString("scanDir"));
aconf.setProperty("drools.agent.scanResources",
resourceBundle.getString("scanRsc")); BufferedReader bfr=null; try
{ bfr = new BufferedReader(new FileReader(new
File("......Changeset.xml"))); } catch (Exception e) { ... }
//Agent configurato e con Packages guvnor aggiunti KnowledgeAgent
kagent = KnowledgeAgentFactory.newKnowledgeAgent("AgentPOC",
aconf); Resource csReader =
ResourceFactory.newReaderResource(bfr);
kagent.applyChangeSet(csReader);<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Here I get the following exception:
*Caused by: java.io.IOException: Server returned HTTP response
code: 401 for URL:
http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/Test...
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1187)
at org.drools.io.impl.UrlResource.grabStream(UrlResource.java:194)
at
org.drools.io.impl.UrlResource.getInputStream(UrlResource.java:130)
at
org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(KnowledgeAgentImpl.java:574)
... 7 more [2010:06:160 19:06:671:debug] KnowledgeAgent obtaining
pkg resource=[UrlResource
path='http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/Test/LATEST']
[2010:06:160 19:06:671:exception] java.lang.RuntimeException:
KnowledgeAgent exception while trying to deserialize
KnowledgeDefinitionsPackage at
org.drools.agent.impl.KnowledgeAgentImpl.addResourcesToKnowledgeBase(KnowledgeAgentImpl.java:829)
at
org.drools.agent.impl.KnowledgeAgentImpl.rebuildResources(KnowledgeAgentImpl.java:627)
at
org.drools.agent.impl.KnowledgeAgentImpl.buildKnowledgeBase(KnowledgeAgentImpl.java:513)
at
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:145)
at
org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:130)
at
com.reply.alitalia.mm.poc.engine.RuleService.exeRules(RuleService.java:74)
at Main.main(Main.java:113)
*This is why the server is asking Java the JBoss credentials!!!*
How can I pass them?
Should I define them in the changeset.xml?
If it is so where can I fine the XSD file ???? I guess there is a tag
or an attribute like "password" or something
that will contain date that the Agent has to send to the server....
Should I remove the password check from JBoss?
Please let me know.
As far as I know there are other people on the IRC CHAT with the same
issue.
Thank you 4 any help u can give me.
Bye,
Massi.
------------------------------------------------------------------------
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users