- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
NdAssertio nException : Assertion failed
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
03-20-2012 08:37 AM
I am using Blaze 7.0 with a Java OM. Here is the scenaio..
Parent Abstract Class: AccountData
SubClass: ConsumerAccountData
I am trying to initizalize the object so that I can use it in my testing. Here is my code.
{accountData = a ConsumerAccountData initially {
currentScore = 999.
}.
It work for the first time. When I run it the second time, I get the following error
java.lang.NullPointerException
at com.blazesoft.engines.rules.NdEvaluationException.
at com.blazesoft.engines.rules.NdEvaluationException.
at com.blazesoft.engines.rules.NdEvaluationException.
at com.blazesoft.engines.rules.NdEvaluationException.
at com.blazesoft.engines.rules.NdEvaluationException.
at com.blazesoft.engines.rules.NdEvaluationException.
at com.blazesoft.engines.rules.NdEvaluationContext.ev
at com.blazesoft.engines.rules.NdEvaluationContext.Wj
at com.blazesoft.engines.rules.NdObject.WjHBKMM(:5128
at com.blazesoft.engines.rules.NdObject.WjHBKUU(:5265
at com.blazesoft.engines.rules.NdObject.WjHBKXX(:5321
at com.blazesoft.engines.rules.NdEvaluationContext.Wj
at com.blazesoft.engines.rules.NdEvaluationContext.Wj
at com.blazesoft.engines.rules.NdEvaluationContext.fr
at com.blazesoft.engines.rules.NdScriptContext.WjHJsd
at com.blazesoft.engines.rules.NdScriptContext.WjHCLr
at com.blazesoft.engines.rules.NdScriptContext.reset(
at com.blazesoft.engines.rules.NdScriptContext.initIn
at com.blazesoft.engines.rules.NdScriptContext.initia
at com.blazesoft.engines.rules.NdRuleAgent.initialize
at com.blazesoft.proxy.rules.local.NdRuleAgentDevProx
at com.blazesoft.devtools.rules.NdDevSessionManager$W
at java.lang.Thread.run(Unknown Source)
Thereafter I get the following error..
com.blazesoft.util.NdAssertionException: Assertion failed.
at com.blazesoft.util.NdBaseObject.advAssert(:188)
at com.blazesoft.engines.rules.NdObject.WjHBKzO(:2054
at com.blazesoft.engines.rules.NdObject.WjHBKXX(:5327
at com.blazesoft.engines.rules.NdEvaluationContext.Wj
at com.blazesoft.engines.rules.NdEvaluationContext.Wj
at com.blazesoft.engines.rules.NdEvaluationContext.fr
at com.blazesoft.engines.rules.NdScriptContext.WjHJsd
at com.blazesoft.engines.rules.NdScriptContext.WjHCLr
at com.blazesoft.engines.rules.NdScriptContext.reset(
at com.blazesoft.engines.rules.NdScriptContext.initIn
at com.blazesoft.engines.rules.NdScriptContext.initia
at com.blazesoft.engines.rules.NdRuleAgent.initialize
at com.blazesoft.proxy.rules.local.NdRuleAgentDevProx
at com.blazesoft.devtools.rules.NdDevSessionManager$W
at java.lang.Thread.run(Unknown Source)
This cycle repeats.. If I re-compile and run, it runs for the first time and then again throws errors.
Kindly advise.
Shubham
PayPal, Inc.
Solved! Go to Solution.
Re: NdAssertio nException : Assertion failed
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Not the Solution
- Email to a Friend
- Report Inappropriate Content
03-20-2012 10:31 AM
Hi Shubham,
You have to instantiate it first the syntax should be more like this:
{accountData = some ConsumerAccountData initially a ConsumerAccountData initially {
currentScore = 999.
}
The "some" instantiates an instance of the class (like "new"), "initially a ConsumerAccountData" creates an initial value for all of the properties and finally the "initially { currentScore = 999} will initialize your currentScore property.
Tom Sheckells
Business Rules Consulting, Inc.
Re: NdAssertio nException : Assertion failed
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Not the Solution
- Email to a Friend
- Report Inappropriate Content
03-20-2012 12:45 PM
Hi Tom,
Thanks for your reply. I alreadt tried that approach. That gave me another exception as follows
com.blazesoft.engines.rules.NdEvaluationException: Evaluation error while evaluating "{accountData = (a ConsumerAccountData initially {it.creditScore = 100})}" in RechAccountData#1
java.lang.RuntimeException: Failed to remove external object 'ConsumerAccountData#1' of class 'ConsumerAccountData'.
The object's hash code has probably changed.
at com.blazesoft.engines.rules.NdObject.WjHBKzO(:2104
at com.blazesoft.engines.rules.NdObject.WjHBKXX(:5327
at com.blazesoft.engines.rules.NdEvaluationContext.Wj
at com.blazesoft.engines.rules.NdEvaluationContext.Wj
at com.blazesoft.engines.rules.NdEvaluationContext.fr
at com.blazesoft.engines.rules.expressions.WjHAPdD.Wj
at com.blazesoft.engines.rules.expressions.WjHAPdD.Wj
at com.blazesoft.engines.rules.expressions.NdExpressi
at com.blazesoft.engines.rules.expressions.NdExpressi
at com.blazesoft.engines.rules.expressions.NdInstanti
at com.blazesoft.engines.rules.expressions.NdExpressi
at com.blazesoft.engines.rules.expressions.NdExpressi
at com.blazesoft.engines.rules.expressions.NdExpressi
at com.blazesoft.engines.rules.expressions.NdSimplePr
at com.blazesoft.engines.rules.expressions.NdExpressi
at com.blazesoft.engines.rules.expressions.NdExpressi
at com.blazesoft.engines.rules.expressions.NdExpressi
at com.blazesoft.engines.rules.expressions.NdExpressi
at com.blazesoft.engines.rules.expressions.NdExpressi
at com.blazesoft.engines.rules.expressions.WjHAPdD.Wj
at com.blazesoft.engines.rules.expressions.WjHAPdD.Wj
at com.blazesoft.engines.rules.expressions.NdExpressi
at com.blazesoft.engines.rules.expressions.NdExpressi
at com.blazesoft.engines.rules.expressions.NdInstanti
at com.blazesoft.engines.rules.expressions.NdExpressi
at com.blazesoft.engines.rules.expressions.NdExpressi
at com.blazesoft.engines.rules.expressions.NdExpressi
at com.blazesoft.engines.rules.expressions.NdExpressi
at com.blazesoft.engines.rules.expressions.NdExpressi
at com.blazesoft.engines.rules.expressions.WjHAPdD.Wj
at com.blazesoft.engines.rules.expressions.WjHAPdD.Wj
at com.blazesoft.engines.rules.expressions.NdExpressi
at com.blazesoft.engines.rules.expressions.NdExpressi
at com.blazesoft.engines.rules.expressions.NdExpressi
at com.blazesoft.engines.rules.WjHBIEZ.WjHBIER(:200)
at com.blazesoft.engines.rules.NdScriptContext.initIn
at com.blazesoft.engines.rules.NdScriptContext.initia
at com.blazesoft.engines.rules.NdRuleAgent.initialize
at com.blazesoft.proxy.rules.local.NdRuleAgentDevProx
at com.blazesoft.devtools.rules.NdDevSessionManager$W
at java.lang.Thread.run(Unknown Source)
Thanks,
Shubham
PayPal, Inc.
Re: NdAssertio nException : Assertion failed
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Not the Solution
- Email to a Friend
- Report Inappropriate Content
03-21-2012 08:19 AM
Hi Shubham,
Sometimes, it is the little things that can cause the most agravation. Especially when it is missed several times because I rush. In looking carefully at your statement, you are are trying to assign a new instance to the class. Try something like this (note the new name):
acctData is some ConsumerAccountData initally a ConsumerAccountData initially {
it.creditScore = 456};
That might produce better results.
Tom Sheckells
Business Rules Consulting, Inc.
Re: NdAssertio nException : Assertion failed
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Not the Solution
- Email to a Friend
- Report Inappropriate Content
03-21-2012 10:33 AM
Hi Tom,
I tried that without any luck.
Here is my code
{ acctData is some ConsumerAccountData initially a ConsumerAccountData initially {
it.creditScore = 456};
}
Here is the error
[
+] [->] com.blazesoft.engines.rules.NdEvaluationException: Evaluation error
Failed to remove external object 'ConsumerAccountData#1' of class 'ConsumerAccountData'.
The object's hash code has probably changed. while evaluating "{acctData = (a ConsumerAccountData initially {it.creditScore = 456})}" in RechAccountData#1
When placed inside a try catch, I get the following message
error: Expression produces unexpected value: null.
Thanks,
Shubham
PayPal, Inc.
Re: NdAssertio nException : Assertion failed
[ Edited ]
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Accept as Solution
- Email to a Friend
- Report Inappropriate Content
03-22-2012 01:51 PM - edited 03-22-2012 01:52 PM
Hi Shubham,
"The object's hash code has probably changed. while evaluating" error occurs when you have the BOM classes override the default methods like hashcode and equals (provided by the Java Object class) where you update the hashcode of the object based on the value of a property or a set of properties and you try to change the property within the rules which was used in computation of hashcode.
To overcome this error you can remove the overridden methods of hashcode and equals from your Java BOM classes or use the "NdUserDefinedMutableJavaValueClasses.properties" with the class information like below:
#User defined classes
<fully qualified Java class name"=true
Place this properties file under the package com/blazesoft/objects/java in your BOM Jar file. This configuration provides information to the Blaze execution engine to use the hashcode and equals implementations of Java Object class and resolves the error.
Thanks,
Harsha Kolla
BRMS Lead Consultant
DAASL
Re: NdAssertio nException : Assertion failed
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Not the Solution
- Email to a Friend
- Report Inappropriate Content
03-22-2012 02:11 PM
Thanks for your reply. I will definitely give it a try and post an update soon.
Thanks,
Shubham
PayPal, Inc.
Re: NdAssertio nException : Assertion failed
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Accept as Solution
- Email to a Friend
- Report Inappropriate Content
03-22-2012 03:47 PM
Just for completeness:
Kharshas answer is obviously correct, but there is another option: The specification/contract for hashCode and equals for Java objects state that they should be based only on immutable properties of the object, as they represent the identity of the object. In other words, you can rewrite the hashCode/equals methods of the offending class to honor that contract. That should also solve your problem, though it is not always possible/easy (hence the options outlined by kharsha).
Regards,
Jostein
Re: NdAssertio nException : Assertion failed
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Not the Solution
- Email to a Friend
- Report Inappropriate Content
03-23-2012 11:09 PM
Hi Guys,
The java BOM for the parent class for ConsumerAccountData does overrides the hashcode method. All the above solutions in this forum suggest to change code for the BOM class which is not possible.
Is there a work around in this situation which will allow me to keep the code for the jar file as is? Do I need to open a ticket for this issue? Kindly advise.
@Jostein: From your reply above, it seems that you mean that hashCode method cannot be implemented at a place where the identity of the object changes. However, I found this on wikipedia..
"The general contract for overridden implementations of this method is that they behave in a way consistent with the same object's equals() method: that a given object must consistently report the same hash value (unless it is changed so that the new version is no longer considered "equal" to the old), and that two objects which equals() says are equal must report the same hash value. There's no requirement that hash values be consistent between different Java implementations, or even between different execution runs of the same program, and while two unequal objects having different hashes is very desirable, this is not mandatory (that is, the hash function implemented need not be a perfect hash)."
Thanks,
Shubham
PayPal, Inc.
Re: NdAssertio nException : Assertion failed
[ Edited ]
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Not the Solution
- Email to a Friend
- Report Inappropriate Content
03-24-2012 12:35 AM - edited 03-24-2012 12:41 AM
Hi Shubham,
The solution I have oulined in my previous post does not require a change to the BOM implementation. Blaze uses the class information set in the properties file to use the hashcode and equals implemetations of the Java Object which shall resolve your problem.
On a different note regarding using the mutable properties in defining the hashcode- it is not a good idea to do so while using such classes within collections.
Good Luck.
Harsha

