replace session clock at runtime
by Alexander Wolf
Drools 5.5
Hey guys,
Is it possible to replace the session clock of an existing stateful knowledge session (STREAM mode) while it is running or at least by pausing and restarting it?
I need to feed old events into the session to restore a certain session state before switching the sessions to "realtime" mode and continue with new incoming events...
A code snippet would make me very happy ;)
- Alex
12 years, 3 months
Reevaluate rules on collect
by gboro54
I have the following three rules:
rule "Create Acct Context"
when
$Acct:Acct()
not (exists(AcctContext(Acct ==$Acct)))
then
insert(new AcctContext($Acct));
end
rule "Add Acct Statuses to AcctContext"
no-loop true
when
$AcctContext:AcctContext($Acct:Acct)
$AcctStatuses : List()
from collect ( AcctPerformanceStatus(acctId==$Acct.id))
then
modify($AcctContext) {addAllAcctStatuses($AcctStatuses) };
end
rule "Test"
when
AcctContext(getAcctStatus("Test1")!=null)
then
System.out.println("Good!");
end
I would expect that after the first 2 rules fire, that my 3rd rule would
fire if the data is there successfully(which I have done in my unit test).
However the 3rd rule never fires. Any thoughts into how to accomplish this?
We are using drools 5.5 so perhaps property reactive? These rules are
creating a context/wrapper object to make decision tables easier to
write/manage for our business users.
Thanks!
--
View this message in context: http://drools.46999.n3.nabble.com/Reevaluate-rules-on-collect-tp4026194.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 3 months
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
12 years, 3 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.
12 years, 3 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.
12 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.
12 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.
12 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.
12 years, 3 months