JBoss Community

Re: How to get a package from Guvnor and start it

created by doboss in jBPM - View the full discussion

Okay, I am doing something wrong. :)   If I use the following code the authentication works, and it looks like it is downloading the binary package:

 

 

private static KnowledgeBase readKnowledgeBase() throws Exception {
        KnowledgeAgentConfiguration aconf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
 
        KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("test", aconf);
 
        String url = "http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST/";
 
        UrlResource resource = (UrlResource) ResourceFactory.newUrlResource(url);
        resource.setBasicAuthentication("enabled");
        resource.setUsername("guest");
        resource.setPassword("guest");        
        kagent.applyChangeSet(resource);
 
        return kagent.getKnowledgeBase();
    }

 

I figured this out by sending it through the eclipse tcp/ip monitor proxy. And it looks like it is indeed getting the binary package. But I think the code is expecting a changeset, not a binary package. (Which is why I get the "ERROR drools.xml.ExtensibleXmlParser.fatalError  - (null: 1, 1): Content is not allowed in prolog." - because it's expecting a changeset.xml, not the binary package.)

 

Which makes since as I am calling: kagent.applyChangeSet(resource);

 

So I think I'm almost there, I have to do something with the binary package, not try to apply it as a changeset...

Reply to this message by going to Community

Start a new discussion in jBPM at Community