Why not just ensure the model JARs uploaded to Guvnor are also on the KA's classpath?<br><br>This of course assumes you have the JARs in the first place, and they are not added remotely to Guvnor by another user, in a different location.<br>
<br>If this is however the case then you'd have the same problem whether using KA or not; i.e. needing JARs you don't have.<br><br><div class="gmail_quote">2012/1/25 Voradov <span dir="ltr"><<a href="mailto:madalin100884@yahoo.com">madalin100884@yahoo.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font:inherit" valign="top">Hi, exactly, this is the issue:<br>
I have a remote Guvnor server, not a local one and I had tried to set up a changeset.xml with PKG type links to the remote contained packages, in order to load in a local running agent those packages.<br><br>But it was not enough.<br>
When loading the packages, it does not know to load also the jar files, so because of this, somehow the jars should be added in the classpath. At this moment i ended by filling the classpath of my local running eclipse with all the local jars in order to create a running knowledge agent.<br>
<br>I can use REST protocol to get all packages, and from there to obtain the URL of the contained jars from each package and to programmatically download locally the jars in a folder and after that, for each of them to do something like this <br>
<table><tbody><tr><td><code></code><br></td><td><code>URL jarURL = </code><code>this</code><code>.getClass().getResource(SomeExternalJar.jar);</code></td></tr></tbody></table><br><code>URLClassLoader ucl = </code><code>new</code> <code>URLClassLoader(</code><code>new</code> <code>URL[]{jarURL}, </code><code>this</code><code>.getClass().getClassLoader());</code><br>
<br>But my question is if I cannot somehow avoid this and make it easier. <br><br>So, the main question is: when having a remote guvnor having set packages with rules and fact models, how can I create a local knowledge agent and to fill it with some required fact models and rules from that remote guvnor server? <br>
<br>At the first glace, I had expected when filling the knowledge agent with a remote package, along with the test cases and rules, also the jar files to be loaded,
but it seems not.<br><br>At this moment I cannot see any other option, than this one. I had read the entyre documentation, but i did not find something like this explained. Could you help me? Do you have an idea about how to do this more easier than presented above?<br>
<span style="color:rgb(0,0,255);font-family:arial black"><font><span style="color:rgb(0,0,0)"><br>Madalin Gavrilescu</span></font><br></span><br><br>--- On <b>Wed, 1/25/12, manstis [via Drools] <i><<a href="http://user/SendEmail.jtp?type=node&node=3687625&i=0" rel="nofollow" link="external" target="_blank">[hidden email]</a>></i></b> wrote:<br>
<blockquote style="border-left:2px solid rgb(16,16,255);margin-left:5px;padding-left:5px"><br>From: manstis [via Drools] <<a href="http://user/SendEmail.jtp?type=node&node=3687625&i=1" rel="nofollow" link="external" target="_blank">[hidden email]</a>><br>
Subject: Re: [rules-users] unable to update the changes (guvnor rules) to application using changeset<br>To: "Voradov" <<a href="http://user/SendEmail.jtp?type=node&node=3687625&i=2" rel="nofollow" link="external" target="_blank">[hidden email]</a>><br>
Date: Wednesday, January 25, 2012, 2:48 PM<br><br><div><div class="im">
        What is it you are trying to achieve?<br><br>If the change set contains DRL items the Classes used therein will need to be on your client-side classpath (as explained in Esteban's blog). If you want to use rules authored in Guvnor and Types declared in (or uploaded to) Guvnor you should use the PKG resource type in your change-set and build the package in Guvnor. I don't believe you should need to use a custom class loader *unless* you really want only the DRL in your change-set but your model classes only in Guvnor.<br>
<br></div><div><div><div class="h5">On 25 January 2012 12:27, Voradov <span dir="ltr"><<a rel="nofollow" link="external">[hidden email]</a>></span> wrote:<br></div></div><blockquote style="border-left:2px solid #cccccc;padding:0 1em">
<div><div class="h5">
Hi, Esteban, Hi srinivasasanda.<br>
<br>
My opinion regarding the issue posted by srinivasasanda is the following:<br>
<br>
Having the changeset filled with DRL's taken from local jBoss application<br>
and using it in a java local running knowledge agent which has not added<br>
into the classpath the fact models will fail, of course with that<br>
/"java.lang.RuntimeException: KnowledgeAgent exception while trying to<br>
deserialize KnowledgeDefinitionsPackage"./<br>
<br>
On the other hand, when having changeset.xml set as:<br>
/<add><br>
<resource source='file:D:\rulemaster.drl' type='DRL' /><br>
</add>/<br>
is working because it seems that the fact models used in defining those<br>
packages are in the classpath.<br>
<br>
REST protocol is used correctly in the changeset.xml.<br>
<br>
The problem with remotely loading pkg\drl files using REST is that you<br>
should somehow specify a custom classloader, like this:<br>
<br>
/KnowledgeBaseConfiguration kbaseConfig =<br>
KnowledgeBaseFactory.newKnowledgeBaseConfiguration(null,<br>
*customClassLoader*);<br>
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(kbaseConfig);<br>
//kbase with custom classloader<br>
KnowledgeAgentConfiguration aconf =<br>
KnowledgeAgentFactory.newKnowledgeAgentConfiguration();<br>
aconf.setProperty("drools.agent.useKBaseClassLoaderForCompiling", "true");<br>
KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("test<br>
agent", kbase, aconf);<br>
kagent.applyChangeSet(ResourceFactory.newFileResource(changeSetFile));/<br>
<br>
My question is: is there any possibility to create the classloader identical<br>
to the remote classloader used by guvnor? if yes, could you please show us<br>
exactly how to load remotelly from guvnor?<br>
<br>
Here, at<br>
<a rel="nofollow" href="http://ilesteban.wordpress.com/2010/06/22/knowledge-agent-custom-class-loaders/" link="external" target="_blank">http://ilesteban.wordpress.com/2010/06/22/knowledge-agent-custom-class-loaders/</a><br>
<a rel="nofollow" href="http://ilesteban.wordpress.com/2010/06/22/knowledge-agent-custom-class-loaders/" link="external" target="_blank">http://ilesteban.wordpress.com/2010/06/22/knowledge-agent-custom-class-loaders/</a><br>
there is described how to create a custom classloader, but it is not<br>
specified how to create it based on the Guvnor's jar files already existing<br>
there.<br>
<span><font color="#888888"><br>
<br>
--<br>
View this message in context: <a rel="nofollow" href="http://drools.46999.n3.nabble.com/unable-to-update-the-changes-guvnor-rules-to-application-using-changeset-tp3652824p3687543.html" link="external" target="_blank">http://drools.46999.n3.nabble.com/unable-to-update-the-changes-guvnor-rules-to-application-using-changeset-tp3652824p3687543.html</a><br>
</font></span></div></div><div><div><div><div class="h5">Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
</div></div><a rel="nofollow" link="external">[hidden email]</a><br>
<a rel="nofollow" href="https://lists.jboss.org/mailman/listinfo/rules-users" link="external" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></blockquote></div><br>
<br>_______________________________________________
<br>rules-users mailing list
<br><a rel="nofollow" link="external">[hidden email]</a>
<br><a rel="nofollow" href="https://lists.jboss.org/mailman/listinfo/rules-users" link="external" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
        
        <br>
        <br>
        <hr color="#cccccc" size="1" noshade>
        <div style="color:#444;font:12px tahoma,geneva,helvetica,arial,sans-serif">
                <div style="font-weight:bold">If you reply to this email, your message will be added to the discussion below:</div>
                <a rel="nofollow" href="http://drools.46999.n3.nabble.com/unable-to-update-the-changes-guvnor-rules-to-application-using-changeset-tp3652824p3687590.html" link="external" target="_blank">http://drools.46999.n3.nabble.com/unable-to-update-the-changes-guvnor-rules-to-application-using-changeset-tp3652824p3687590.html</a>
        </div>
        <div style="color:#666;font:11px tahoma,geneva,helvetica,arial,sans-serif;margin-top:.4em;line-height:1.5em">
                
                To unsubscribe from unable to update the changes (guvnor rules) to application using changeset, <a rel="nofollow" link="external">click here</a>.<br>
                <a rel="nofollow" href="http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.InstantMailNamespace&breadcrumbs=instant+emails%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" style="font:9px serif" link="external" target="_blank">NAML</a>
        </div></div></blockquote></td></tr></tbody></table>
        
<br><hr align="left" width="300">
View this message in context: <a href="http://drools.46999.n3.nabble.com/unable-to-update-the-changes-guvnor-rules-to-application-using-changeset-tp3652824p3687625.html" target="_blank">Re: [rules-users] unable to update the changes (guvnor rules) to application using changeset</a><div class="HOEnZb">
<div class="h5"><br>
Sent from the <a href="http://drools.46999.n3.nabble.com/Drools-User-forum-f47000.html" target="_blank">Drools: User forum mailing list archive</a> at Nabble.com.<br></div></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>