[rules-users] rules-users Digest

Kumar, Ravendra ravendra.kumar at logica.com
Mon Mar 19 10:27:44 EDT 2012


Hello All,

I am frustrated with error: 'Unable to load dialect 'org.drools.rule.builder.dialect.mvel.MVELDialectConfiguration:mvel:org.drools.rule.builder.dialect.mvel.MVELDialectConfiguration'  xxx.drl	

This is generated by eclipse drools plugin in problem view as a error, it would be helpful if someone help me out. I am using following artifacts

1. eclipse ide: Indigo(3.7)
2. eclipse drools plugin: 5.2.final
4. drools runtime 5.2.final (generated in eclipse)
Thanks,
Ravi


-----Original Message-----
From: rules-users-bounces at lists.jboss.org [mailto:rules-users-bounces at lists.jboss.org] On Behalf Of rules-users-request at lists.jboss.org
Sent: 08 March 2012 11:08 AM
To: rules-users at lists.jboss.org
Subject: rules-users Digest, Vol 64, Issue 21

Send rules-users mailing list submissions to
	rules-users at lists.jboss.org

To subscribe or unsubscribe via the World Wide Web, visit
	https://lists.jboss.org/mailman/listinfo/rules-users
or, via email, send a message with subject or body 'help' to
	rules-users-request at lists.jboss.org

You can reach the person managing the list at
	rules-users-owner at lists.jboss.org

When replying, please edit your Subject line so it is more specific than "Re: Contents of rules-users digest..."


Today's Topics:

   1. how to invoke java method with variable arguments	from drl
      file (womuji)
   2. Re: how to invoke java method with variable arguments from
      drl file (Matteo Cusmai)
   3. Simple question about String comparison in Drool (shawn)
   4. Re: Simple question about String comparison in Drool
      (Mauricio Salatino)
   5. Re: Simple question about String comparison in Drool (shawn)
   6. Persistence in fireUntilHalt() loop (Alberto R. Galdo)
   7. Re: how to invoke java method with variable arguments from
      drl file (Wolfgang Laun)


----------------------------------------------------------------------

Message: 1
Date: Wed, 7 Mar 2012 09:09:49 -0800 (PST)
From: womuji <cmregister at gmail.com>
Subject: [rules-users] how to invoke java method with variable
	arguments	from drl file
To: rules-users at lists.jboss.org
Message-ID: <1331140189049-3807314.post at n3.nabble.com>
Content-Type: text/plain; charset=us-ascii

We are upgrading Drools from 5.1 to 5.3, and running into some issue when invoking a Java method with String variable arguments:

methodA(String... params)

how do we invoke this in a drl file? We used to call it in 5.1 as:

objA.methodA({"string1"});

and it works fine. Now in 5.3, it complains that 

"unable to resolve method using strict-mode:
objA.methodA([Ljava.lang.Object;)]"

If we tried objA.methodA(new String[]{"string1"}); it complains that "unable to resolve method using strict-mode:
objA.methodA([Ljava.lang.String;)]"

It passes the rule loading if we change to :

objA.methodA("string1");

but when actually running the rule, we are getting error saying " unable to resolve method methodA(java.lang.String)"


--
View this message in context: http://drools.46999.n3.nabble.com/how-to-invoke-java-method-with-variable-arguments-from-drl-file-tp3807314p3807314.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


------------------------------

Message: 2
Date: Wed, 7 Mar 2012 21:41:56 +0100
From: Matteo Cusmai <cusmaimatteo at gmail.com>
Subject: Re: [rules-users] how to invoke java method with variable
	arguments from drl file
To: Rules Users List <rules-users at lists.jboss.org>
Message-ID:
	<CABd_zP_kqpoRUCaDvWLcXr7Q-4uQ9JrOdyH82wGy3=GVPioW3Q at mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

>From my experience, if you want call a method from then clause, it has 
>to
be static method.
Bye bye,

Matteo Cusmai
Il giorno 07/mar/2012 18:10, "womuji" <cmregister at gmail.com> ha scritto:

> We are upgrading Drools from 5.1 to 5.3, and running into some issue 
> when invoking a Java method with String variable arguments:
>
> methodA(String... params)
>
> how do we invoke this in a drl file? We used to call it in 5.1 as:
>
> objA.methodA({"string1"});
>
> and it works fine. Now in 5.3, it complains that
>
> "unable to resolve method using strict-mode:
> objA.methodA([Ljava.lang.Object;)]"
>
> If we tried objA.methodA(new String[]{"string1"}); it complains that 
> "unable to resolve method using strict-mode:
> objA.methodA([Ljava.lang.String;)]"
>
> It passes the rule loading if we change to :
>
> objA.methodA("string1");
>
> but when actually running the rule, we are getting error saying " 
> unable to resolve method methodA(java.lang.String)"
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/how-to-invoke-java-method-with-varia
> ble-arguments-from-drl-file-tp3807314p3807314.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120307/bf21ba3e/attachment-0001.html 

------------------------------

Message: 3
Date: Wed, 7 Mar 2012 15:32:47 -0800 (PST)
From: shawn <youngxiao121 at hotmail.com>
Subject: [rules-users] Simple question about String comparison in
	Drool
To: rules-users at lists.jboss.org
Message-ID: <1331163167526-3808352.post at n3.nabble.com>
Content-Type: text/plain; charset=us-ascii

I insert several strings into working memory to make a comparison. But how to compare a anonymous string to another string. code like:

List <String> s = ArrayList <String>
String key

function void insertValue( s, KnowledgeHelper kh ) {
	
	for( String string : s ) {
		kh.insert( string );
	}
	
}
...
When
        not $string : String( toString() == key) Then....
Obviously, toString() can not do this task.
How to get the string's value ?
Cheers.

--
View this message in context: http://drools.46999.n3.nabble.com/Simple-question-about-String-comparison-in-Drool-tp3808352p3808352.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


------------------------------

Message: 4
Date: Wed, 7 Mar 2012 23:53:45 +0000
From: Mauricio Salatino <salaboy at gmail.com>
Subject: Re: [rules-users] Simple question about String comparison in
	Drool
To: Rules Users List <rules-users at lists.jboss.org>
Message-ID:
	<CANzbnyXwSQbNXGWpJPOAuxEobmXB=GWSAgM8eWctpti1DHwfdA at mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

you can just use String( this == key)

On Wed, Mar 7, 2012 at 11:32 PM, shawn <youngxiao121 at hotmail.com> wrote:

> I insert several strings into working memory to make a comparison. But 
> how to compare a anonymous string to another string. code like:
>
> List <String> s = ArrayList <String>
> String key
>
> function void insertValue( s, KnowledgeHelper kh ) {
>
>        for( String string : s ) {
>                kh.insert( string );
>        }
>
> }
> ...
> When
>        not $string : String( toString() == key) Then....
> Obviously, toString() can not do this task.
> How to get the string's value ?
> Cheers.
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Simple-question-about-String-compari
> son-in-Drool-tp3808352p3808352.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



--
 - MyJourney @ http://salaboy.wordpress.com
 - Co-Founder @ http://www.jugargentina.org
 - Co-Founder @ http://www.jbug.com.ar

 - Salatino "Salaboy" Mauricio -
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120307/c9625aac/attachment-0001.html 

------------------------------

Message: 5
Date: Thu, 8 Mar 2012 01:24:29 -0800 (PST)
From: shawn <youngxiao121 at hotmail.com>
Subject: Re: [rules-users] Simple question about String comparison in
	Drool
To: rules-users at lists.jboss.org
Message-ID: <1331198669395-3809203.post at n3.nabble.com>
Content-Type: text/plain; charset=us-ascii

Thank you`

--
View this message in context: http://drools.46999.n3.nabble.com/Simple-question-about-String-comparison-in-Drool-tp3808352p3809203.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


------------------------------

Message: 6
Date: Thu, 8 Mar 2012 11:32:07 +0100
From: "Alberto R. Galdo" <argaldo at gmail.com>
Subject: [rules-users] Persistence in fireUntilHalt() loop
To: Rules Users List <rules-users at lists.jboss.org>
Message-ID:
	<CADrEBQGXUytqVyuYTEVM-ZMOpVegSYLL_T8M70UXJn3645Xs7g at mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hi,

  We're running an application that uses Drools + JBPM 5 + Drools integration our set-up can be seen as:

  Some rule fires and creates a JBPM process ( a fact gets inserted into drools using "kcontext.getKnowledgeRuntime().startProcess("testProcess")"
). We have a problem with the persistence of this processes. Persistence is implemented with JPA and JTA. Our application runs with fireUntilHalt() and when a process is launched from the consequence of any of the rules the persistence of the process fails. If the application runs with fireAllRules(), the persistence works like a charm.

  The error shown is as follow:

  Exception in thread "Thread-5" Exception executing consequence for rule "Run Process" in com.sample: java.lang.NullPointerException at
org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
 at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1101)
at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1029)
 at org.drools.common.DefaultAgenda.fireUntilHalt(DefaultAgenda.java:1229)
at
org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:754)
 at
org.drools.common.AbstractWorkingMemory.fireUntilHalt(AbstractWorkingMemory.java:730)
at
org.drools.command.runtime.rule.FireUntilHaltCommand$1.run(FireUntilHaltCommand.java:50)
 at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.NullPointerException at
org.jbpm.persistence.processinstance.JPAProcessInstanceManager.addProcessInstance(JPAProcessInstanceManager.java:44)
 at
org.jbpm.process.instance.AbstractProcessInstanceFactory.createProcessInstance(AbstractProcessInstanceFactory.java:36)
at
org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:182)
 at
org.jbpm.process.instance.ProcessRuntimeImpl.createProcessInstance(ProcessRuntimeImpl.java:154)
at
org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:135)
 at
org.jbpm.process.instance.ProcessRuntimeImpl.startProcess(ProcessRuntimeImpl.java:130)
at
org.drools.common.AbstractWorkingMemory.startProcess(AbstractWorkingMemory.java:1074)
 at
org.drools.impl.StatefulKnowledgeSessionImpl.startProcess(StatefulKnowledgeSessionImpl.java:301)
at com.sample.Rule_Run_Process.defaultConsequence(Rule_Run_Process.java:9)
 at com.sample.Rule_Run_ProcessDefaultConsequenceInvoker.evaluate(Unknown
Source)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1091)
 ... 6 more
 The problem is in this function:
 public void addProcessInstance(ProcessInstance processInstance) {
        ProcessInstanceInfo processInstanceInfo = new ProcessInstanceInfo( processInstance, this.kruntime.getEnvironment() );
        ProcessPersistenceContext context
            = ((ProcessPersistenceContextManager)
this.kruntime.getEnvironment()
                    .get( EnvironmentName.PERSISTENCE_CONTEXT_MANAGER ))
                    .getProcessPersistenceContext();
        // @PrePersist added to ProcessInstanceInfo because of this
        context.persist( processInstanceInfo );
        ((org.jbpm.process.instance.ProcessInstance)
processInstance).setId( processInstanceInfo.getId() );
        processInstanceInfo.updateLastReadDate();
        internalAddProcessInstance(processInstance);
    }
 We think after that persist sentence, the entity manager would have to run a flush sentence for the process instance is inserted into database and get the ID.
 Greets.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120308/15b8e4e2/attachment-0001.html 

------------------------------

Message: 7
Date: Thu, 8 Mar 2012 12:08:16 +0100
From: Wolfgang Laun <wolfgang.laun at gmail.com>
Subject: Re: [rules-users] how to invoke java method with variable
	arguments from drl file
To: Rules Users List <rules-users at lists.jboss.org>
Message-ID:
	<CANaj1Leg5Qyru6FN+vRN6ZHs7Mknpg1JG_sz-athiTxH314ORA at mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

2012/3/7 Matteo Cusmai <cusmaimatteo at gmail.com>

> From my experience, if you want call a method from then clause, it has 
> to be static method.
> Bye bye,
>

Surely you don't mean that only a "static method" can be called in a consequence?!

Also, using 5.3.0 and 5.4.0.Beta2,.I had no problems with a consequence
    modify( $ms ){ add( "three", "four" ) }
    insert( new MySet( "x", "y" ) );
where both method add and constructor MySet have the signature (String...
strings)

But - as in many other situations - using
   dialect "mvel"
is to be avoided.

-W

Matteo Cusmai
> Il giorno 07/mar/2012 18:10, "womuji" <cmregister at gmail.com> ha scritto:
>
> We are upgrading Drools from 5.1 to 5.3, and running into some issue 
> when
>> invoking a Java method with
>> String variable arguments:
>>
>> methodA(String... params)
>>
>> how do we invoke this in a drl file? We used to call it in 5.1 as:
>>
>> objA.methodA({"string1"});
>>
>> and it works fine. Now in 5.3, it complains that
>>
>> "unable to resolve method using strict-mode:
>> objA.methodA([Ljava.lang.Object;)]"
>>
>> If we tried objA.methodA(new String[]{"string1"}); it complains that 
>> "unable to resolve method using strict-mode:
>> objA.methodA([Ljava.lang.String;)]"
>>
>> It passes the rule loading if we change to :
>>
>> objA.methodA("string1");
>>
>> but when actually running the rule, we are getting error saying " 
>> unable to resolve method methodA(java.lang.String)"
>>
>>
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/how-to-invoke-java-method-with-vari
>> able-arguments-from-drl-file-tp3807314p3807314.html
>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120308/4a23e19e/attachment.html 

------------------------------

_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


End of rules-users Digest, Vol 64, Issue 21
*******************************************


Think green - keep it on the screen.

This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.






More information about the rules-users mailing list