[rules-users] Multiple Object Referencing problem

Esteban Aliverti esteban.aliverti at gmail.com
Tue Jun 8 08:25:47 EDT 2010


Look at the line 58 of RulesTest class and you will find the problem. Try to
always analyse the stacktrace if there are no drools classes involved, then
it is not a Drools error. And remember, the debugger is your friend ;)

Best,

2010/6/7 David Sinclair <dsinclair at chariotsolutions.com>

> This has nothing to do with Drools. It looks like you are giving Writer bad
> input perhaps??
>
> Exception in thread "main" *java.lang.NullPointerException*
>
>       at java.io.Writer.write(Unknown Source)
>
>       at com.org.RulesTest.main(*RulesTest.java:58*)
>
>
>
>
> 2010/6/7 Fnu Mahalakshmi <FMahalakshmi at nyx.com>
>
>>  Hi,
>>
>>
>>
>> I am trying out this example from the book :
>>
>> public class Room {
>>
>>     private String name
>>
>>     // getter and setter methods here
>>
>> }
>>
>> public classs Sprinkler {
>>
>>     private Room room;
>>
>>     private boolean on;
>>
>>     // getter and setter methods here
>>
>> }
>>
>> public class Fire {
>>
>>     private Room room;
>>
>>     // getter and setter methods here
>>
>> }
>>
>>
>>
>> I load 2 input files: 1. with data of fire and Room { f1, r1;f2, r2}
>>
>>                            2. with data of sprinkler and Room { “ “, r1; “
>> “ , r2}
>>
>>
>>
>> I am writing rule “ if fire exists in room start sprinkler” { so if f1 and
>> r1 in this case: I should get s1, r1 }
>>
>> when
>>
>>     Fire($room : room)
>>
>>     $sprinkler : Sprinkler( room == $room, modified == false )
>>
>> Then
>>
>>     $sprinkler.setmodified(true);
>>
>>     modify( $sprinkler ) { setSprinkle( “s1” ) };
>>
>> end
>>
>>
>>
>> But this gives me error:
>>
>> Exception in thread "main" *java.lang.NullPointerException*
>>
>>       at java.io.Writer.write(Unknown Source)
>>
>>       at com.org.RulesTest.main(*RulesTest.java:58*)
>>
>>
>>
>> From what I observed this rule is not getting fired at all.
>>
>> I want this rule to be fired on the data in my second input file.
>>
>> The rules for my first input file get executed properly.
>>
>>
>>
>> Can any1 tell me where I am going wrong??
>>
>> Is there any way in which we can use the modified data { after rules are
>> fired on the first input data and it is  modified}to fire another set of
>> rules on the same input depending on the next input file???
>>
>>
>>
>> Thank you.
>>
>>
>>
>> -M
>>
>> ------------------------------
>>
>> *Please consider the environment before printing this email.*
>>
>> *Visit our website at http://www.nyse.com
>> *****************************************************************************
>>
>> Note: The information contained in this message and any attachment to it
>> is privileged, confidential and protected from disclosure. If the reader of
>> this message is not the intended recipient, or an employee or agent
>> responsible for delivering this message to the intended recipient, you are
>> hereby notified that any dissemination, distribution or copying of this
>> communication is strictly prohibited. If you have received this
>> communication in error, please notify the sender immediately by replying to
>> the message, and please delete it from your system. Thank you. NYSE
>> Euronext. *
>>
>>
>> _______________________________________________
>> 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
>
>


-- 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Esteban Aliverti
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100608/b5cfc184/attachment.html 


More information about the rules-users mailing list