Forum Discussion

FICO's avatar
FICO
Community Manager
11 years ago

NullPointerException while evaluating executeAgent()

Hi,

i am very new to this tool. just started with the example which is given in the tutorial along with the Advisor 7.2 documents. after running the rule project i am getting this in console:

com.blazesoft.engines.rules.NdEvaluationException: Call to 'executeAgent' failed while evaluating "executeAgent()" in function main

java.lang.NullPointerException

  at com.blazesoft.engines.flow.WjHBYgF.WjHGPWR(:135)

  at com.blazesoft.engines.flow.WjHGQLV.WjHGQKU(:212)

  at com.blazesoft.engines.flow.WjHGQLV.WjHUouC(:146)

  at com.blazesoft.engines.flow.WjHByQO.WjHUotB(:931)

  at com.blazesoft.engines.flow.WjHByQO.accept(:1011)

.....

I have created  new repository/workspace and project and running function (below is the code snippet)

main function ::

newApp is a CardApplicant initially{

annualAirlineTrips = 6.

creditHistory = "Good".

income = 38000.

isMarried = true.

mosInCurrentJob = 12.

recommendedCard = null.

rollingOverBalances = true.

spousalIncome = 41000.

}

events().postEvent(newApp).

executeAgent().

if newApp.recommendedCard is not null

then print("You are eligible for a " newApp's recommendedCard " card and you will receive a " newApp's gift".").

else print("You are not eligible for a card at this time. Please contact one of our representatives.").

3 Replies

  • FICO's avatar
    FICO
    Community Manager

    The executeAgent() triggers the execution of any ruleflows in the project or begin processing the event queue.

    What metaphors were you trying to execute the newApp object against?

  • FICO's avatar
    FICO
    Community Manager

    It looks like you have a flow activity (branch or task definition) that tries to dereference a property or variable that is null. Look for "object.property" or "object.property.subproperty" type statements, and verify that both "object" and "property" are not null.

    HTH,

    Jostein

  • FICO's avatar
    FICO
    Community Manager

    NullPointerException is a  RuntimeException . Runtime exceptions are critical and cannot be caught at compile time. They crash the program at run time if they are not handled properly. When a class is instantiated, its object is stored in computer memory. The  NullPointerExceptions (http://net-informations.com/java/cjava/null.htm)  occur when you try to use a reference that points to no location in memory (null) as though it were referencing an object. These include:

    1. Calling the instance method of a null object.
    2. Accessing or modifying the field of a null object.
    3. Throwing null as if it were a Throwable value.