Howto obtain collection of all matched events in rule
by IK81
Dear all,
I am looking for a convenient way to obtain all events that lead to the
firing of the rule in the then-part of a rule. I know that I can build
this collection by explicitly creating a collection and adding all the
events listed in the when part, but I am looking for something more
convenient.
I already discovered that one can access this information in the
beforeMatchFired event through getMatch().getObjects(), but I need to
access this in the then-part of the rule. How do I obtain the match
object there?
Best regards,
Ingo
11 years, 2 months
Is there any limitation about the length of attribute's name when declare type in drl file
by richie
Hi all,Is there any limitation about the length of attribute's name when
declare type in drl file?
I encountered a problem these days, I declared a new type in rule file, when
fire rules, it always throw java.lang.ClassCaseException: test.obj cannot be
cast to test.obj. As I inspected, this is caused by the length of an
attribute's name is too long, it's 35 characters, if I remove this
attribute, there's no exception.
Following is snippet of my rule file:
package testdeclare obj@propertyReactivetype : Stringname :
Stringattribute_name_too_long_reach_limitation: Booleanendrule "a"dialect
"mvel"salience 0no-loopwhen$obj:obj(type == "a")thenmodify ($obj) {name =
"abc"};end
--
View this message in context: http://drools.46999.n3.nabble.com/Is-there-any-limitation-about-the-lengt...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 2 months
Drools 5.5.0 memory leak
by Matteo Cusmai
Hi all,
I am not sure if anyone has already raised this issue.
I am using drools fusion 5.5.0 with very large fact/events.
After 2 hours I have a out of memory exception.
I have analyzed the dump file (hprof) with eclipse memory analyzer.
If it could be useful I can post the html reports.
Thanks a lot,
Matteo.
11 years, 3 months
ksession persistence (from docs) - not getting it to work
by amarok
I try to persist a knowledge session using the example code from Drools
5.5.0-Final Documentation. And I am stuck with following exception:
javax.persistence.PersistenceException: [PersistenceUnit:
org.drools.persistence.jpa] Unable to build EntityManagerFactory
at
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:924)
at
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:899)
[...]
Caused by: org.hibernate.service.jndi.JndiException: Error parsing JNDI name
[jdbc/BitronixJTADataSource]
at
org.hibernate.service.jndi.internal.JndiServiceImpl.parseName(JndiServiceImpl.java:92)
at
org.hibernate.service.jndi.internal.JndiServiceImpl.locate(JndiServiceImpl.java:63)
[...]
Caused by: javax.naming.OperationNotSupportedException
at bitronix.tm.jndi.BitronixContext.getNameParser(BitronixContext.java:147)
at javax.naming.InitialContext.getNameParser(InitialContext.java:480)
at
org.hibernate.service.jndi.internal.JndiServiceImpl.parseName(JndiServiceImpl.java:86)
... 42 more
Probably I did some configuration mistake. This is my setup:
1) I added following dependencies (via maven)
drools-persistence-jpa, btm (bitronix), h2 (database),
hibernate-entitymanager
2) I created a hibernate.cfg.xml, persistence.xml and jndi.properties file
(I put the jndi.properties file in resources/META-INF ( is this correct/
related to the error ?))
3) I made all my fact classes serializable
4) I added this code:
PoolingDataSource ds = new PoolingDataSource();
ds.setUniqueName( "jdbc/BitronixJTADataSource" );
ds.setClassName( "org.h2.jdbcx.JdbcDataSource" );
ds.setMaxPoolSize( 3 );
ds.setAllowLocalTransactions( true );
ds.getDriverProperties().put( "user", "sa" );
ds.getDriverProperties().put( "password", "sasa" );
ds.getDriverProperties().put( "URL", "jdbc:h2:mem:mydb" );
ds.init();
org.drools.runtime.Environment env =
KnowledgeBaseFactory.newEnvironment();
EntityManagerFactory emf =
Persistence.createEntityManagerFactory("org.drools.persistence.jpa");
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
env.set(EnvironmentName.TRANSACTION_MANAGER,
TransactionManagerServices.getTransactionManager());
env.set(EnvironmentName.GLOBALS, new MapGlobalResolver());
StatefulKnowledgeSession ksession =
JPAKnowledgeService.newStatefulKnowledgeSession(kbase, null, env);
This is my Hibernate config:
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate
Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="dialect">org.hibernate.dialect.H2Dialect</property>
<property name="connection.driver_class">org.h2.Driver</property>
<property name="connection.username">sa</property>
<property name="connection.password">sa</property>
<property name="connection.url">jdbc:h2:file:db/drools</property>
</session-factory>
</hibernate-configuration>
This is my persistence.xml:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd
http://java.sun.com/xml/ns/persistence/orm
http://java.sun.com/xml/ns/persistence/orm_1_0.xsd">
<persistence-unit name="org.drools.persistence.jpa" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/BitronixJTADataSource</jta-data-source>
<class>org.drools.persistence.info.SessionInfo</class>
<class>org.drools.persistence.info.WorkItemInfo</class>
<properties>
<property name="hibernate.dialect"
value="org.hibernate.dialect.H2Dialect" />
<property name="hibernate.max_fetch_depth" value="3" />
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.BTMTransactionManagerLookup" />
</properties>
</persistence-unit>
</persistence>
jndi.properties:
java.naming.factory.initial=bitronix.tm.jndi.BitronixInitialContextFactory
--
View this message in context: http://drools.46999.n3.nabble.com/ksession-persistence-from-docs-not-gett...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 3 months
Not able to fetch values from a list in Guvnor web based decision table
by ashish6276
Hi All,
I have a request with /market/ which is a list of /market info/ something
like this :
*<complexType name="RuleRequest">
<sequence>
<element name="Market" type="tns:MarketInfo" maxOccurs="unbounded" />
</sequence>
</complexType>
<complexType name="MarketInfo">
<sequence>
<element name="region" type="String">
</element>
<element name="country" type="String">
</element>
</sequence>
</complexType>*
While writing DRL like this I am able to fire the rules:
*when
hotelReq : HotelRequest ($market : market != null )
MarketInfo( region == "NA") from $market
then
System.out.println("Done");
end*
But am not able to achieve the same thing in web guided editor in
Guvnor(Decision table).
I came close enough to write the below in web based editor but could not
succeed in firing the rules.
*when
hotelRequest : HotelRequest( $market : market != null )
marketInfo : MarketInfo( region == "NA" ) from entry-point
"$market"
then*
Any help will be appreciated.
Thanks in advance.
--
View this message in context: http://drools.46999.n3.nabble.com/Not-able-to-fetch-values-from-a-list-in...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 3 months
error while firing rules from drools guvnor web guided editor.
by ashish6276
Hi
I am using drools guvnor 5.2.1. I am exploring drools decision table
option on this. When i am trying to fire the rules from my java code It
gives me following error.
[9/27/13 11:47:29:499 IST] 00000028 SystemOut O Before firing
[9/27/13 11:47:32:226 IST] 00000028 FireRuleTask E
com.aexp.travel.rules.service.FireRuleTask fireRule Error in executing rules
:
com.aexp.travel.rules.RuleEngineException:
Error executing rules:
at
com.aexp.travel.rules.drools.DroolsRuleExecutor.executeRules(DroolsRuleExecutor.java:45)
at
com.aexp.travel.rules.service.FireRuleTask.fireRule(FireRuleTask.java:55)
at
com.aexp.travel.rules.service.RuleEngineService.fireOffGDSInclusionRule(RuleEngineService.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:599)
at
com.sun.xml.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:250)
at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:150)
at
com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:261)
at
com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:100)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:641)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:600)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:585)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:482)
at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:314)
at
com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:608)
at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:259)
at
com.sun.xml.ws.transport.http.servlet.ServletAdapter.invokeAsync(ServletAdapter.java:207)
at
com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:159)
at
com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:194)
at
com.sun.xml.ws.transport.http.servlet.WSSpringServlet.doPost(WSSpringServlet.java:52)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:738)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1443)
at
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:790)
at
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:443)
at
com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:175)
at
com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:91)
at
com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:859)
at
com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1557)
at
com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:173)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:272)
at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at
com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at
com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at
com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:202)
at
com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:766)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:896)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1527)
Caused by: org.drools.runtime.rule.ConsequenceException: rule: Row 1
RegionBasedRules
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.fireAllRules(DefaultAgenda.java:1251)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:737)
at
org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:701)
at
org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218)
at
com.aexp.travel.rules.drools.DroolsRuleExecutor.executeRules(DroolsRuleExecutor.java:42)
... 44 more
Caused by: [Error: null pointer or function not found: setErrorRemark]
[Near : {... HotelREs.setErrorRemark( "welc ....}]
^
[Line: 1, Column: 1]
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(ReflectiveAccessorOptimizer.java:996)
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:368)
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:140)
at org.mvel2.ast.ASTNode.optimize(ASTNode.java:154)
at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:110)
at org.mvel2.MVELRuntime.execute(MVELRuntime.java:86)
at
org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:122)
at
org.mvel2.compiler.CompiledExpression.getValue(CompiledExpression.java:115)
at org.mvel2.MVEL.executeExpression(MVEL.java:928)
at org.drools.base.mvel.MVELConsequence.evaluate(MVELConsequence.java:105)
at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1091)
... 50 more
[9/27/13 11:47:32:320 IST] 00000028 SystemOut O After Firing
I am not geting reason for this error.
--
View this message in context: http://drools.46999.n3.nabble.com/error-while-firing-rules-from-drools-gu...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 3 months
Manners Benchmark broken!?
by ru
Hello drools-community,
I tried to run Manners Benchmark test and got this error message:
assign first seat : [Seating id=1 , pid=1 , pathDone=true , leftSeat=1,
leftGuestName=128, rightSeat=1, rightGuestName=128] : [Path id=1, seat=1,
guest=128]
find seating : [Seating id=2 , pid=1 , pathDone=false , leftSeat=1,
leftGuestName=128, rightSeat=2, rightGuestName=123] : [Path id=2, seat=2,
guest=123] : {Chosen id=1, name=123, hobbies=h2}
find seating : [Seating id=3 , pid=1 , pathDone=false , leftSeat=1,
leftGuestName=128, rightSeat=2, rightGuestName=122] : [Path id=3, seat=2,
guest=122] : {Chosen id=1, name=122, hobbies=h2}
Exception in thread "AWT-EventQueue-0" Exception executing consequence for
rule "pathDone" in org.drools.benchmark.manners:
java.lang.ClassCastException: org.drools.benchmark.manners.Seating cannot be
cast to org.drools.benchmark.manners.Context
at
org.drools.core.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39)
at
org.drools.core.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1026)
at org.drools.core.phreak.RuleExecutor.fire(RuleExecutor.java:128)
at
org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:68)
at
org.drools.core.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:936)
at
org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1183)
at
org.drools.core.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:936)
at
org.drools.core.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:910)
at
org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:233)
at
org.drools.benchmark.manners.MannersBenchmark.main(MannersBenchmark.java:94)
at
org.drools.benchmark.DroolsBenchmarkExamplesApp$1.actionPerformed(DroolsBenchmarkExamplesApp.java:59)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
at
javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.Component.processMouseEvent(Component.java:6505)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3312)
at java.awt.Component.processEvent(Component.java:6270)
at java.awt.Container.processEvent(Container.java:2229)
at java.awt.Component.dispatchEventImpl(Component.java:4861)
at java.awt.Container.dispatchEventImpl(Container.java:2287)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
at java.awt.Container.dispatchEventImpl(Container.java:2273)
at java.awt.Window.dispatchEventImpl(Window.java:2719)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:694)
at java.awt.EventQueue$3.run(EventQueue.java:692)
at java.security.AccessController.doPrivileged(Native Method)
at
java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at
java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:708)
at java.awt.EventQueue$4.run(EventQueue.java:706)
at java.security.AccessController.doPrivileged(Native Method)
at
java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
Caused by: java.lang.ClassCastException:
org.drools.benchmark.manners.Seating cannot be cast to
org.drools.benchmark.manners.Context
at
org.drools.benchmark.manners.Rule_pathDone929756542DefaultConsequenceInvokerGenerated.evaluate(Unknown
Source)
at
org.drools.benchmark.manners.Rule_pathDone929756542DefaultConsequenceInvoker.evaluate(Unknown
Source)
at
org.drools.core.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1016)
... 45 more
--
View this message in context: http://drools.46999.n3.nabble.com/Manners-Benchmark-broken-tp4026131.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 3 months
Fusion 5.5 - Deterministically identifying event insert order?
by dunnlow
I am testing with fusion (5.5) and running into an /intermittent /issue. I
am trying to track transitions between two big events (BEvent) using a
smaller event (SEvents) with the properties I care about. The idea is that
I will maintain many SEvents in memory for the different kinds of BEvents.
My basic steps (partly driven by salience) are:
1) rule a: (salience=100): when a new BEvent is inserted, insert a new
related SEvent
2) rule b: (salience=50): If there are two SEvents for this type of BEvent,
compare them (old vs new) and act accordingly
3) rule c: (salience=0) remove the *old* SEvent (keeping the latest one)
4) rule d: (salience=-50) retract the BEvent
My rule c (above) is:
when $se1 : SEvent(name matches "auto")
$se2 : SEvent(this after $se1, style matches ($se1.style))
then
retract($se1);
end;
I am of course running in stream mode and this USUALLY works, but sometimes
rule c does not get activated - based on the audit log. Also, I have a
DebugWorkingMemoryEventListener configured and I can see that two SEvents DO
exist in working memory which should activate it.
In my test, I have a loop in which I am inserting events. When I add a
brief delay, I have not seen a failure. My guess is that the timestamps on
the two events are the same, thus the "after" is causing the issue.
However, I am unable to test this as the timestamp on the event is not
accessible (from what I have found on this forum).
I saw a suggestion here about using a variable on my SEvent to tell the
difference between a new and old version. I also considered using some sort
of counter bean to order the SEvents (although I believe it would need to be
serialized).
My questions:
1) Do you agree with my assessment? Is it possible in stream mode to have
two events with the same timestamp?
2) what is the BEST way to identify which event was inserted first?
Thanks for any insight!
-J
--
View this message in context: http://drools.46999.n3.nabble.com/Fusion-5-5-Deterministically-identifyin...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 3 months