Map() in the .drl file is bound to be interpreted as Map<Object,Object> so that a Map.get() returns an Object. To be able to call method getSomeMethod() you'd have to cast this result, according to<br><br> ((SomeClass)$map.get("x")).getSomeMethod()<br>
<br>I fail to understand how this could ever be avoided - strict or no strict, MVEL or not MVEL.<br><br>-W <br><br><div class="gmail_quote">2009/10/2 Vladimir Perlov <span dir="ltr"><<a href="mailto:vladperl@hotmail.com">vladperl@hotmail.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
Hi Wolfgang,<br>Thank you very much for quick response!<br><br>I tried your suggestion and still getting the following error:<br><br><h3>Unable to build expression for 'consequence': Failed to compile: 1
compilation error(s): - (1,29) unable to resolve method using
strict-mode: java.lang.Object.getSomeMethod() '
System.out.println($map.get("x").getSomeMethod());
' : [Rule name='TEST']
</h3>At least now I have only 1 compilation error comparing to the previous variant.<br><br>modified rule:<br><font face="Courier New"><br></font><font face="Courier New">rule "TEST"</font><font face="Courier New"><br>
</font><font face="Courier New"> dialect "mvel"</font><font face="Courier New"><br></font><font face="Courier New"> when</font><font face="Courier New"><br></font><font face="Courier New"> $map : Map()</font><font face="Courier New"><br>
</font><font face="Courier New"> then</font><font face="Courier New"><br></font><font face="Courier New"> System.out.println($map.get("x").getSomeMethod());</font><font face="Courier New"><br></font><font face="Courier New">end</font><br>
<br>I believe that problem is related to strict-mode that somehow enforced on Linux but not on Windows.<br>I tried to remove the strict mode using the the following approach but it seems don't have any effect.<br>We have web application with many drools rules and it's working on Windows but when we deployed the same application to Linux we are getting failed compile errors ;) <br>
<br><font face="Courier New">KnowledgeBuilderConfiguration config = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(); </font><font face="Courier New"><br></font><font face="Courier New">config.setProperty("drools.dialect.mvel.strict", "false");</font><font face="Courier New"><br>
</font><font face="Courier New">kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(config);</font><br><br>Please advise me.<br><br>By the way I'm using drools 5.0.1<br><br><br><hr>Date: Fri, 2 Oct 2009 18:30:25 +0200<br>
From: <a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a><br>To: <a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>Subject: Re: [rules-users] unable to resolve method using strict-mode<br>
<br>2009/10/2 Vladimir Perlov <span dir="ltr"><<a href="mailto:vladperl@hotmail.com" target="_blank">vladperl@hotmail.com</a>></span><br><div><blockquote style="padding-left: 1ex;">
<div>
<br><br>Here is the rule that failed to compile on Linux:<br><br>rule "TEST"<br> dialect "mvel"<a title="Send (Ctrl+Enter)">
<span>Send</span></a><br> when<br> map : Map()<br></div></blockquote><div><br>$map : Map()<br><br>or omit '$' in the consequence.<br>-W<br> </div><blockquote style="padding-left: 1ex;">
<div> then<br> System.out.println($map.get("x").getSomeMethod());<br>end<br><br></div></blockquote></div><br>                                            <br><hr>Lauren found her dream laptop. <a href="http://www.microsoft.com/windows/choosepc/?ocid=ftp_val_wl_290" target="_blank">Find the PC that’s right for you.</a></div>
<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br>