<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><DIV>Hi,</DIV>
<DIV> </DIV>
<DIV>The following problem encountered:</DIV>
<DIV> </DIV>
<DIV>I have a rule defintion :</DIV>
<DIV> </DIV>
<DIV>----------------------------------------------dpd.drl</DIV>
<DIV>package ruletest;</DIV>
<DIV>import ruletest.IndividualNok;</DIV>
<DIV><BR>rule Female_NOK_sex_401<BR> //when (IndividualNok(nokRelationship==401) || IndividualNok(nokRelationship==402))<BR> when (IndividualNok(nokRelationship==401) || IndividualNok(nokRelationship==402) || IndividualNok(nokRelationship==403))<BR> then <BR> System.out.println("abc");<BR> end</DIV>
<DIV>------------------------------------------------</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>When I tried the commented out LSH, it works, however, when i add one more expression to it , it fails with the following exceptions:</DIV>
<DIV> </DIV>
<DIV>Exception in thread "main" java.lang.NullPointerException<BR> at org.drools.base.extractors.BaseObjectClassFieldExtractor.getLongValue(BaseObjectClassFieldExtractor.java:103)<BR> at org.drools.base.ClassFieldExtractor.getLongValue(ClassFieldExtractor.java:144)<BR> at org.drools.reteoo.CompositeObjectSinkAdapter$HashKey.setValue(CompositeObjectSinkAdapter.java:467)<BR> at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:292)<BR> at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:183)<BR> at org.drools.reteoo.Rete.assertObject(Rete.java:121)<BR> at
org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:201)<BR> at org.drools.reteoo.ReteooWorkingMemory.doAssertObject(ReteooWorkingMemory.java:70)<BR> at org.drools.common.AbstractWorkingMemory.assertObject(AbstractWorkingMemory.java:724)<BR> at org.drools.common.AbstractWorkingMemory.assertObject(AbstractWorkingMemory.java:548)<BR></DIV>
<DIV>Any idea about this? is it a bug</DIV>
<DIV> </DIV>
<DIV>When I tried to create an additional rule with the 2 expression, it still fails. This error can be reproduced with the followng code:</DIV>
<DIV> </DIV>
<DIV>-------------------------the Main Class's main method</DIV>
<DIV> public static void main(String[] args) {<BR> // TODO code application logic here<BR> final PackageBuilder builder = new PackageBuilder();<BR> try {<BR> builder.addPackageFromDrl( new InputStreamReader( Main.class.getResourceAsStream( "dpd.drl" ) ) );<BR> } catch (DroolsParserException ex) {<BR> ex.printStackTrace();<BR> } catch (IOException ex) {<BR> ex.printStackTrace();<BR> }<BR>
<BR> final RuleBase ruleBase = RuleBaseFactory.newRuleBase();<BR> try {<BR> ruleBase.addPackage( builder.getPackage() );<BR> } catch (Exception ex) {<BR> ex.printStackTrace();<BR> }<BR> final StatefulSession session = ruleBase.newStatefulSession();<BR> IndividualNok individualNok = new IndividualNok();<BR> session.assertObject(individualNok);<BR> session.fireAllRules();<BR> session.dispose();<BR> }</DIV>
<DIV>-------------------------------------------------</DIV>
<DIV>-------------------------------------------------Person class: requried by individualNok, a simple POJO</DIV>
<DIV>import java.util.Date;<BR>import java.util.HashSet;<BR>import java.util.Set;</DIV>
<DIV>/**<BR> *<BR> * @author Jian.Li<BR> */<BR>public class Person implements java.io.Serializable {<BR> <BR> // Fields<BR> <BR> private Long personId;<BR> private Integer nationality;<BR> private Integer race;<BR> private String firstName;<BR> private String lastName;<BR> private String midName;<BR> private Date birthdate;<BR> private Integer occupation;<BR> private Integer religion;<BR> private Integer primaryLanguage;<BR> private Integer veteransStatus;<BR> private String idNo;<BR> private Integer idType;<BR> private String mobileNo;<BR> private String email;<BR> private Integer ethnicgroupcountry;<BR>
private Integer ethnicgroupstate;<BR> private Integer ethnicgroupcity;<BR> private Integer sex;<BR> private Integer maritalStatus;<BR> private Date lud;<BR> private String lub;<BR> private Set individualNoksForNokPersonId = new HashSet(0);<BR> private Set careproviders = new HashSet(0);<BR> private Set residentialAddresses = new HashSet(0);<BR> private Set individualNoksForPersonId = new HashSet(0);<BR> <BR> // Constructors<BR> /** default constructor */<BR> public Person() {<BR> }<BR> /** minimal constructor */<BR> public Person(String firstName, String lastName, Date birthdate,<BR> Integer sex, Integer maritalStatus, Date
lud) {<BR> this.firstName = firstName;<BR> this.lastName = lastName;<BR> this.birthdate = birthdate;<BR> this.sex = sex;<BR> this.maritalStatus = maritalStatus;<BR> this.lud = lud;<BR> }<BR> <BR> /** full constructor */<BR> public Person(Integer nationality, Integer race, String firstName,<BR> String lastName, String midName, Date birthdate,<BR> Integer occupation, Integer religion, Integer primaryLanguage,<BR> Integer veteransStatus, String idNo, Integer
idType,<BR> String mobileNo, String email, Integer ethnicgroupcountry,<BR> Integer ethnicgroupstate, Integer ethnicgroupcity, Integer sex,<BR> Integer maritalStatus, Date lud, String lub,<BR> Set individualNoksForNokPersonId, Set careproviders,<BR> Set residentialAddresses, Set individualNoksForPersonId) {<BR> this.nationality = nationality;<BR> this.race = race;<BR> this.firstName = firstName;<BR> this.lastName = lastName;<BR> this.midName =
midName;<BR> this.birthdate = birthdate;<BR> this.occupation = occupation;<BR> this.religion = religion;<BR> this.primaryLanguage = primaryLanguage;<BR> this.veteransStatus = veteransStatus;<BR> this.idNo = idNo;<BR> this.idType = idType;<BR> this.mobileNo = mobileNo;<BR> this.email = email;<BR> this.ethnicgroupcountry = ethnicgroupcountry;<BR> this.ethnicgroupstate = ethnicgroupstate;<BR> this.ethnicgroupcity = ethnicgroupcity;<BR>
this.sex = sex;<BR> this.maritalStatus = maritalStatus;<BR> this.lud = lud;<BR> this.lub = lub;<BR> this.individualNoksForNokPersonId = individualNoksForNokPersonId;<BR> this.careproviders = careproviders;<BR> this.residentialAddresses = residentialAddresses;<BR> this.individualNoksForPersonId = individualNoksForPersonId;<BR> }<BR> <BR> // Property accessors<BR> public Long getPersonId() {<BR> return this.personId;<BR> }<BR> public void setPersonId(Long personId) {<BR> this.personId =
personId;<BR> }<BR> public Integer getNationality() {<BR> return this.nationality;<BR> }<BR> public void setNationality(Integer nationality) {<BR> this.nationality = nationality;<BR> }<BR> public Integer getRace() {<BR> return this.race;<BR> }<BR> public void setRace(Integer race) {<BR> this.race = race;<BR> }<BR> public String getFirstName() {<BR> return this.firstName;<BR> }<BR> public void setFirstName(String firstName) {<BR> this.firstName = firstName;<BR> }<BR> public
String getLastName() {<BR> return this.lastName;<BR> }<BR> public void setLastName(String lastName) {<BR> this.lastName = lastName;<BR> }<BR> public String getMidName() {<BR> return this.midName;<BR> }<BR> public void setMidName(String midName) {<BR> this.midName = midName;<BR> }<BR> public Date getBirthdate() {<BR> return this.birthdate;<BR> }<BR> public void setBirthdate(Date birthdate) {<BR> this.birthdate = birthdate;<BR> }<BR> public Integer getOccupation() {<BR>
return this.occupation;<BR> }<BR> public void setOccupation(Integer occupation) {<BR> this.occupation = occupation;<BR> }<BR> public Integer getReligion() {<BR> return this.religion;<BR> }<BR> public void setReligion(Integer religion) {<BR> this.religion = religion;<BR> }<BR> public Integer getPrimaryLanguage() {<BR> return this.primaryLanguage;<BR> }<BR> public void setPrimaryLanguage(Integer primaryLanguage) {<BR> this.primaryLanguage = primaryLanguage;<BR> }<BR> public Integer getVeteransStatus() {<BR> return
this.veteransStatus;<BR> }<BR> public void setVeteransStatus(Integer veteransStatus) {<BR> this.veteransStatus = veteransStatus;<BR> }<BR> public String getIdNo() {<BR> return this.idNo;<BR> }<BR> public void setIdNo(String idNo) {<BR> this.idNo = idNo;<BR> }<BR> public Integer getIdType() {<BR> return this.idType;<BR> }<BR> public void setIdType(Integer idType) {<BR> this.idType = idType;<BR> }<BR> public String getMobileNo() {<BR> return this.mobileNo;<BR> }<BR> public void
setMobileNo(String mobileNo) {<BR> this.mobileNo = mobileNo;<BR> }<BR> public String getEmail() {<BR> return this.email;<BR> }<BR> public void setEmail(String email) {<BR> this.email = email;<BR> }<BR> public Integer getEthnicgroupcountry() {<BR> return this.ethnicgroupcountry;<BR> }<BR> public void setEthnicgroupcountry(Integer ethnicgroupcountry) {<BR> this.ethnicgroupcountry = ethnicgroupcountry;<BR> }<BR> public Integer getEthnicgroupstate() {<BR> return this.ethnicgroupstate;<BR> }<BR> public void
setEthnicgroupstate(Integer ethnicgroupstate) {<BR> this.ethnicgroupstate = ethnicgroupstate;<BR> }<BR> public Integer getEthnicgroupcity() {<BR> return this.ethnicgroupcity;<BR> }<BR> public void setEthnicgroupcity(Integer ethnicgroupcity) {<BR> this.ethnicgroupcity = ethnicgroupcity;<BR> }<BR> public Integer getSex() {<BR> return this.sex;<BR> }<BR> public void setSex(Integer sex) {<BR> this.sex = sex;<BR> }<BR> public Integer getMaritalStatus() {<BR> return this.maritalStatus;<BR> }<BR> public void
setMaritalStatus(Integer maritalStatus) {<BR> this.maritalStatus = maritalStatus;<BR> }<BR> public Date getLud() {<BR> return this.lud;<BR> }<BR> public void setLud(Date lud) {<BR> this.lud = lud;<BR> }<BR> public String getLub() {<BR> return this.lub;<BR> }<BR> public void setLub(String lub) {<BR> this.lub = lub;<BR> }<BR> public Set getIndividualNoksForNokPersonId() {<BR> return this.individualNoksForNokPersonId;<BR> }<BR> public void setIndividualNoksForNokPersonId(Set individualNoksForNokPersonId)
{<BR> this.individualNoksForNokPersonId = individualNoksForNokPersonId;<BR> }<BR> public Set getCareproviders() {<BR> return this.careproviders;<BR> }<BR> public void setCareproviders(Set careproviders) {<BR> this.careproviders = careproviders;<BR> }<BR> public Set getResidentialAddresses() {<BR> return this.residentialAddresses;<BR> }<BR> public void setResidentialAddresses(Set residentialAddresses) {<BR> this.residentialAddresses = residentialAddresses;<BR> }<BR> public Set getIndividualNoksForPersonId() {<BR> return
this.individualNoksForPersonId;<BR> }<BR> public void setIndividualNoksForPersonId(Set individualNoksForPersonId) {<BR> this.individualNoksForPersonId = individualNoksForPersonId;<BR> }<BR>}</DIV>
<DIV>----------------------------------------------------------------------------------------------------</DIV>
<DIV>-------------------------------------IndividualNok class : a simple POJO</DIV>
<DIV>public class IndividualNok implements java.io.Serializable {<BR> <BR> // Fields<BR> <BR> private Long individualNokId;<BR> <BR> private Person personByPersonId;<BR> <BR> private Person personByNokPersonId;<BR> <BR> private Integer nokRelationship;<BR> <BR> private Integer emgcycntctInd;<BR> <BR> // Constructors<BR> <BR> /** default constructor */<BR> public IndividualNok() {<BR> }<BR> <BR> /** minimal constructor */<BR> public IndividualNok(Integer nokRelationship) {<BR> this.nokRelationship = nokRelationship;<BR> }<BR>
<BR> /** full constructor */<BR> public IndividualNok(Person personByPersonId, Person personByNokPersonId,<BR> Integer nokRelationship, Integer emgcycntctInd) {<BR> this.personByPersonId = personByPersonId;<BR> this.personByNokPersonId = personByNokPersonId;<BR> this.nokRelationship = nokRelationship;<BR> this.emgcycntctInd = emgcycntctInd;<BR> }<BR> <BR> // Property accessors<BR> public Long getIndividualNokId() {<BR> return this.individualNokId;<BR> }<BR> <BR> public void setIndividualNokId(Long individualNokId)
{<BR> this.individualNokId = individualNokId;<BR> }<BR> <BR> public Person getPersonByPersonId() {<BR> return this.personByPersonId;<BR> }<BR> <BR> public void setPersonByPersonId(Person personByPersonId) {<BR> this.personByPersonId = personByPersonId;<BR> }<BR> <BR> public Person getPersonByNokPersonId() {<BR> return this.personByNokPersonId;<BR> }<BR> <BR> public void setPersonByNokPersonId(Person personByNokPersonId) {<BR> this.personByNokPersonId = personByNokPersonId;<BR> }<BR> <BR> public Integer
getNokRelationship() {<BR> return this.nokRelationship;<BR> }<BR> <BR> public void setNokRelationship(Integer nokRelationship) {<BR> this.nokRelationship = nokRelationship;<BR> }<BR> <BR> public Integer getEmgcycntctInd() {<BR> return this.emgcycntctInd;<BR> }<BR> <BR> public void setEmgcycntctInd(Integer emgcycntctInd) {<BR> this.emgcycntctInd = emgcycntctInd;<BR> }<BR> <BR>}</DIV>
<DIV>---------------------------------------End of IndividualNok</DIV>
<DIV> </DIV></div><br>
                <hr size=1>
<a href="http://sg.rd.yahoo.com/mail/sg/footer/def/*http://sg.movies.yahoo.com">Yahoo! Movies</a><img src=http://sg.yimg.com/i/sg/widgets/new.gif hspace=4 align=abstop width=28 height=11> - Search movie info and celeb profiles and photos.</body></html>