hi,
I was recently trying to create a kbase using UrlResource instead of using
changeset.xml. So, I wrote the following code :
KnowledgeAgentConfiguration kaconf =
KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
kaconf.setProperty( "drools.agent.scanDirectories",
"false" );
KnowledgeAgent kagent =
KnowledgeAgentFactory.newKnowledgeAgent( "test
agent", kaconf );
UrlResource urlResource = (UrlResource)
ResourceFactory.newUrlResource("http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/Goal%20Creation%20Charges/LATEST/ChangeSet.xml");
urlResource.setResourceType(ResourceType.PKG);
urlResource.setBasicAuthentication("enabled");
urlResource.setUsername("admin");
urlResource.setPassword("admin");
kagent.applyChangeSet(urlResource);
kbase=kagent.getKnowledgeBase();
But, to my disappointment this code kept giving me the following error :
" Server returned HTTP response code: 401 for URL:
http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/Goal%20Creation%20Charges/LATEST
"
The changeset which i was using with the follwing code is attached for
reference :
kagent.applyChangeSet(ResourceFactor.newClassPathResource("drools/resource/changeset.xml"));
changeset.xml
<http://drools.46999.n3.nabble.com/file/n4023490/changeset.xml>
Regards,
Abhinay
--
View this message in context:
http://drools.46999.n3.nabble.com/Problem-migrating-from-newClassPathResource-to-newUrlResource-tp4023490.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users