Re: [rules-users] unable to resolve method using strict-mode
by cdelgado
Hi all,
I am getting the same problem reported by vladperl. I've got rules and
rulesflows using MVEL2 scripts that work fine in Windows running in JBoss
and junit tests. I've inserted a map into StatefulKnowledgeSession and I am
successfully invoking myMap.myObject.myValue without any casting. However I
am now deploying the application in RedHat with Websphere 7 and I am getting
everywhere errors like:
unqualified type in strict mode for: myObject
unqualified type in strict mode for: myValue
unable to resolve method using strict-mode:
java.lang.Object.get(java.lang.String)]
It seems that somehow the MVEL's Strong Typing Mode has been setup in this
env. This doesn't make sense to me. I rather prefer to believe the error is
misleading and something else is bothering MVEL when parsing my rules and
ruleflow files.
Any help will be much appreciated!
vladperl wrote:
>
>
> Hi Wolfgang,
> Please take a look at attached new example.
> This time the example can demonstrate when strict mode is false we don't
> have to put class cast.
> Beside I finally figured out how to switch strict mode for MVEL dialect.
>
> Best regards,
> Vladimir
>
> Date: Sat, 3 Oct 2009 14:36:10 +0200
> From: wolfgang.laun(a)gmail.com
> To: rules-users(a)lists.jboss.org
> Subject: Re: [rules-users] unable to resolve method using strict-mode
>
> The Java code in the archive just compiles a .drl file, and there's no
> reason this should fail. The class cast would only appear to be missing
> after a Map object is inserted into WM, and the session is run so that the
> rule fires.
>
> -W
>
> 2009/10/2 Vladimir Perlov <vladperl(a)hotmail.com>
>
>
>
>
>
>
> It's compiled and working on Windows without any casting :)
> Check out the test project I attached.
> You will see that the rule will compile from web application (Windows
> only) or with Java SE application. The web application using JSF so in
> case to run it use application server with included JSF library.
>
>
> http://download.java.net/glassfish/v3/promoted/
>
>
> Date: Fri, 2 Oct 2009 19:48:17 +0200
> From: wolfgang.laun(a)gmail.com
>
> To: rules-users(a)lists.jboss.org
> Subject: Re: [rules-users] unable to resolve method using strict-mode
>
> 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
>
>
> ((SomeClass)$map.get("x")).getSomeMethod()
>
>
> I fail to understand how this could ever be avoided - strict or no strict,
> MVEL or not MVEL.
>
> -W
>
> 2009/10/2 Vladimir Perlov <vladperl(a)hotmail.com>
>
>
>
>
>
>
>
> Hi Wolfgang,
> Thank you very much for quick response!
>
> I tried your suggestion and still getting the following error:
>
> 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']
> At least now I have only 1 compilation error comparing to the previous
> variant.
>
> modified rule:
>
> rule "TEST"
>
>
> dialect "mvel"
> when
> $map : Map()
>
>
> then
> System.out.println($map.get("x").getSomeMethod());
> end
>
>
>
> I believe that problem is related to strict-mode that somehow enforced on
> Linux but not on Windows.
> I tried to remove the strict mode using the the following approach but it
> seems don't have any effect.
> 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 ;)
>
>
>
> KnowledgeBuilderConfiguration config =
> KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
> config.setProperty("drools.dialect.mvel.strict", "false");
>
>
> kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(config);
>
> Please advise me.
>
> By the way I'm using drools 5.0.1
>
>
> Date: Fri, 2 Oct 2009 18:30:25 +0200
>
>
> From: wolfgang.laun(a)gmail.com
> To: rules-users(a)lists.jboss.org
> Subject: Re: [rules-users] unable to resolve method using strict-mode
>
>
>
> 2009/10/2 Vladimir Perlov <vladperl(a)hotmail.com>
>
>
>
>
>
>
>
>
> Here is the rule that failed to compile on Linux:
>
> rule "TEST"
> dialect "mvel"
> Send
> when
> map : Map()
>
> $map : Map()
>
> or omit '$' in the consequence.
> -W
>
> then
> System.out.println($map.get("x").getSomeMethod());
> end
>
>
>
> Lauren found her dream laptop. Find the PC that’s right for you.
>
>
>
> _______________________________________________
>
> rules-users mailing list
>
> rules-users(a)lists.jboss.org
>
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
> Hotmail® has ever-growing storage! Don’t worry about storage limits. Check
> it out.
>
>
> _______________________________________________
>
> rules-users mailing list
>
> rules-users(a)lists.jboss.org
>
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
> _________________________________________________________________
> Hotmail: Trusted email with Microsoft’s powerful SPAM protection.
> http://clk.atdmt.com/GBL/go/177141664/direct/01/
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
--
View this message in context: http://www.nabble.com/unable-to-resolve-method-using-strict-mode-tp257181...
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 6 months
Re: [rules-users] [droolsflow] ForEach usage - Version 5.1.0 (Anderson vasconcelos)
by Bill Tarr
Anderson,
Could you describe what behavior you are getting when you put a collection in the CollectionExpressions?
I've used a process variable object like FactObject with a List (lets say a List<SubFacts> subFct ) on it. I pass in the FactObject, and make it a named variable in my workflow factObj, and put
CollectionExpression => factObj.subFct
variable => currentSubFact,
I can use that variable within my ForEach loop no problem. My setup is to pass that variable into a subflow, but I don't think that is important.
I may be missing something, is you case different somehow?
Bill
Hi All
To use a ForEach element i need to access a collection inside my
FactObject. (FactObject.list)
I tried to call FactObject.list inside a CollectionExpressions but this
fail. (Just ok with list defined as a process variable)
*So i do something thats a consider a workaround:*
1- I Create a '"Action Node" before a "ForEach Node"
2-In the "Action Node", i get the FactObject and populate the process
variable that represents FactObject.list :
*FactObject factObject =
(FactObject)drools.getKnowledgeRuntime().getObjects(new
ClassObjectFilter(FactObject.class)).iterator().next();
context.setVariable("list", factObject.getDefeitos());*
3- And on the "Foreach node" i just passed the "list" in the
CollectionExpressions
This is the correct way to do this? Has a better way to get FactObject.list
to use on "For Each Node"?
On Eclipse, the CollectionExpression of forEach don't have a window (Like
Action Editor) to put a MVEL/Java expressions. I think this is a interesting
resource.
16 years, 6 months
Error trying to build Drools 5.0 from source
by Mulcahy, Lawrence
Anyone know what this means? I downloaded drools-5.0-src.zip
from http://www.jboss.org/drools/downloads.html. I extracted it,
cded into the top directory and after perusing the README typed
$ mvn -Declipse -Ddocumentation clean install
The output:
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] The projects in the reactor contain a cyclic reference: Edge between 'Vertex{label='org.drools:docbook-xsl-drools'}' and 'Vertex{label='org.drools:docbook-style-drools'}' introduces to cycle in the graph org.drools:docbook-style-drools --> org.drools:docbook-xsl-drools --> org.drools:docbook-style-drools
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4 seconds
[INFO] Finished at: Wed Oct 07 10:33:21 MDT 2009
[INFO] Final Memory: 10M/80M
[INFO] ------------------------------------------------------------------------
16 years, 6 months
Infinite loop while marshalling
by Maciej Prochniak
Hello,
I have 2 simple rules:
rule one
when
A()
not(B())
then
System.out.println("a");
end
rule two
when
A()
then
System.out.println("b");
end
A and B are plain java objects with no properties.
When I create stateful knowledge session (default configuration) and do
the following:
session1.insert(new A());
session1.fireAllRules();
MarshallerFactory.newMarshaller(knowledgeBase).marshall(new
ByteArrayOutputStream(), session1);
I get an infite loop (resulting byte array eats up all heap space, no
matter how much I set).
Am I doing sth wrong or is it a bug?
br,
maciek prochniak
16 years, 6 months
Drools Flow Persistence Doubt
by Pardeep.Ruhil@lntinfotech.com
Hi,
I have doubt regarding persistence in Drools.
I read the documentation of persistence in Drools Flow and got to know
that it uses hibernate with H2 database as default.
My doubt is if I want to use Mysql database, then I want to know which are
the tables that I need to create in the database or
Is their any code written which automatically creates the tables in the
schema in Mysql database.
Also is their any document present for configuring Mysql database.
Please help me to get through the situation.
Thanks & Regards
Pardeep Ruhil
______________________________________________________________________
16 years, 6 months
Functions invocation from condition in drools expert
by Sameer Pokarna
Hi,
I am trying to find an example where the 'when' part of the rule uses
functions, I intend to include some checks on complex data structure in my
considiotn. Can anyone point me to any drools/other example to illustrate
how functions can be used in condition? All examples that I found have
functions used in the actions part.
Thanks in advance,
Regards,
Sameer
16 years, 6 months
Mail System Error - Returned Mail
by Returned mail
The message was not delivered due to the following reason:
Your message could not be delivered because the destination computer was
not reachable within the allowed queue period. The amount of time
a message is queued before it is returned depends on local configura-
tion parameters.
Most likely there is a network problem that prevented delivery, but
it is also possible that the computer is turned off, or does not
have a mail system running right now.
Your message could not be delivered within 3 days:
Server 8.124.19.58 is not responding.
The following recipients did not receive this message:
<rules-users(a)lists.jboss.org>
Please reply to postmaster(a)lists.jboss.org
if you feel this message to be in error.
16 years, 6 months
Guvnor test scenarios and collections.
by Nord, James
Hi all,
One of our facts has a collection which the rules add to.
I'm trying to write a test scenrio to cover the simple case where the
fact with an empty collection runs through and ends up containing a
value "default".
However I can't work out how to get Guvnor to do this. I am presented
with fact.blah and then "equals" or "does not equal" but no contains or
does not contain.
I have tried the MVEL syntax of [default] but this complains that the
expectation fails as: "[myFact] field [myCollection] was [[DEFAULT]]
expected [[DEFAULT]]."
Is there any any way to do this?
Regards,
/James
**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster(a)nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.
NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00
**************************************************************************************
16 years, 6 months
Usage of working memory for sharing data between action and subsequent conditions
by Sameer Pokarna
Hi,
I am new to Drools and am facing an issue I do not is supported here.
I have particular record types that the rules process. As I process them, I
want to maintain a map (or persist) of IDs of all records processed. I
believe this can be done in actions.
In some conditions, I want to lookup values in this map/table/persistent
memory to see if this ID is present.
There are more such cases in my usage where I can make use of a shared
memory between rules.
Does Drools have any feature which can be used for this purpose? I looked at
the working memory, but that seems to be relevant for working data, rule
bases, etc. and not as a shared memory. Am I right in my understanding?
Thanks and regards,
Sameer
16 years, 6 months
Re: [rules-users] java.lang.NoSuchMethodError (org.eclipse.jdt.internal.compiler.CompilationResult.getProblems())
by Vadivelkumar
Hi,
Fortunately we have identified the solution for
"java.lang.NoSuchMethodError
(org.eclipse.jdt.internal.compiler.CompilationResult.getProblems())"
a) If we are going to deploy the drools as part of our application
service, that uses Jboss Server,
We need to keep the Drools run time dependencies {Jboss Home}/
Server/default/lib Folder.
b) The following are the Drools runtime dependencies.
CORE RUNTIME
Runtime assumes that you are "compiling" rules using drools-compiler.
* drools-core - the rule engine itself.
* drools-api
* mvel2-2.0.10
* joda-time-1.6
* optional packages:
o xpp3_min-1.1.4c, xstream-1.3.1 - if you are using the
file based audit feature
Note you can use the drools-core stand-alone if you are compiling
"outside" your
runtime application, and deploying serialized Package or RuleBase?
objects.
Thanks,
Vadi.
On Sep 24, 2009, at 12:21 PM, Vadivelkumar wrote:
> Hi,
> I am new to drools. I have created the new drools project in
> eclipse IDE 3.5. I have compiled it and tested it. it works fine.
> but when deploying, I have converted as a jar file and deployed it
> as part of tomcat server. When my tomcat is running i'm receiving
> the following
> error message.
> Please Note:
> 1. I'm using JBoss Drools Core 5.0.1
> 2. My Eclipse Version is 3.5.0 and it has
> org.eclipse.jdt.core_3.5.0.v_963.jar. I have placed this jar file on
> my class path. but still i'm facing the below problem
> 3. I would like to try the solution suggested on ((http://lists.jboss.org/pipermail/rules-users/2007-January/000195.html)
> ). Unfortunately i could not find the any downnload location for
> org.eclipse.jdt.core_3.2.0.v_671.jar
> 4.We have tried with the the solution suggested on (http://www.jboss.org/community/wiki/RulesTomcat
> ) for Drools 4.x Still we are not able to resolve the issue.
>
> java.lang.NoSuchMethodError:
> org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()
> [Lorg/eclipse/jdt/core/compiler/CategorizedProblem;
> org.drools.commons.jci.compilers.EclipseJavaCompiler
> $3.acceptResult(EclipseJavaCompiler.java:321)
>
> org
> .eclipse
> .jdt
> .internal.compiler.Compiler.handleInternalException(Compiler.java:415)
> org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:352)
>
> org
> .drools
> .commons
> .jci.compilers.EclipseJavaCompiler.compile(EclipseJavaCompiler.java:
> 351)
>
> org
> .drools
> .commons
> .jci
> .compilers.AbstractJavaCompiler.compile(AbstractJavaCompiler.java:51)
>
> org
> .drools
> .rule.builder.dialect.java.JavaDialect.compileAll(JavaDialect.java:
> 389)
>
> org
> .drools
> .compiler
> .DialectCompiletimeRegistry
> .compileAll(DialectCompiletimeRegistry.java:56)
> org.drools.compiler.PackageRegistry.compileAll(PackageRegistry.java:
> 74)
> org.drools.compiler.PackageBuilder.compileAll(PackageBuilder.java:
> 690)
> org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:
> 653)
>
> org
> .drools
> .compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:290)
>
> org
> .drools
> .compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:488)
>
> org
> .drools
> .builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)
>
> Could you please help us to fix it?
>
> Thanks in advance.
>
>
> Thanks,
> Vadi
>
16 years, 6 months