[rules-users] Drools server link to Guvnor repository

Ross H ross.hall at suncorp.com.au
Tue Mar 15 17:08:01 EDT 2011


Try using a changeset with file:path-to-your-changeset.xml rather than
classpath:changeset.xml


SebRR wrote:
> 
> Yes I am using 5.1.1 and if I go to the latest xsd
> (drools-spring-1.2.0.xsd), there is no attribute called 'knowledgeAgent' .
> 
> On Tue, Mar 15, 2011 at 2:09 PM, Esteban Aliverti <
> esteban.aliverti at gmail.com> wrote:
> 
>> I think 5.1.1 should be fine. Which version are you using?
>>
>> Best,
>>
>>
>> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
>>
>> Esteban Aliverti
>> - Developer @ http://www.plugtree.com
>> - Blog @ http://ilesteban.wordpress.com
>>
>>
>> On Tue, Mar 15, 2011 at 9:24 AM, Sébastien Raickman <
>> sebastien.raickman at gmail.com> wrote:
>>
>>> Hi Esteban,
>>>
>>> yes my change set is linked to this resource:
>>>
>>> *resource source="
>>> http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/com.mypackage/MySnapshot
>>> *
>>>
>>> I have tried out the 2nd solution but JBoss says --> kAttribute
>>> 'knowledgeAgent' is not allowed to appear in element 'drools:ksession'
>>>
>>> Which version of Drools should I use for this?
>>>
>>> Thanks
>>>
>>>
>>> On Tue, Mar 15, 2011 at 12:59 PM, Esteban Aliverti <
>>> esteban.aliverti at gmail.com> wrote:
>>>
>>>> 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="false"), so
>>>> the defined ksession will remain attached to an empty kbase.
>>>> I can think in 2 solutions:
>>>>    1.- Remove the ksession definition from the spring context file and
>>>> create a new ksession using the kagent:
>>>> kagent.newStatelessKnowledgeSession();
>>>>    2.- Configure ksession's kagent from spring (this only works for
>>>> stateless ksessions): >> knowledgeAgent="kagent1">
>>>>
>>>> By the way, the subject of this email says you re linking drools-server
>>>> to Guvnor, but your changeset is not using any Guvnor's URL. Are you
>>>> manually downloading the changeset.xml and putting it in your
>>>> classpath?
>>>>
>>>> Best Regards,
>>>>
>>>> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
>>>>
>>>> Esteban Aliverti
>>>> - Developer @ http://www.plugtree.com
>>>> - Blog @ http://ilesteban.wordpress.com
>>>>
>>>>
>>>> 2011/3/15 Sébastien Raickman &lt;sebastien.raickman at gmail.com&gt;
>>>>
>>>>> Hi all,
>>>>>
>>>>> I would like to connect to drools-server with HTTPClient with the
>>>>> following
>>>>> config:
>>>>>
>>>>> >>>       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>       xmlns:drools="http://drools.org/schema/drools-spring"
>>>>>       xsi:schemaLocation="http://www.springframework.org/schema/beans
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>>>>>                           http://drools.org/schema/drools-spring
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> 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">&nbsp;
>>>>> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
>>>>> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
>>>>> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
>>>>> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
>>>>> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
>>>>> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> 
>>>>>
>>>>>
>>>>> where my changeset.xml is adding a snapshot deployed with Guvnor.
>>>>>
>>>>> But I am not able to trig the rule with the following client:
>>>>>
>>>>> BatchExecutionCommandImpl command = new BatchExecutionCommandImpl();
>>>>> command.setLookup("ksession1");
>>>>> InsertObjectCommand insertObjectCommand = new
>>>>> InsertObjectCommand("TEST");
>>>>> FireAllRulesCommand fireAllRulesCommand = new FireAllRulesCommand();
>>>>> command.getCommands().add(insertObjectCommand);
>>>>> command.getCommands().add(fireAllRulesCommand);
>>>>>
>>>>> String xml =
>>>>> BatchExecutionHelper.newXStreamMarshaller().toXML(command);
>>>>>
>>>>>
>>>>> HttpClient httpClient = new HttpClient();
>>>>> httpClient.getHostConfiguration().setHost("host", 8080);
>>>>>
>>>>> PostMethod postMethod = new
>>>>> PostMethod("/drools-5.1.1-server/kservice/rest/execute");
>>>>> postMethod.setRequestEntity(new StringRequestEntity(xml, null, null));
>>>>>
>>>>>
>>>>> try {
>>>>>
>>>>>        httpClient.executeMethod(postMethod);
>>>>>        int code = postMethod.getStatusCode();
>>>>>        System.out.println(code);
>>>>>        String rep = postMethod.getResponseBodyAsString();
>>>>>        System.out.println(rep);
>>>>>
>>>>> } catch(Exception e) {...}
>>>>>
>>>>> Do someone have any idea how to achieve this?
>>>>>
>>>>> Thanks
>>>>>
>>>>> Sebastien
>>>>>
>>>>> _______________________________________________
>>>>> rules-users mailing list
>>>>> rules-users at lists.jboss.org
>>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>>>
>>>>>
>>>>
>>>
>>
> 
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 


--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-server-link-to-Guvnor-repository-tp2682663p2683847.html
Sent from the Drools - User mailing list archive at Nabble.com.




More information about the rules-users mailing list