I have created an issue https://issues.apache.org/jira/browse/SM-2342 to
provide a working sample for stateful ksession. I'll try to find in
Drools community the answer for this problem.

Best regards
Krzysztof

On 09.07.2014 23:27, Krzysztof Sobkowiak wrote:
> Hi
>
> I can reproduce the problem too. I don't know Drools very well. I
> couldn't find any example for Camel and Drools with stateful ksession.
> If you use as stateful kbase you have probably to define a
> persistence, but I'm not sure.
>
> After the person is processed by a rule engine it should have a drink
> set and the NPE should not happen in the expression
> ${body.getDrink.getDescription}. I have initialized Drink.WATER as
> default value in Person and this problem does not occur, but WATER is
> always set. It looks like the Person is not changed by the rule
> engine, or it is changed, but the changes are not visible in the Camel
> route (outside the Drools context). 
>
> Best regards
> Krzysztof
>
>
>
> On 09.07.2014 02:32, mgingell wrote:
>> Hi, 
>> I am trying to get a stateful drools session to work, based on the current
>> servicemix 5.1.0 camel-drools example. Building and deploying the bundles /
>> features work fine. If I change the spring or blueprint to try to create a
>> stateful instance, I get a NPE exception thrown when I attempt to deploy the
>> bundle. 
>>
>> Is this broken, or am I missing some other configuration? 
>>
>> spring.xml snippet - changed type="stateless" to type="stateful" 
>>
>>     <drools:ksession id="ksession1" type="stateful" name="ksession1"
>> kbase="kbase1" node="node1">
>>         
>>         <drools:configuration />
>>     </drools:ksession>
>>
>> Log output (info level): 
>> 21:18:58,470 | ERROR | imer://testRoute | DefaultErrorHandler | 124 -
>> org.apache.camel.camel-core - 2.13.1 | Failed delivery for (MessageId:
>> ID-mike-MacBook-54663-1404863002659-3-3025 on ExchangeId:
>> ID-mike-MacBook-54663-1404863002659-3-3026). Exhausted after delivery
>> attempt: 1 caught:
>> org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to
>> invoke method: .getDrink.getDescription on null due to:
>> java.lang.NullPointerException Message History
>> ---------------------------------------------------------------------------------------------------------------------------------------
>


-- 
Krzysztof Sobkowiak

JEE & OSS Architect | Senior Solution Architect @ Capgemini | Committer
@ ASF
Capgemini <http://www.pl.capgemini.com/> | Software Solutions Center
<http://www.pl.capgemini-sdm.com/> | Wroclaw
e-mail: [email protected] <mailto:[email protected]> |
Twitter: @KSobkowiak
Calendar: http://goo.gl/yvsebC

Reply via email to