Getting "argument type mismatch" during MVEL expression evaluation
<p>For the following code snippet I am getting the error "argument type mismatch".
If I use the commented line, it works fine. </p>

<p>Can some one explain the reason for this behavior? </p>

<p>Is there a way I can get the first expression itself evaluated?</p>

<pre><code>VariableResolverFactory functionFactory = new MapVariableResolverFactory();    
Object value = MVEL.eval("def StringValueWithLength(str) { int myLen = str.toString().length(); return String.valueOf(str) + \":\" + myLen; }; StringValueWithLength(\"qwert\");", functionFactory);
//Object value = MVEL.eval("def StringValueWithLength(str) { return String.valueOf(str) + \":\" + str.toString().length(); }; StringValueWithLength(\"qwert\");", functionFactory);
System.out.println("Value : " + value);
</code></pre>