[rules-users] Getting Error while using Drools 5.3.0
Hi, My application works fine with Drools v 4.0.7. However, when I run my application using Drools 5.3.0, I am getting the following error: org.drools.rule.InvalidRulePackage: Evaluator '>' does not support type 'ValueType = 'String' : [Rule name='VIN required for newer vehicles'] at org.drools.rule.Package.checkValidity(Package.java:478) at org.drools.common.AbstractRuleBase.addPackages(AbstractRuleBase.java:481) at org.drools.reteoo.ReteooRuleBase.addPackages(ReteooRuleBase.java:458) at org.drools.reteoo.ReteooRuleBase.addPackage(ReteooRuleBase.java:465) Here is the condition I am using in my .dsl file: [condition][]request contains no VIN and the car was built after year {value}=info: CarRulesInfo(quoteRequest.VIN == null, quoteRequest.modelyear > 1982 ) Any suggestions on how to fix this problem. Thanks in advance. -- View this message in context: http://drools.46999.n3.nabble.com/Getting-Error-while-using-Drools-5-3-0-tp3936714p3936714.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Getting Error while using Drools 5.3.0
The type of quoteRequest.modelyear is what? If it's String, change it to int. -W On 24/04/2012, mkhan_rt54fde wrote: > > Hi, > > My application works fine with Drools v 4.0.7. However, when I run my > application using Drools 5.3.0, I am getting the following error: > > org.drools.rule.InvalidRulePackage: Evaluator '>' does not support type > 'ValueType = 'String' : [Rule name='VIN required for newer vehicles'] > > > at org.drools.rule.Package.checkValidity(Package.java:478) > at > org.drools.common.AbstractRuleBase.addPackages(AbstractRuleBase.java:481) > at org.drools.reteoo.ReteooRuleBase.addPackages(ReteooRuleBase.java:458) > at org.drools.reteoo.ReteooRuleBase.addPackage(ReteooRuleBase.java:465) > > Here is the condition I am using in my .dsl file: > > [condition][]request contains no VIN and the car was built after year > {value}=info: CarRulesInfo(quoteRequest.VIN == null, quoteRequest.modelyear >> 1982 ) > > Any suggestions on how to fix this problem. > > Thanks in advance. > > > > > > -- > View this message in context: > http://drools.46999.n3.nabble.com/Getting-Error-while-using-Drools-5-3-0-tp3936714p3936714.html > Sent from the Drools: User forum mailing list archive at Nabble.com. > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Getting Error while using Drools 5.3.0
Hi, Thanks for the reply. In my application,one of the input parameters is Year.In my java class,I am getting the modelyear from year and converting it an integer.But even then, I am getting the error posted earlier.Here is my rule file: rule "Set Time To Live" when there is a restoration request then set quote process time to live to: 15 add additional action "check state regulation for vintage car restoration" end #validation rule "Year is required" no-loop true when request does not contain model year then set reason of rejection to "year is required" reject request end #additional action rule "VIN required for newer vehicles" no-loop true when request contains no VIN and the car was built after year 1982 then ask the customer to provide VIN end and here is my java class: public class QuoteRequest { private Contact contact; private Address address; private String make; private String model; private String style; private String year; private String VIN; private String condition; private String description; private String zip; private List links = new ArrayList(); public static void printForMe() { System.out.println("printing for you"); } public Contact getContact() { return contact; } public void setContact(Contact contact) { this.contact = contact; } public Address getAddress() { return address; } public void setAddress(Address address) { this.address = address; } public String getMake() { return make; } public void setMake(String make) { this.make = make; } public String getModel() { return model; } public void setModel(String model) { this.model = model; } public String getStyle() { return style; } public void setStyle(String style) { this.style = style; } public String getYear() { return returnString(year); } public Integer getModelYear() { Integer modelYear = (getYear() == null) ? null : Integer.parseInt(year); return modelYear; } public void setYear(String year) { this.year = year; } public String getVIN() { return returnString(VIN); } public void setVIN(String vin) { VIN = vin; } public String getCondition() { return condition; } public void setCondition(String condition) { this.condition = condition; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getZip() { return zip; } public void setZip(String zip) { this.zip = zip; } public List getLinks() { return links; } public void setLinks(List links) { this.links = links; } private String returnString(String s) { return (s == null || s.isEmpty()) ? null : s; } } Are there any changes I need to make any changes to the java class to fix the error I am seeing? Thanks. -- View this message in context: http://drools.46999.n3.nabble.com/Getting-Error-while-using-Drools-5-3-0-tp3936714p3939076.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Getting Error while using Drools 5.3.0
This rule (and note the correct spelling of modelYear with a capital 'Y', in contrast to your first post) compiles and executes correctly using 5.3.0. rule qr when info: CarRulesInfo( quoteRequest.VIN == null, quoteRequest.modelYear > 1982 ) then System.out.println( "got new car" ); end -W On 25/04/2012, mkhan_rt54fde wrote: > Hi, > > Thanks for the reply. > > In my application,one of the input parameters is Year.In my java class,I am > getting the modelyear from year and converting it an integer.But even then, > I am getting the error posted earlier.Here is my rule file: > > rule "Set Time To Live" > when > there is a restoration request > then > set quote process time to live to: 15 > add additional action "check state regulation for vintage car > restoration" > end > > > #validation > rule "Year is required" > no-loop true > when > request does not contain model year > then > set reason of rejection to "year is required" > reject request > end > > > #additional action > rule "VIN required for newer vehicles" > no-loop true > when > request contains no VIN and the car was built after year 1982 > then > ask the customer to provide VIN > end > > and here is my java class: > > public class QuoteRequest { > > private Contact contact; > private Address address; > > private String make; > private String model; > private String style; > private String year; > > private String VIN; > private String condition; > private String description; > private String zip; > > private List links = new ArrayList(); > > public static void printForMe() { > System.out.println("printing for you"); > } > > public Contact getContact() { > return contact; > } > > public void setContact(Contact contact) { > this.contact = contact; > } > > public Address getAddress() { > return address; > } > > public void setAddress(Address address) { > this.address = address; > } > > public String getMake() { > return make; > } > > public void setMake(String make) { > this.make = make; > } > > public String getModel() { > return model; > } > > public void setModel(String model) { > this.model = model; > } > > public String getStyle() { > return style; > } > > public void setStyle(String style) { > this.style = style; > } > > public String getYear() { > return returnString(year); > } > > public Integer getModelYear() { > Integer modelYear = (getYear() == null) ? null : > Integer.parseInt(year); > return modelYear; > } > > public void setYear(String year) { > this.year = year; > } > > public String getVIN() { > return returnString(VIN); > } > > public void setVIN(String vin) { > VIN = vin; > } > > public String getCondition() { > return condition; > } > > public void setCondition(String condition) { > this.condition = condition; > } > > public String getDescription() { > return description; > } > > public void setDescription(String description) { > this.description = description; > } > > public String getZip() { > return zip; > } > > public void setZip(String zip) { > this.zip = zip; > } > > public List getLinks() { > return links; > } > > public void setLinks(List links) { > this.links = links; > } > > private String returnString(String s) { >return (s == null || s.isEmpty()) ? null : s; > } > } > > Are there any changes I need to make any changes to the java class to fix > the error I am seeing? > > Thanks. > > -- > View this message in context: > http://drools.46999.n3.nabble.com/Getting-Error-while-using-Drools-5-3-0-tp3936714p3939076.html > Sent from the Drools: User forum mailing list archive at Nabble.com. > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Getting Error while using Drools 5.3.0
Hi, Sorry for the delay in reply. Thanks for pointing out the typo.I corrected that and redepolyed my application.However,this time, I am seeing the following error: org.drools.rule.InvalidRulePackage: Evaluator '>' does not support type 'ValueType = 'String' : [Rule name='VIN required for newer vehicles'] Here is my .dslr file: rule "Set Time To Live" when there is a restoration request then set quote process time to live to: 3 add additional action "check state regulation for vintage car restoration" end #validation rule "Year is required" no-loop true when request does not contain model year then set reason of rejection to "year is required" reject request end #additional action rule "VIN required for newer vehicles" no-loop true when request contains no VIN and the car was built after year 1982 then ask the customer to provide VIN end Here is my .dsl file: [condition][]there is a restoration request=info: CarRulesInfo() [consequence][]set quote process time to live to: {value}=info.setTimeToLive({value}); [condition][]request does not contain model year=info: CarRulesInfo(quoteRequest.year == null ) [consequence][]reject request=info.setValid( false ); [condition][]request contains no VIN and the car was built after year {value}=info: CarRulesInfo(quoteRequest.VIN == null, quoteRequest.modelYear > 1982 ) [consequence][]ask the customer to provide VIN=info.setAdditionalActions("Ask customer to provide VIN number"); [consequence][]set reason of rejection to "{value}"=info.setReasonOfRejection("{value}"); [consequence][]add additional action "{value}"=info.setAdditionalActions("{value}"); and here is my java class: public class QuoteRequest { private Contact contact; private Address address; private String make; private String model; private String style; private String year; private String VIN; private String condition; private String description; private String zip; private List links = new ArrayList(); public static void printForMe() { System.out.println("printing for you"); } public Contact getContact() { return contact; } public void setContact(Contact contact) { this.contact = contact; } public Address getAddress() { return address; } public void setAddress(Address address) { this.address = address; } public String getMake() { return make; } public void setMake(String make) { this.make = make; } public String getModel() { return model; } public void setModel(String model) { this.model = model; } public String getStyle() { return style; } public void setStyle(String style) { this.style = style; } public String getYear() { return returnString(year); } public Integer getModelYear() { Integer modelYear = (getYear() == null) ? null : Integer.parseInt(year); return modelYear; } public void setYear(String year) { this.year = year; } public String getVIN() { return returnString(VIN); } public void setVIN(String vin) { VIN = vin; } public String getCondition() { return condition; } public void setCondition(String condition) { this.condition = condition; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getZip() { return zip; } public void setZip(String zip) { this.zip = zip; } public List getLinks() { return links; } public void setLinks(List links) { this.links = links; } private String returnString(String s) { return (s == null || s.isEmpty()) ? null : s; } } Not sure why I am getting this error.Any suggestions? Thanks. -- View this message in context: http://drools.46999.n3.nabble.com/Getting-Error-while-using-Drools-5-3-0-tp3936714p3954007.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-us
Re: [rules-users] Getting Error while using Drools 5.3.0
Once again: A DRL rule written according to you Java code, your DSL and your DSLR work fine. (Drools 5.3.0) 1) Write the rule in DRL and see what you get. 2) Obtain the result of DSL expansion and inspect the resulting DRL code. -W On 02/05/2012, mkhan_rt54fde wrote: > Hi, > > Sorry for the delay in reply. > > Thanks for pointing out the typo.I corrected that and redepolyed my > application.However,this time, I am seeing the following error: > > org.drools.rule.InvalidRulePackage: Evaluator '>' does not support type > 'ValueType = 'String' : [Rule name='VIN required for newer vehicles'] > > Here is my .dslr file: > > rule "Set Time To Live" > when > there is a restoration request > then > set quote process time to live to: 3 > add additional action "check state regulation for vintage car > restoration" > end > > > #validation > rule "Year is required" > no-loop true > when > request does not contain model year > then > set reason of rejection to "year is required" > reject request > end > > > #additional action > rule "VIN required for newer vehicles" > no-loop true > when > request contains no VIN and the car was built after year 1982 > then > ask the customer to provide VIN > end > > > Here is my .dsl file: > > [condition][]there is a restoration request=info: CarRulesInfo() > [consequence][]set quote process time to live to: > {value}=info.setTimeToLive({value}); > [condition][]request does not contain model year=info: > CarRulesInfo(quoteRequest.year == null ) > [consequence][]reject request=info.setValid( false ); > [condition][]request contains no VIN and the car was built after year > {value}=info: CarRulesInfo(quoteRequest.VIN == null, quoteRequest.modelYear >> 1982 ) > [consequence][]ask the customer to provide > VIN=info.setAdditionalActions("Ask customer to provide VIN number"); > [consequence][]set reason of rejection to > "{value}"=info.setReasonOfRejection("{value}"); > [consequence][]add additional action > "{value}"=info.setAdditionalActions("{value}"); > > and here is my java class: > > public class QuoteRequest { > > private Contact contact; > private Address address; > > private String make; > private String model; > private String style; > private String year; > > private String VIN; > private String condition; > private String description; > private String zip; > > private List links = new ArrayList(); > > public static void printForMe() { > System.out.println("printing for you"); > } > > public Contact getContact() { > return contact; > } > > public void setContact(Contact contact) { > this.contact = contact; > } > > public Address getAddress() { > return address; > } > > public void setAddress(Address address) { > this.address = address; > } > > public String getMake() { > return make; > } > > public void setMake(String make) { > this.make = make; > } > > public String getModel() { > return model; > } > > public void setModel(String model) { > this.model = model; > } > > public String getStyle() { > return style; > } > > public void setStyle(String style) { > this.style = style; > } > > public String getYear() { > return returnString(year); > } > > public Integer getModelYear() { > Integer modelYear = (getYear() == null) ? null : > Integer.parseInt(year); > > return modelYear; > } > > public void setYear(String year) { > this.year = year; > } > > public String getVIN() { > return returnString(VIN); > } > > public void setVIN(String vin) { > VIN = vin; > } > > public String getCondition() { > return condition; > } > > public void setCondition(String condition) { > this.condition = condition; > } > > public String getDescription() { > return description; > } > > public void setDescription(String description) { > this.description = description; > } > > public String getZip() { > return zip; > } > > public void setZip(String zip) { > this.zip = zip; > } > > public List getLinks() { > return links; > } > > public void setLinks(List links) { > this.links = links; > } > > private String returnString(String s) { > return (s == null || s.isEmpty()) ? null : s; > } > } > > Not sure why I am getting th
Re: [rules-users] Getting Error while using Drools 5.3.0
Hi, This issue has been resolved.The jar in my deployment pacakage did not have updated java class and the rules files.Rebuilt the jar and deployed my application.It worked. Thanks for your help. Best Regards. -- View this message in context: http://drools.46999.n3.nabble.com/Getting-Error-while-using-Drools-5-3-0-tp3936714p3960283.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users