Avoid an MVEL Bug In Drools Snapshots

If you’re working with Drools trunk snapshots, you may be tripping over a bug in MVEL that caused me to lose about a day. On the RHS (right-hand side, the consequence) of my rule I had the following:

$queryResult.addResult(new Result($obj));

Which resulted in this error: [Error: unable to access property (null parent): $obj]

However, if I call an accessor or otherwise do something with the object before passing it off to the constructor, it works fine:

$obj.getName();
$queryResult.addResult(new Result($obj));

Right now this appears to be a problem in MVEL, but I don’t know enough about the internals of Drools of MVEL to say for sure. Ideally this workaround will keep you moving forward.

Share

One Response to "Avoid an MVEL Bug In Drools Snapshots"

  1. I’ve noticed that this happens within Eclipse if you need to do a complete clean. Especially if you are using code painters like EMF.

Do you have something to say?

Your email is never published nor shared.
Required fields are marked *