I suspect that the ksession defined in spring is created BEFORE the agent processes the resource. And even after the agent processes the resource, it will create a new kbase (because you are not using newInstance=&quot;false&quot;), so the defined ksession will remain attached to an empty kbase.<div>


I can think in 2 solutions:</div><div>   1.- Remove the ksession definition from the spring context file and create a new ksession using the kagent: kagent.newStatelessKnowledgeSession();</div><div>   2.- Configure ksession&#39;s kagent from spring (this only works for stateless ksessions): &lt;drools:ksession id=&quot;ksession&quot; type=&quot;stateless&quot; <meta http-equiv="content-type" content="text/html; charset=utf-8"><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; ">knowledgeAgent</span>=&quot;kagent1&quot;&gt;</div>

<div><br></div><div>By the way, the subject of this email says you re linking drools-server to Guvnor, but your changeset is not using any Guvnor&#39;s URL. Are you manually downloading the changeset.xml and putting it in your classpath?</div>

<div><br></div><div>Best Regards,<br clear="all">
<br>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br><br>Esteban Aliverti<br>- Developer @ <a href="http://www.plugtree.com" target="_blank">http://www.plugtree.com </a><br>- Blog @ <a href="http://ilesteban.wordpress.com" target="_blank">http://ilesteban.wordpress.com</a><br>



<br><br><div class="gmail_quote">2011/3/15 Sébastien Raickman <span dir="ltr">&lt;<a href="mailto:sebastien.raickman@gmail.com" target="_blank">sebastien.raickman@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div>Hi all,
<br><br>I would like to connect to drools-server with HTTPClient with the following
<br>config:
<br><br></div><pre>&lt;beans xmlns=&quot;<a href="http://www.springframework.org/schema/beans" target="_blank">http://www.springframework.org/schema/beans</a>&quot;<br>      xmlns:xsi=&quot;<a href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a>&quot;<br>



      xmlns:drools=&quot;<a href="http://drools.org/schema/drools-spring" target="_blank">http://drools.org/schema/drools-spring</a>&quot;<br>      xsi:schemaLocation=&quot;<a href="http://www.springframework.org/schema/beans" target="_blank">http://www.springframework.org/schema/beans</a><br>



<a href="http://www.springframework.org/schema/beans/spring-beans-2.0.xsd" target="_blank">http://www.springframework.org/schema/beans/spring-beans-2.0.xsd</a><br>                          <a href="http://drools.org/schema/drools-spring" target="_blank">http://drools.org/schema/drools-spring</a><br>



<a href="http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-container/drools-spring/src/main/resources/org/drools/container/spring/drools-spring-1.0.0.xsd" target="_blank">http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-container/drools-spring/src/main/resources/org/drools/container/spring/drools-spring-1.0.0.xsd</a>&quot;&gt;&lt;drools:execution-node id=&quot;node1&quot; /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;drools:kbase id=&quot;kbase1&quot; node=&quot;node1&quot;/&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; <br>



&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;drools:kagent id=&quot;kagent1&quot; kbase=&quot;kbase1&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;drools:resources&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;drools:resource type=&quot;CHANGE_SET&quot; source=&quot;classpath:changeset.xml&quot; /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/drools:resources&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; <br>



&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/drools:kagent&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; <br>&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;drools:ksession id=&quot;ksession1&quot; type=&quot;stateless&quot; kbase=&quot;kbase1&quot; node=&quot;node1&quot;/&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; <br>



&lt;/beans&gt;</pre><div><div></div><div><br>where my changeset.xml is adding a snapshot deployed with Guvnor.
<br><br>But I am not able to trig the rule with the following client:
<br><br>BatchExecutionCommandImpl command = new BatchExecutionCommandImpl();
<br>command.setLookup(&quot;ksession1&quot;);
<br>InsertObjectCommand insertObjectCommand = new InsertObjectCommand(&quot;TEST&quot;);
<br>FireAllRulesCommand fireAllRulesCommand = new FireAllRulesCommand();
<br>command.getCommands().add(insertObjectCommand);
<br>command.getCommands().add(fireAllRulesCommand);
<br><br>String xml = BatchExecutionHelper.newXStreamMarshaller().toXML(command);
<br><br>HttpClient httpClient = new HttpClient();
<br>httpClient.getHostConfiguration().setHost(&quot;host&quot;, 8080);
<br><br>PostMethod postMethod = new
<br>PostMethod(&quot;/drools-5.1.1-server/kservice/rest/execute&quot;);
<br>postMethod.setRequestEntity(new StringRequestEntity(xml, null, null));
<br><br><br>try {
<br><br>       httpClient.executeMethod(postMethod);
<br>       int code = postMethod.getStatusCode();
<br>       System.out.println(code);
<br>       String rep = postMethod.getResponseBodyAsString();
<br>       System.out.println(rep);
<br><br>} catch(Exception e) {...}
<br><br>Do someone have any idea how to achieve this?
<br><br>Thanks
<br><br>Sebastien
</div></div><br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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></div>