<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
try this:<a title="Send (Ctrl+Enter)" href="javascript:;" id="SendMessage"><span class="Label"></span></a><br><br>System.setProperty("drools.dialect.mvel.strict", "false");<br><br>it works for me :)<br><br>> Date: Mon, 5 Oct 2009 00:08:48 -0700<br>> From: cdelgado70@gmail.com<br>> To: rules-users@lists.jboss.org<br>> Subject: Re: [rules-users] unable to resolve method using strict-mode<br>> <br>> <br>> Hi all,<br>> <br>> I am getting the same problem reported by vladperl. I've got rules and<br>> rulesflows using MVEL2 scripts that work fine in Windows running in JBoss<br>> and junit tests. I've inserted a map into StatefulKnowledgeSession and I am<br>> successfully invoking myMap.myObject.myValue without any casting. However I<br>> am now deploying the application in RedHat with Websphere 7 and I am getting<br>> everywhere errors like:<br>> unqualified type in strict mode for: myObject<br>> unqualified type in strict mode for: myValue<br>> unable to resolve method using strict-mode:<br>> java.lang.Object.get(java.lang.String)]<br>> <br>> It seems that somehow the MVEL's Strong Typing Mode has been setup in this<br>> env. This doesn't make sense to me. I rather prefer to believe the error is<br>> misleading and something else is bothering MVEL when parsing my rules and<br>> ruleflow files.<br>> <br>> Any help will be much appreciated!<br>> <br>> <br>> <br>> vladperl wrote:<br>> > <br>> > <br>> > Hi Wolfgang,<br>> > Please take a look at attached new example.<br>> > This time the example can demonstrate when strict mode is false we don't<br>> > have to put class cast.<br>> > Beside I finally figured out how to switch strict mode for MVEL dialect.<br>> > <br>> > Best regards,<br>> > Vladimir<br>> > <br>> > Date: Sat, 3 Oct 2009 14:36:10 +0200<br>> > From: wolfgang.laun@gmail.com<br>> > To: rules-users@lists.jboss.org<br>> > Subject: Re: [rules-users] unable to resolve method using strict-mode<br>> > <br>> > The Java code in the archive just compiles a .drl file, and there's no<br>> > reason this should fail. The class cast would only appear to be missing<br>> > after a Map object is inserted into WM, and the session is run so that the<br>> > rule fires.<br>> > <br>> > -W<br>> > <br>> > 2009/10/2 Vladimir Perlov <vladperl@hotmail.com><br>> > <br>> > <br>> > <br>> > <br>> > <br>> > <br>> > It's compiled and working on Windows without any casting :)<br>> > Check out the test project I attached. <br>> > You will see that the rule will compile from web application (Windows<br>> > only) or with Java SE application. The web application using JSF so in<br>> > case to run it use application server with included JSF library.<br>> > <br>> > <br>> > http://download.java.net/glassfish/v3/promoted/<br>> > <br>> > <br>> > Date: Fri, 2 Oct 2009 19:48:17 +0200<br>> > From: wolfgang.laun@gmail.com<br>> > <br>> > To: rules-users@lists.jboss.org<br>> > Subject: Re: [rules-users] unable to resolve method using strict-mode<br>> > <br>> > Map() in the .drl file is bound to be interpreted as Map<Object,Object> so<br>> > that a Map.get() returns an Object. To be able to call method<br>> > getSomeMethod() you'd have to cast this result, according to<br>> > <br>> > <br>> > ((SomeClass)$map.get("x")).getSomeMethod()<br>> > <br>> > <br>> > I fail to understand how this could ever be avoided - strict or no strict,<br>> > MVEL or not MVEL.<br>> > <br>> > -W <br>> > <br>> > 2009/10/2 Vladimir Perlov <vladperl@hotmail.com><br>> > <br>> > <br>> > <br>> > <br>> > <br>> > <br>> > <br>> > Hi Wolfgang,<br>> > Thank you very much for quick response!<br>> > <br>> > I tried your suggestion and still getting the following error:<br>> > <br>> > Unable to build expression for 'consequence': Failed to compile: 1<br>> > compilation error(s): - (1,29) unable to resolve method using<br>> > strict-mode: java.lang.Object.getSomeMethod() '<br>> > System.out.println($map.get("x").getSomeMethod());<br>> > ' : [Rule name='TEST']<br>> > At least now I have only 1 compilation error comparing to the previous<br>> > variant.<br>> > <br>> > modified rule:<br>> > <br>> > rule "TEST"<br>> > <br>> > <br>> > dialect "mvel"<br>> > when<br>> > $map : Map()<br>> > <br>> > <br>> > then<br>> > System.out.println($map.get("x").getSomeMethod());<br>> > end<br>> > <br>> > <br>> > <br>> > I believe that problem is related to strict-mode that somehow enforced on<br>> > Linux but not on Windows.<br>> > I tried to remove the strict mode using the the following approach but it<br>> > seems don't have any effect.<br>> > We have web application with many drools rules and it's working on Windows<br>> > but when we deployed the same application to Linux we are getting failed<br>> > compile errors ;) <br>> > <br>> > <br>> > <br>> > KnowledgeBuilderConfiguration config =<br>> > KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(); <br>> > config.setProperty("drools.dialect.mvel.strict", "false");<br>> > <br>> > <br>> > kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(config);<br>> > <br>> > Please advise me.<br>> > <br>> > By the way I'm using drools 5.0.1<br>> > <br>> > <br>> > Date: Fri, 2 Oct 2009 18:30:25 +0200<br>> > <br>> > <br>> > From: wolfgang.laun@gmail.com<br>> > To: rules-users@lists.jboss.org<br>> > Subject: Re: [rules-users] unable to resolve method using strict-mode<br>> > <br>> > <br>> > <br>> > 2009/10/2 Vladimir Perlov <vladperl@hotmail.com><br>> > <br>> > <br>> > <br>> > <br>> > <br>> > <br>> > <br>> > <br>> > Here is the rule that failed to compile on Linux:<br>> > <br>> > rule "TEST"<br>> > dialect "mvel"<br>> > Send<br>> > when<br>> > map : Map()<br>> > <br>> > $map : Map()<br>> > <br>> > or omit '$' in the consequence.<br>> > -W<br>> > <br>> > then<br>> > System.out.println($map.get("x").getSomeMethod());<br>> > end<br>> > <br>> > <br>> >                                            <br>> > Lauren found her dream laptop. Find the PC that’s right for you.<br>> > <br>> > <br>> > <br>> > _______________________________________________<br>> > <br>> > rules-users mailing list<br>> > <br>> > rules-users@lists.jboss.org<br>> > <br>> > https://lists.jboss.org/mailman/listinfo/rules-users<br>> > <br>> > <br>> > <br>> >                                            <br>> > Hotmail® has ever-growing storage! Don’t worry about storage limits. Check<br>> > it out.<br>> > <br>> > <br>> > _______________________________________________<br>> > <br>> > rules-users mailing list<br>> > <br>> > rules-users@lists.jboss.org<br>> > <br>> > https://lists.jboss.org/mailman/listinfo/rules-users<br>> > <br>> > <br>> > <br>> >                                            <br>> > _________________________________________________________________<br>> > Hotmail: Trusted email with Microsoft’s powerful SPAM protection.<br>> > http://clk.atdmt.com/GBL/go/177141664/direct/01/<br>> > <br>> > _______________________________________________<br>> > rules-users mailing list<br>> > rules-users@lists.jboss.org<br>> > https://lists.jboss.org/mailman/listinfo/rules-users<br>> > <br>> > <br>> <br>> -- <br>> View this message in context: http://www.nabble.com/unable-to-resolve-method-using-strict-mode-tp25718123p25744948.html<br>> Sent from the drools - user mailing list archive at Nabble.com.<br>> <br>> <br>> _______________________________________________<br>> rules-users mailing list<br>> rules-users@lists.jboss.org<br>> https://lists.jboss.org/mailman/listinfo/rules-users<br>                                            <br /><hr />Hotmail: Trusted email with Microsoft’s powerful SPAM protection. <a href='http://clk.atdmt.com/GBL/go/177141664/direct/01/' target='_new'>Sign up now.</a></body>
</html>