ProcessInstanceInfo.processInstanceId null with MySQL / Tomcat
by Barry K
Hello,
I am having an issue with persisting the Stateful Session in MySQL and
hopefully someone can help. I'll try and return the favor in the future.
:-)
I am running the following environment
Drools 5.1M1 (Stateful Rule Session with Persistence)
Tomcat 6
MySQL 5
When I run with a unit test the statefulsession is persisted correctly to
the MySQL database, but when I run in Tomcat I get a NullPointer because the
ProcessInstanceInfo.processInstanceId is null.
It appears that the tag @GeneratedValue(strategy = GenerationType.AUTO) is
not working for me when connecting to MySQL through a Tomcat pooled
connection.
The unit test is using a PoolingDataSource while Tomcat is using a resource
in Context.xml.
Has anyone seen a similar issue or can provide a direction for me to look?
Thanks for any help,
Barry
--
View this message in context: http://old.nabble.com/ProcessInstanceInfo.processInstanceId-null-with-MyS...
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 5 months
ILog JRules to Drools Migration
by Simon
Has anybody ported a large number of rules from ILog JRules to Drools?
If yes, I'm very much interested in the following information:
- how did you do the migration (automatic vs. manual)?
- if automatic, how exactly (AST to AST transform, custom JRules
parser, ...)
- which features of JRules did you use (decision tables, rule
tasks, ...)?
- which migration issues did you encounter? how did you solve them?
- ...
Thanks
Simon
16 years, 5 months
Once the engine gets the package from guvnor, how to cache it and make it independent of guvnor.
by Wesley Akio Imamura
Hi,
I'm using this drools 5.0 scenario: agent using changeset file pointing to a
LATEST package guvnor URL.
The guvnor docs says how to start the agent resource scanning to make the
engine change aware:
- ResourceFactory.getResourceChangeNotifierService().start();
- ResourceFactory.getResourceChangeScannerService().start();
I suppose once the agent gets the packages from guvnor and caches it, it
should not need guvnor anymore unless there are changes. The agent could use
the cache and guvnor could be offline for a long time. This worked on
version 5 M1. You could even restart the engine and it started using the
cached version.
The problem I have with the latest 5.0 with new Knowledge classes ang
changeset.xml: when guvnor is offline, the resource scanning detects this
and unsubscribes the package, leaving the engine without any knowledge. When
guvnor is up again, the resource scanning cannot detect it, and the engine
remains without any knowledge.
How do I tell the agent to not unsubscribe url's that are offline, not to
remove their knowledge and just use the cache ?
Can I still configure the cache directory ?
Maybe the problem I have is that I'm using the LATEST packages and not
snapshots ?
The point here is to make the engine totally independent of Guvnor when it
got a package once.
Hope anyone can help me. Maybe I'll try version 5.1 to see what happens then
guvnor is down.
Thanks,
Wesley.
[2009:10:292 12:10:296:debug] ResourceChangeScanner attempt to scan 0
resources
--
Wesley Akio Imamura
São Paulo - SP - Brazil
16 years, 5 months
Re: [rules-users] Implementaion of Rule Flow in Guvnor
by Ambika Goel
Hi All,
I have attached the Guvnor repository and the java code that I am using to run a ruleflow.
The two tables 'MasterHud' and 'FeeCalc' are decision tables made in Guvnor.
* MasterHud decision table is used to get the hudLineNumber based on lienPosition and productType.
* FeeCalc table is used to get the fee based on hudLineNumber.
I have created a ruleflow 'Fee.rf' which connects these two tables.
Below is the code I use to call Fee.rf:
public static void main(String args[]){
try{
KnowledgeBase kbase = readKnowledgeBase();
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
LoanDetail l = new LoanDetail();
l.setLienPosition("Second Lien");
l.setProductType("ABC");
ksession.insert(l);
ksession.startProcess("hudRule");
ksession.fireAllRules();
System.out.println("Hud Line Number: " +l.getHudLineNumber());
System.out.println("Fee: " +l.getFee());
ksession.dispose();
}catch(Throwable t){
t.printStackTrace();
}
}
private static KnowledgeBase readKnowledgeBase()throws Exception{
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add( ResourceFactory.newUrlResource("http://localhost:8080/guvnor/org.drools.guvnor.Guvnor/package/com.example..."),ResourceType.PKG);
kbuilder.add(ResourceFactory.newClassPathResource("Fee.rf", Test.class), ResourceType.DRF);
KnowledgeBuilderErrors errors = kbuilder.getErrors();
if(errors.size()>0){
for(KnowledgeBuilderError error : errors){
System.err.println(error);
}
throw new IllegalArgumentException("Could not parse knowledge.");
}
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
return kbase;
}
When I run this code, I get the Hud Line Number as 801 but the fee displayed is 0.0
The expected output is Hud Line Number as 801 but the fee displayed as 450.
There is no exception but I don't get the desired output.
________________________________
From: Ambika Goel
Sent: Monday, October 12, 2009 1:09 PM
To: 'rules-users(a)lists.jboss.org'
Subject: Implementaion of Rule Flow in Guvnor
I am using the following code to add to knowledge builder and run it:
knowledgeBuilder.add(ResourceFactory.newClassPathResource("QueueFlow.rf", GuvnorTest.class), ResourceType.DRF) // ruleflow
knowledgeBuilder.add(ResourceFactory.newUrlResource("http://..."), ResourceType.PKG) // guvnor package
My rule flow is connection of two tables. I set a property in action of one decision table and use it as a condition in another decision table to get the desired result.
If I run the above code, I don't get any exception but the output is 'null'.
16 years, 5 months
Re: [rules-users] Agenda Groups basic question
by Rongala, Kanthi
Hi,
As suggested, I made the following changes, to get the desired output. I have some questions regarding the approach to agenda-groups (in drools 5 context)
1. I had to enable auto-focus once per each agenda-group. I thought agenda-groups were stacked internally by drools engine, and auto-focus might be acting as a directional mechanism (help determine which rule under which agenda is to be triggered). Clearly, I am mistaken and it seems that auto-focus is the way to go.
I would like to know about other ways to set focus on agenda-groups. I have seem code snippets on google bearing session.setFocus("[agenda-group-name]"). I am currently using statefulsession and cann't figure out this 'setFocus()' method
2. I was 'compelled' to comment out lock-on-active directive. I understand that lock-on-active is an variant of no-loop causing each fact to be passed to the rule only once in a active agenda (correct me if I am mistaken). With lock-on-active set, I was expecting the messages to be print once atleast, but the current behavior beats me.
Code is given below:
package com.mscibarra.examples.drools.controllers;
import com.mscibarra.examples.drools.domainentities.*;
rule "Detect and Remove Duplicate Shelves"
agenda-group "Phase1"
//lock-on-active
dialect "mvel"
auto-focus
when
$universe : LibraryUniverse()
$shelf : Shelf() from $universe.shelves
$shelf2 : Shelf(this != $shelf) from $universe.shelves
then
System.out.println("Duplicate Shelves found::"+$shelf);
// without the modify(), drools is not alerted about changes
/*
modify($universe) {
shelves.remove($shelf);
};
*/
end
rule "Singleton Shelf Detector"
agenda-group "Phase2"
//lock-on-active
dialect "mvel"
auto-focus
when
$universe : LibraryUniverse(shelves.size > 1)
then
System.out.println("Multiple Shelves found::"+$universe.shelves.size);
end
With Regards,
Swaroop
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
Message: 3
Date: Mon, 2 Nov 2009 10:51:32 -0500
From: Edson Tirelli <ed.tirelli(a)gmail.com>
Subject: Re: [rules-users] Agenda Groups basic question
To: Rules Users List <rules-users(a)lists.jboss.org>
Message-ID:
<e6dd5ba30911020751nb973184r73cd6dc46e4e50c0(a)mail.gmail.com>
Content-Type: text/plain; charset="windows-1252"
You need to set the focus for an agenda group to execute.
[]s
Edson
2009/11/2 Rongala, Kanthi <Kanthi.Rongala(a)mscibarra.com>
> Hi,
>
>
>
> I am new to Drools and trying my hands out at Drools 5. I cann?t figure out
> how to use agenda- groups. I have a small drl file with two agenda groups
> and one rule per agenda-group. This doesn?t seem to work. However if I
> happen to comment out the agenda-group attribute, the results are as
> expected.
>
>
>
> Please let me know what I am missing.
>
>
>
> *package* com.mscibarra.examples.drools.controllers;
>
>
>
> *import* com.mscibarra.examples.drools.domainentities.*;
>
>
>
>
>
> *rule* "Detect and Remove Duplicate Shelves"
>
> *agenda-group* "Phase1"
>
> *lock-on-active*
>
> *dialect* "mvel"
>
> *when*
>
> $universe : LibraryUniverse()
>
> $shelf : Shelf() *from* $universe.shelves
>
> $shelf2 : Shelf(*this* != $shelf) *from*$universe.shelves
>
> *then*
>
> System.out.println("Duplicate Shelves found::"+$shelf);
>
> // without the modify(), drools is not alerted about changes
>
> // $universe.shelves.remove($shelf);
>
> /*
>
> *modify*($universe) {
>
> shelves.remove($shelf);
>
> };
>
> */
>
>
>
> *end*
>
>
>
> *rule* "Singleton Shelf Detector"
>
> *agenda-group* "Phase1"
>
> *lock-on-active*
>
> *dialect* "mvel"
>
> *when*
>
> $universe : LibraryUniverse(shelves.size > 1)
>
> *then*
>
> System.out.println("Multiple Shelves found::"+$universe.shelves.size);
>
>
> *End*
>
>
>
>
>
>
>
> With Regards,
>
> Kanthi Swaroop Rongala
>
> * *
>
>
>
> ------------------------------
> NOTICE: If received in error, please destroy and notify sender. Sender does
> not intend to waive confidentiality or privilege. Use of this email is
> prohibited when received in error.
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
--
Edson Tirelli
JBoss Drools Core Development
JBoss by Red Hat @ www.jboss.com
16 years, 5 months
Re: [rules-users] Rule flow skip ruleSet node.
by liuzhikun
Thanks.I can't understand .When process reaches a ruleSet a ruleflow-group be set no-loop remain long time.Why is not reinitialize per reache a ruleSet?
liuzhikun
2009-11-03
16 years, 5 months
Drools Flow Persistence : How can I use Geronimo Transaction Manager Instead of Bitronix Transaction Manager.
by Pardeep.Ruhil@lntinfotech.com
Hi,
I have query regarding the Transaction Manager in Drools persistence.
I am working on OFBiz project an application in which I have integrated it
with Drools. When I try to use the persistence of Drools with OFBiz, there
is a transaction conflict between them. Since I want to use OFBiz
transaction manager i.e. Geronimo. So can you provide me the settings to
change the default Bitronix Transaction Manager to Geronimo Transaction
Manager.
BTW I am using Tomcat as an application server.
Thanks & Regards
Pardeep Ruhil
L&T Infotech Ltd
Mumbai
Ph: +919820283884
Larsen & Toubro Infotech Ltd.
www.Lntinfotech.com
This Document is classified as:
L&T Infotech Proprietary L&T Infotech Confidential L&T Infotech
Internal Use Only L&T Infotech General Business
This Email may contain confidential or privileged information for the
intended recipient (s) If you are not the intended recipient, please do
not use or disseminate the information, notify the sender and delete it
from your system.
______________________________________________________________________
16 years, 5 months