Exception Thrown When Dispose KSession in JPA Persistence Environment
by Rui Tang
Hi list,
I have a simple program using drools-persistence-jpa library.
StatefulKnowledgeSession session = null;
try {
ksession = JPAKnowledgeService.newStatefulKnowledgeSession(this.kbase,
null, env);
ksession.execute(myCustomCommand);
} finally {
if (ksession != null) {
ksession.dispose();
}
}
if ksession.execute statement throws an exception, then ksession.dispose
statement will throw another fancy exception like this:
java.lang.RuntimeException: Could not find session data for id 473
at
org.drools.persistence.session.SingleSessionCommandService.initKsession(SingleSessionCommandService.java:183)
at
org.drools.persistence.session.SingleSessionCommandService.execute(SingleSessionCommandService.java:272)
My environment is like following:
1. I use JTA to manage tx across several sessions.
2. I set a global EntityManagerFactory, TransactionFactory and a
UserTransaction to the env variable when initialize the ksession.
I think this exception occurred because of this:
When I execute my custom command, a user tx is opened, but when exception
occurs, this tx is rolled back. But in ksession.dispose statement, it will
use the uncommited session id to retrieve the persisted ksession, then
exception is thrown.
My questing is that, do I really need to put ksession.dispose in the finally
block to force the ksession to dispose even when exception occurred. If not
won't that matter? If yes how to deal with the exception, add another
try/catch block around the ksession.dispose statement?
Thank you in advance.
--
唐睿
14 years
Re: [rules-users] Rules selection logic
by Greg Barton
Also, the use of doubles in an == test is problematic. Not that it would cause this particular problem, but it will cause others.
GreG
On Nov 13, 2010, at 11:52, Wolfgang Laun <wolfgang.laun(a)gmail.com> wrote:
Are you using the latest (5.1.1) release?
Is the duplicated rule in another DRL file and does it have exactly the same name? If so, it simply overwrites the first rule.
If it's different, please create a JIRA with a minimized example reproducing the error.
-W
On 13 November 2010 14:12, balagh <bala.ganesh(a)accenture.com> wrote:
Hi,
Below is the DRl used. When i have two different rules with the same below
DRL, only one rule is getting executed. I could find that in my logs. If i
change the line to Ransome(amr <= 10) in any one of the rule, both of them
are getting executed.
I am having the rules in db and the execution trace log will have the rules
no which gets executed
Rule "rule -1"
when
loose : Loose()
ransome : Ransome(amt == 6.15) from loose.getRansomeArray(0)
util : Util()
then
util.doIt(loose, "Hello");
end
Thanks,
Bala
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Rules-selection-logic...
Sent from the Drools - User mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
14 years
Rules Flow production level support
by Prafull Kumar
Hi All,
I would like to know the possible options of production level support for Drools
Flow 5.1. Please share the links if support is available from JBoss or any 3rd
party.
Regards, Prafull
14 years
Fw: Rules Flow Eclipse editor
by Prafull Kumar
Hi All,
I would like to know how we can modify the Rules flow eclipse editor look and
feel and functionality. e.g. If we have a Embedded Sub-Process in the flow and
reduce the size of it, the arrows are still displayed in the main canvas. Please
see the attached snapshot for reference.
How we can fix it? also if we want to open the Embedded Sub-Process in a new
window for easy maintainability/readability of the very complex processes, how
we can achieve it?
Going forward we are also looking to create the custom editor for the nodes.
Please guide us if its possible and there is any document for this.
Regards, Prafull
14 years
User Experience with multiple users in Guvnor
by John Peterson
I have a question for users out there working with Guvnor. Do you have
more than one user working on rules within the same package at the same
time? How are you handling versioning and testing, especially if the
changes are not going out at the same time?
We've been experimenting with Guvnor (5.0.1) and multiple users and
we're finding that if user A gets something that parses with an error,
it carries over to all the other users when they attempt to validate
their rules. This has been confusing because the error is not with
their code but with something else completely (like a Function with an
error, and they're working on a rule). It seems to us that multiple
users working on the same package in Guvnor would require a lot of
coordination.
Anyone have some wisdom or lessons learned you'd be willing to share?
14 years
accumulate vs collect
by rouvas@di.uoa.gr
Hi List,
I'm trying to count the number of objects I have in the Working Memory
using accumulate, but I'm having a ClassCastException thrown at me.
Using a variant with collect, everything work OK.
Can someone shed some light on this issue?
Is it related to https://jira.jboss.org/browse/JBRULES-2202 ?
I'm using Drools.5.0.1 and the fact is a declared one, as follows:
declare t_1
regRowId : String
versionId : String
c_7 : String
c_1 : String
c_2 : String
c_3 : String
c_4 : String
c_5 : String
c_6 : Double
end
trying with :
v945 : Number ( doubleValue >= 1 ) from accumulate ( p : t_1 ( c_6 >=
20100511 && c_7 == "5" ) , count(p) )
I'm getting a ClassCastException:t_1, while using :
v945 : ArrayList ( size >= 1 ) from collect ( t_1 ( c_6 >= 20100511 &&
c_7 == "5" ) )
works OK.
The reason I'm preferring accumulate over collect, is that I'm not really
interested in constructing an ArrayList of the matched facts (worries
about memory consumption), all I want is how many of them are there.
The actual rule I'm using (although I don't think it matters) for the
accumulate variant, is:
rule "r95944.6"
dialect "mvel"
when
gnId : GoodNumbers()
LogicalValue : Trader( gnId.goodNo==goodNo )
v945 : Number ( doubleValue >= 1 ) from accumulate ( p : t_1 ( c_6
>= 20100511 && c_7 == "5" ) , count(p) )
then
RaResultCode rrc = new RaResultCode();
rrc.setResultRuleId("95944");
rrc.setResultRuleVersionId("6");
rrc.setResultColor("R");
rrc.setResultRuleCode("01");
rrc.setResultAction("1");
rrc.setResultGoodNo(gnId.goodNo);
insertLogical(rrc);
end
Thank you for your time.
-Stathis
14 years
Rules Flow Eclipse editor
by Prafull Kumar
Hi All,
I would like to know how we can modify the Rules flow eclipse editor look and
feel and functionality. e.g. If we have a Embedded Sub-Process in the flow and
reduce the size of it, the arrows are still displayed in the main canvas.
How we can fix it? also if we want to open the Embedded Sub-Process in a new
window for easy maintainability/readability of the very complex processes, how
we can achieve it?
Please see the attached snapshot for reference.
Going forward we are also looking to create the custom editor for the nodes.
Please guide us if its possible and there is any document for this.
Regards, Prafull
14 years
Removing facts from statefulknowledgeSession's memory
by Ayush
Hi,
In my drools implementation I'm inserting all my facts into working memory
and for every fact received I'm also inserting events into notification
stream.
Now the StatefulKnowledgeSession I'm using is static and it is neither
initialized nor disposed after being initialized for first time. My
application will run for months without restarting and so the same session
will be used without being reinitialized or disposed.
Do I have to retract events explicitly or will it handled by drools
internally? If not then how can I retract them say after 5 minutes?
Also I'm using sliding window and I've not explicitly declared expiry time,
for events, in my drl file. Should I define it or will drools remove them
after the maximum sliding window time defined in rules?
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Removing-facts-from-s...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years
Loading StatefulKnowledgeSession and Session-ID-Concept
by O.S.
Hi,
I have a question concerning the id-concept of StatefullKnowledgeSessions:
int sessionId = ksession.getId();
While looking up the KnowledgeStoreService-Interface I was a little bit
confused about the loadStatefulKnowledgeSession(...) Method:
|*loadStatefulKnowledgeSession*(int id, KnowledgeBase kbase,
KnowledgeSessionConfiguration configuration, Environment environment)|
I think the first parameter is the session id (see above). But why does
he needs the kbase, config and environment too? Is the session id not
global? Is she bound to one or more of the Classes/Instances
(|kbase|,|configuration,||environment)|?
||
|If the id| is bound, it will implicitly mean that there can be more
than one ksessions with the same id?
Kind regards,
O.S.
||
14 years