<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    How to get a package from Guvnor and start it
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="https://community.jboss.org/people/doboss">doboss</a> in <i>jBPM</i> - <a href="https://community.jboss.org/message/780206#780206">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Can anyone tell me how to get a process/package from Guvnor and run it from a java app using the demo setup?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I have installed jbpm via the JBPM 5.4 full installer. I have taken the ScriptTask.bpmn from jbpm-examples and successfully put it in the Guvnor. I have added a Model Pojo and was able to build the package inside the default package. I have even created a snapshot.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Guvnor lists these URLS:</p><table><tbody><tr><td align="right" style=";"><p class="gwt-Label" id="gwt-uid-398">URL for package documentation:</p></td><td style=";"><table cellpadding="0" cellspacing="0"><tbody><tr><td align="left" style=";"><p class="gwt-HTML"><a class="jive-link-external-small" href="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST/documentation.pdf" target="_blank">http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST/documentation.pdf</a></p></td><td align="left" style=";"><a href="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/clear.cache.gif"><span> http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/clear.cache.gif </span></a></td></tr></tbody></table></td></tr><tr><td align="right" style=";"><p class="gwt-Label" id="gwt-uid-399">URL for package source:</p></td><td style=";"><table cellpadding="0" cellspacing="0"><tbody><tr><td align="left" style=";"><p class="gwt-HTML"><a class="jive-link-external-small" href="http://localhost:8080/drools-guvnor/rest/packages/defaultPackage/source" target="_blank">http://localhost:8080/drools-guvnor/rest/packages/defaultPackage/source</a></p></td><td align="left" style=";"><a href="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/clear.cache.gif"><span> http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/clear.cache.gif </span></a></td></tr></tbody></table></td></tr><tr><td align="right" style=";"><p class="gwt-Label" id="gwt-uid-400">URL for package binary:</p></td><td style=";"><table cellpadding="0" cellspacing="0"><tbody><tr><td align="left" style=";"><p class="gwt-HTML"><a class="jive-link-external-small" href="http://localhost:8080/drools-guvnor/rest/packages/defaultPackage/binary" target="_blank">http://localhost:8080/drools-guvnor/rest/packages/defaultPackage/binary</a></p></td><td align="left" style=";"><a href="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/clear.cache.gif"><span> http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/clear.cache.gif </span></a></td></tr></tbody></table></td></tr><tr><td align="right" style=";"><p class="gwt-Label" id="gwt-uid-401">URL for running tests:</p></td><td style=";"><table cellpadding="0" cellspacing="0"><tbody><tr><td align="left" style=";"><p class="gwt-HTML"><a class="jive-link-external-small" href="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST/SCENARIOS" target="_blank">http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST/SCENARIOS</a></p></td><td align="left" style=";"><a href="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/clear.cache.gif"><span> http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/clear.cache.gif </span></a></td></tr></tbody></table></td></tr><tr><td align="right" style=";"><p class="gwt-Label" id="gwt-uid-402">Change Set:</p></td><td style=";"><table cellpadding="0" cellspacing="0"><tbody><tr><td align="left" style=";"><p class="gwt-HTML"><a class="jive-link-external-small" href="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST/ChangeSet.xml" target="_blank">http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST/ChangeSet.xml</a></p></td><td align="left" style=";"><a href="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/clear.cache.gif"><span> http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/clear.cache.gif </span></a></td></tr></tbody></table></td></tr><tr><td align="right" style=";"><p class="gwt-Label" id="gwt-uid-403">POJO Model:</p></td><td style=";"><table cellpadding="0" cellspacing="0"><tbody><tr><td align="left" style=";"><p class="gwt-HTML"><a class="jive-link-external-small" href="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST/MODEL" target="_blank">http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST/MODEL</a></p></td><td align="left" style=";"><p><a href="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/clear.cache.gif"><span> http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/clear.cache.gif </span></a></p></td></tr></tbody></table></td></tr></tbody></table><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Additionally it has this link <a class="jive-link-external-small" href="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST" target="_blank">Download binary package</a></p><p><span>Which is to: </span><a class="jive-link-external-small" href="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST" target="_blank">http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST</a></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Now I have my main java app:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span>&#160; package org.jbpm.examples.quickstarts;import java.util.HashMap;import java.util.Map;import org.drools.KnowledgeBase;import org.drools.agent.KnowledgeAgent;import org.drools.agent.KnowledgeAgentConfiguration;import org.drools.agent.KnowledgeAgentFactory;import org.drools.io.Resource;import org.drools.io.ResourceFactory;import org.drools.runtime.StatefulKnowledgeSession;public class HelloRunner {public static final void main(String[] args) {&#160;&#160;&#160;&#160;&#160;&#160;&#160; try {&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // load up the knowledge base&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; KnowledgeBase kbase = readKnowledgeBase();&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Map&amp;lt;String, Object&amp;gt; params = new HashMap&amp;lt;String, Object&amp;gt;();&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Person p = new Person("Krisv");&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; params.put("person", p);&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ksession.startProcess("com.sample.script", params);&#160;&#160;&#160;&#160;&#160;&#160;&#160; } catch (Throwable t) {&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; t.printStackTrace();&#160;&#160;&#160;&#160;&#160;&#160;&#160; }&#160;&#160;&#160; }&#160;&#160;&#160; private static KnowledgeBase readKnowledgeBase() throws Exception {&#160;&#160;&#160;&#160;&#160;&#160;&#160; KnowledgeAgentConfiguration aconf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();&#160;&#160;&#160;&#160;&#160;&#160;&#160; KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("testKAgent", aconf);&#160;&#160;&#160;&#160;&#160;&#160;&#160; String fileName = "</span><a class="jive-link-external-small" href="http://localhost:8080/drools-guvnor/rest/packages/defaultPackage/binary" target="_blank">http://localhost:8080/drools-guvnor/rest/packages/defaultPackage/binary</a><span>";&#160;&#160;&#160;&#160;&#160;&#160;&#160; Resource newUrlResource = ResourceFactory.newUrlResource(fileName);&#160;&#160;&#160;&#160;&#160;&#160;&#160; kagent.applyChangeSet(newUrlResource);&#160;&#160;&#160;&#160;&#160;&#160;&#160; return kagent.getKnowledgeBase();&#160;&#160;&#160; }}</span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><span>I have also tried the URL: </span><a class="jive-link-external-small" href="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST" target="_blank">http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST</a></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>But I keep getting this error:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code">java.lang.RuntimeException: Unable to parse ChangeSet
&#160;&#160;&#160; at org.drools.agent.impl.KnowledgeAgentImpl.getChangeSet(KnowledgeAgentImpl.java:454)
&#160;&#160;&#160; at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:184)
&#160;&#160;&#160; at org.jbpm.examples.quickstarts.HelloRunner.readKnowledgeBase(HelloRunner.java:52)
&#160;&#160;&#160; at org.jbpm.examples.quickstarts.HelloRunner.main(HelloRunner.java:30)
Caused by: java.io.IOException: Server returned HTTP response code: 401 for URL: http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/defaultPackage/LATEST
&#160;&#160;&#160; at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1615)
&#160;&#160;&#160; at org.drools.io.impl.UrlResource.grabStream(UrlResource.java:210)
&#160;&#160;&#160; at org.drools.io.impl.UrlResource.getInputStream(UrlResource.java:146)
&#160;&#160;&#160; at org.drools.io.impl.UrlResource.getReader(UrlResource.java:214)
&#160;&#160;&#160; at org.drools.agent.impl.KnowledgeAgentImpl.getChangeSet(KnowledgeAgentImpl.java:451)
&#160;&#160;&#160; ... 3 more
java.lang.RuntimeException: Unable to parse ChangeSet
&#160;&#160;&#160; at org.drools.agent.impl.KnowledgeAgentImpl.getChangeSet(KnowledgeAgentImpl.java:465)
&#160;&#160;&#160; at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:184)
&#160;&#160;&#160; at org.jbpm.examples.quickstarts.HelloRunner.readKnowledgeBase(HelloRunner.java:52)
&#160;&#160;&#160; at org.jbpm.examples.quickstarts.HelloRunner.main(HelloRunner.java:30)
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I've read various posts about removing authentication and/or putting in the username/password.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I am running the demo stuff, so my understanding is there is no authentication.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>So how do I specify a username/password?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I've read something about putting the password in a changeset.xml, but haven't figured out how to do that either...</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Thanks!</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/780206#780206">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in jBPM at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>