getFactHandle() returns null
by retoy
Has anybody ever had the problem that getFactHandle(object) returned null,
although the FactHandle is there when you iterate over the handles returned
by getFactHandles()?
Can anybody explain to me what the problem might be?
By the way: The object reference (getObject()) in the FactHandle I get
through getFactHandles() is identical to the one passed to getFactHandle(),
and the assertion mode doesn't matter...
Thanks!
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/getFactHandle-returns...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 4 months
are for loops possible in drools
by ceemh3
does anybody know if there is a way to do for loops in drools ?.
I am trying to loop through a list of string to see if one of the strings
matches a pattern e.g.
def listOfStrings = ['a','a.b','a.b.c']
for(String s:listOfStrings){
if(s matches "^a.b.*$"){
return true
}
}
I have written the following rule based on what documentation I could find,
but I dont think the syntax is correct
rule "Matcher"
when
TestClass : TestClass(($s matches "^a.b.*$") from listOfStrings,
count($s))
then
TestClass.setResponse( "Condition is True !!" );
end
I am finding it hard to find good documentation on the drl language
I would appreciate any help that anybody can give me
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/are-for-loops-possibl...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 4 months
Drools + EMF + CDO
by Georg Maier
Hi,
I'm trying to figure out an issue for three days now and I'm getting kind of
desperate, so I hope someone can help.
I'm using Drools in combination with an EMF model which is modeling a
computer network. On init, I read the whole structure of the model and insert
all elements into the working memory. Some of the entities share the super
class "Device" which has an attribute "state".
Now I'm having the following rule to change an attribute of one of the model
entities:
rule "Set received status to model"
when
$event : SomeEvent (
$hostname : hostname,
$hoststate : hoststate,
$timestamp : timestamp
)
$device : Device (
name == $hostname
)
then
modify($device) {
setState($hoststate);
}
db.commit(false);
retract($event);
System.err.println("Set status of " + $device + " to " +
$hoststate);
end
... which works perfectly fine. Anyway, what I want to do in this test case
is to react whenever all child devices of a mutual parent device (e.g. hosts
on one switch) are no longer reachable. I thought of a rule like the
following:
rule "Parent Children Test"
when
$parent : Device (
$children : eContents,
eContents.size > 0
)
forall (
$child : Device (
state == "DOWN"
) from $children
)
then
...
end
... which by the way worked perfectly fine as long as I was not using objects
from a model. My first idea was that for some strange reason the object might
get copied so that I actually would have two different references after
modifying it, but this is not the case. When I initialize the rule base with
the circumstances that the second rule would fire, it really does. It just
seems as it would not being evaluated after changing the attribute, but this
is not the case either! So all I can think of is some strange caching, maybe
in combination with the forall statement? Maybe someone has some experience
when using Drools with EMF + CDO and experienced as similar issue?
Any help would be very very very much appreciated!
Thanks in advance
Georg
14 years, 4 months
Activation attempts of rules
by Georg Maier
Hi,
is there a way to observe (during runtime) when Drools evaluates the
condition of which rule, meaning when it "tries" to activate a rule?
I'm having a bug in my program and I can't determine whether objects are out
of sync, there is a mistake in my rule or (and I started believing in that)
that the rule is actually not re-evaluated, so this would be a great help for
debugging.
Thanks in advance!
Georg
14 years, 4 months
Help regarding Guvnor 5.0 integration in secured application (https protocol)
by Swapnil Sawant
Hi,
I am implementing drools 5.0(Guvnor GUI) in my application (protocol for same is https)
For this purpose , I have set up drools 5.0 framework code needed to run the rules from my application. Also, I have integrated Guvnor GUi code inside my application itself.
While doing implementation, inside changeset.xml file I have written following code :
<change-set xmlns='http://drools.org/drools-5.0/change-set'
xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
xs:schemaLocation='http://drools.org/drools-5.0/change-set drools-change-set-5.0.xsd' >
<add>
<resource source='https://localhost:8441/drools-guvnor/org.drools.guvnor.Guvnor/package/Pay...' type='DRL' />//as I have integrated Guvnor GUI in my secured app
</add>
</change-set>
I have created a simple rule using Guvnor GUI (GUI code inside my application). When I run the same rule from my business layer, I get following security exception :
Message: Service [ruleService] target threw an unexpected exception (javax.net.ssl.SSLHandshakeException: sun.security.va
lidator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable
to find valid certification path to requested target)
---- cause ---------------------------------------------------------------------
Exception: java.lang.RuntimeException
Message: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.s
ecurity.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Then I changed the "changeset.xml" as follows :
<resource source='http://localhost:8441/drools-guvnor/org.drools.guvnor.Guvnor/package/Payr...' type='DRL' />
This time when I run the same rule , I got following error :
[2010:08:214 10:08:319:debug] ResourceChangeScanner subcribing notifier=org.drools.io.impl.ResourceChangeNotifierImpl@c40
88a to resource=[UrlResource path='http://localhost:8441/drools-guvnor/org.drools.guvnor.Guvnor/package/defa...
TEST.drl']
[2010:08:214 10:08:319:debug] KnowledgeAgent ChangeSet requires KnowledgeBuilder
[2010:08:214 10:08:319:debug] KnowledgeAgent rebuilding KnowledgeBase using ChangeSet
2010-08-02 10:53:34,615 (http-0.0.0.0-8441-2) [ ServiceDispatcher.java:515:INFO ] [[Sync service failed...- total:0.0,si
nce last(Begin):0.0]] - 'payroll / ruleService'
2010-08-02 10:53:34,615 (http-0.0.0.0-8441-2) [ TransactionUtil.java:344:INFO ] [TransactionUtil.rollback] transaction
rolled back
2010-08-02 10:53:34,615 (http-0.0.0.0-8441-2) [ TransactionUtil.java:269:WARN ] [TransactionUtil.commit] Not committin
g transaction, status is No Transaction (6)
2010-08-02 10:53:34,615 (http-0.0.0.0-8441-2) [ServiceEventHandler.java:352:ERROR]
---- exception report ----------------------------------------------------------
Service invocation error
Exception: org.ofbiz.service.GenericServiceException
Message: Service [ruleService] target threw an unexpected exception (java.net.SocketException: Unexpected end of file fro
m server)
---- cause ---------------------------------------------------------------------
Exception: java.lang.RuntimeException
Message: java.net.SocketException: Unexpected end of file from server
---- cause ---------------------------------------------------------------------
Exception: java.net.SocketException
Message: Unexpected end of file from server
---- stack trace ---------------------------------------------------------------
java.net.SocketException: Unexpected end of file from server
sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:769)
sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:766)
sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1000)
Finally, I tried deploying same rule on "Guvnor 5.0 GUI on my separate tomcat server(outside my secured app) ". When I give the "drl path" of this codebase on my separate Tomcat inside my changset.xml, things work fine.
I have a doubt as to is the error coming as I am trying to access a "https" url as "http" ?
Can any one pl help me in this regard. Any help of yours would be great help.Thanks in advance.
Regards,
Swapnil Sawant
________________________________
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.
______________________________________________________________________
14 years, 4 months
Re: [rules-users] Possible concurrency issue in Drools
by Norman C
All,
Just wanted to mention, I'm using version 5.0.1 of Drools.
Thanks,
Norman
________________________________
From: Norman C <rent_my_time(a)yahoo.com>
To: rules-users(a)lists.jboss.org
Sent: Sat, July 31, 2010 9:50:19 PM
Subject: Possible concurrency issue in Drools
Hi All,
I recently ran into an issue which I believe might point to a concurrency
issue. My server stopped processing new requests, so I did a thread dump. In
examining the dump, I found that all of the processing threads, save two, were
blocking while trying to acquire the lock in NamedEntryPoint.insert. Both of
the other two threads appeared to be infinitely looping in the
NamedEntryPoint.insert method. Here are snippets of the stack traces:
ActiveMQ Session Task" prio=10 tid=0x00002aab0003b000 nid=0x7b98 runnable
[0x000000004c086000..0x000000004c087c90] java.lang.Thread.State: RUNNABLE
at org.drools.util.ObjectHashMap.remove(ObjectHashMap.java:121) at
org.drools.common.SingleThreadedObjectStore.removeHandle(SingleThreadedObjectStore.java:150)
at org.drools.common.NamedEntryPoint.retract(NamedEntryPoint.java:296)
at org.drools.common.NamedEntryPoint.retract(NamedEntryPoint.java:245) at
org.drools.reteoo.ReteooWorkingMemory$WorkingMemoryReteExpireAction.execute(ReteooWorkingMemory.java:350)
at
org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:1488)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:158)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:122) at
org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:80) at
org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:28) at
ActiveMQ Session Task" prio=10 tid=0x000000005a35cc00 nid=0xdf6 runnable
[0x000000004a268000..0x000000004a269a90] java.lang.Thread.State: RUNNABLE
at org.drools.util.AbstractHashTable.resize(AbstractHashTable.java:115) at
org.drools.util.ObjectHashMap.put(ObjectHashMap.java:78) at
org.drools.common.SingleThreadedObjectStore.addHandle(SingleThreadedObjectStore.java:136)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:113)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:80) at
org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:28) at
So it seems like one while the first thread is holding the lock and is
attempting to remove an object handle from the object store in NamedEntryPoint,
the other thread is trying to resize that same object store in response to an
addHandle call that puts it over the threshold. I haven't worked out exactly
how these concurrent accesses to the same object store by two different threads
causes an infinite loop in both threads, but it seems like the call to
SingleThreadedObjectStore.addHandle should be preceded by acquiring the lock.
Is this correct? I can imagine that resizing a large hash map could potentially
take a long time and thus synchronizing this call could impact performance, but
somehow, the action of resizing the table must be protected in some way from
adversely impacting other operations on the table.
Any help would be appreciated.
thanks,
Norman
14 years, 4 months
Possible concurrency issue in Drools
by Norman C
Hi All,
I recently ran into an issue which I believe might point to a concurrency
issue. My server stopped processing new requests, so I did a thread dump. In
examining the dump, I found that all of the processing threads, save two, were
blocking while trying to acquire the lock in NamedEntryPoint.insert. Both of
the other two threads appeared to be infinitely looping in the
NamedEntryPoint.insert method. Here are snippets of the stack traces:
ActiveMQ Session Task" prio=10 tid=0x00002aab0003b000 nid=0x7b98 runnable
[0x000000004c086000..0x000000004c087c90] java.lang.Thread.State: RUNNABLE
at org.drools.util.ObjectHashMap.remove(ObjectHashMap.java:121) at
org.drools.common.SingleThreadedObjectStore.removeHandle(SingleThreadedObjectStore.java:150)
at org.drools.common.NamedEntryPoint.retract(NamedEntryPoint.java:296)
at org.drools.common.NamedEntryPoint.retract(NamedEntryPoint.java:245) at
org.drools.reteoo.ReteooWorkingMemory$WorkingMemoryReteExpireAction.execute(ReteooWorkingMemory.java:350)
at
org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:1488)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:158)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:122) at
org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:80) at
org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:28) at
ActiveMQ Session Task" prio=10 tid=0x000000005a35cc00 nid=0xdf6 runnable
[0x000000004a268000..0x000000004a269a90] java.lang.Thread.State: RUNNABLE
at org.drools.util.AbstractHashTable.resize(AbstractHashTable.java:115) at
org.drools.util.ObjectHashMap.put(ObjectHashMap.java:78) at
org.drools.common.SingleThreadedObjectStore.addHandle(SingleThreadedObjectStore.java:136)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:113)
at org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:80) at
org.drools.common.NamedEntryPoint.insert(NamedEntryPoint.java:28) at
So it seems like one while the first thread is holding the lock and is
attempting to remove an object handle from the object store in NamedEntryPoint,
the other thread is trying to resize that same object store in response to an
addHandle call that puts it over the threshold. I haven't worked out exactly
how these concurrent accesses to the same object store by two different threads
causes an infinite loop in both threads, but it seems like the call to
SingleThreadedObjectStore.addHandle should be preceded by acquiring the lock.
Is this correct? I can imagine that resizing a large hash map could potentially
take a long time and thus synchronizing this call could impact performance, but
somehow, the action of resizing the table must be protected in some way from
adversely impacting other operations on the table.
Any help would be appreciated.
thanks,
Norman
14 years, 4 months