Drools Guvnor - Testing rules
by Alan
Hi guys,
I'm validating some features of Drools Guvnor and I would like to have some
directions.
We've got a project that has a lot of rules(its not on drools already, but
we pretend to migrate it) and we would like to use Drools Guvnor to host
those rules and run some analysis on it.
I've seen some features but it still not clear, so I will list my doubts and
you can say, ok it does or no it doesn't do it.
*Do drools guvnor validate missing ends on rules? Ex: when age > 15 and sex
== 'F' then Y();(note that it doesn't cover age <= 15)
*Do it validate/find infinite loops?
*Do it validate duplicate cases?(ex: when age > 15 then Y(); when age > 14
then Y();)
Is there some resource (documentation) that covers what cases drools guvnor
can handle on rules validation?
Also, is there some more examples(projects) to deploy on Guvnor to test and
have some fun?
Thanks a lot,
Alan Araya
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Guvnor-Testing-rules-tp4023594.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months
getWorkingMemoryEntryPoint returns null - two rules with same name
by ScalaEnthusiast
All,
I was getting a null returned when requesting an entrypoint using
getWorkingMemoryEntryPoint("myEntryPoint") in BRMS 5.3.1 (Drools 5.3). To be
clear "myEntryPoint" is an entry point defined in my technical rule.
What was causing my issue was that there were two rules of the same name
(cut-n-paste error), one with the entry-point and one without. As soon as I
changed the name of one of the rules, I no longer received the null pointer
error - I was able to get the entry point from the session.
I am posting this for others who may run into this [edge] case and to see if
this would be considered a bug. The package source shows that the rule
without the entry point came first and the one with the entry-point was
second. Not sure how the system handles loading rules but I wouldn't think
two rules with the same name should be allowed. Is this a validation issue
that Guvnor needs to deal with?
Any thoughts from those in the know?
Thanks,
ScalaEnthusiast
--
View this message in context: http://drools.46999.n3.nabble.com/getWorkingMemoryEntryPoint-returns-null...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months
5.5.0-Final, persistence to MySQL
by Vytautas Gimbutas
Hello,
i'm having an issue with Drools 5.5.0-Final, stateful sessions and persistence to MySQL.
I have successfully configured and everything seems to work fine (session is persisted & updated to database), however
sometimes after i kill (not after each kill) and start again application I'm unable to load back session.
I get this exception when I try to load session:
> Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as lastModi2_0_0_, sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as startDate0_0_, sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where sessioninf0_.id=?
> java.lang.IllegalStateException: java.lang.reflect.InvocationTargetException
> at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.buildCommandService(KnowledgeStoreServiceImpl.java:115)
> at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.loadStatefulKnowledgeSession(KnowledgeStoreServiceImpl.java:83)
> at org.drools.persistence.jpa.JPAKnowledgeService.loadStatefulKnowledgeSession(JPAKnowledgeService.java:131)
> at lt.mokejimai.ss.engine.Engine.getSession(Engine.java:57)
> at lt.mokejimai.ss.engine.Engine.insert(Engine.java:38)
> at lt.mokejimai.ss.api.rest.endpoint.InspectEndpoint.inspectTransactions(InspectEndpoint.java:61)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:155)
> at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257)
> at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222)
> at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:211)
> at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:525)
> at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:502)
> at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119)
> at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
> at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
> at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
> at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:565)
> at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:479)
> at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
> at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
> at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
> at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1031)
> at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)
> at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
> at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:965)
> at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
> at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250)
> at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)
> at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
> at org.eclipse.jetty.server.Server.handle(Server.java:349)
> at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:452)
> at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:884)
> at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:938)
> at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:634)
> at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230)
> at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:77)
> at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:609)
> at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:45)
> at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599)
> at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534)
> at java.lang.Thread.run(Thread.java:680)
> Caused by: java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
> at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.buildCommandService(KnowledgeStoreServiceImpl.java:100)
> ... 45 more
> Caused by: java.lang.RuntimeException: Unable to load session snapshot
> at org.drools.persistence.SessionMarshallingHelper.loadSnapshot(SessionMarshallingHelper.java:96)
> at org.drools.persistence.SingleSessionCommandService.initKsession(SingleSessionCommandService.java:253)
> at org.drools.persistence.SingleSessionCommandService.<init>(SingleSessionCommandService.java:195)
> ... 50 more
> Caused by: java.lang.NullPointerException
> at org.drools.common.ConcurrentNodeMemories.getNodeMemory(ConcurrentNodeMemories.java:63)
> at org.drools.common.AbstractWorkingMemory.getNodeMemory(AbstractWorkingMemory.java:1034)
> at org.drools.rule.SlidingTimeWindow$BehaviorExpireWMAction.<init>(SlidingTimeWindow.java:460)
> at org.drools.marshalling.impl.PersisterHelper.deserializeWorkingMemoryAction(PersisterHelper.java:101)
> at org.drools.marshalling.impl.ProtobufInputMarshaller.readActionQueue(ProtobufInputMarshaller.java:426)
> at org.drools.marshalling.impl.ProtobufInputMarshaller.readSession(ProtobufInputMarshaller.java:260)
> at org.drools.marshalling.impl.ProtobufInputMarshaller.readSession(ProtobufInputMarshaller.java:158)
>> at org.drools.marshalling.impl.ProtobufMarshaller.unmarshall(ProtobufMarshaller.java:117)Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as lastModi2_0_0_, sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as startDate0_0_, sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where sessioninf0_.id=?
>
> Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as lastModi2_0_0_, sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as startDate0_0_, sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where sessioninf0_.id=?
> Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as lastModi2_0_0_, sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as startDate0_0_, sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where sessioninf0_.id=?
> Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as lastModi2_0_0_, sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as startDate0_0_, sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where sessioninf0_.id=?
> Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as lastModi2_0_0_, sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as startDate0_0_, sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where sessioninf0_.id=?
> Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as lastModi2_0_0_, sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as startDate0_0_, sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where sessioninf0_.id=?
> Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as lastModi2_0_0_, sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as startDate0_0_, sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where sessioninf0_.id=?
> Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as lastModi2_0_0_, sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as startDate0_0_, sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where sessioninf0_.id=?
> Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as lastModi2_0_0_, sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as startDate0_0_, sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where sessioninf0_.id=?
> Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as lastModi2_0_0_, sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as startDate0_0_, sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where sessioninf0_.id=?
> Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as lastModi2_0_0_, sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as startDate0_0_, sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where sessioninf0_.id=?
> Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as lastModi2_0_0_, sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as startDate0_0_, sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where sessioninf0_.id=?
> Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as lastModi2_0_0_, sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as startDate0_0_, sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where sessioninf0_.id=?
> Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as lastModi2_0_0_, sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as startDate0_0_, sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where sessioninf0_.id=?
> Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as lastModi2_0_0_, sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as startDate0_0_, sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where sessioninf0_.id=?
> Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as lastModi2_0_0_, sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as startDate0_0_, sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where sessioninf0_.id=?
> Hibernate: select sessioninf0_.id as id0_0_, sessioninf0_.lastModificationDate as lastModi2_0_0_, sessioninf0_.rulesByteArray as rulesByt3_0_0_, sessioninf0_.startDate as startDate0_0_, sessioninf0_.OPTLOCK as OPTLOCK0_0_ from SessionInfo sessioninf0_ where sessioninf0_.id=?
<…>
--
Vytautas Gimbutas
11 years, 7 months
Decision table -1 java file per rule - optimization
by jalex
Hi,
I noticed that each row in the decision table speadsheet is converted to a
separate java file during runtime (ex:
Rule_Pricing_bracket_352_941a618e0e72407d89d04664d5809e7f.java) . This will
lead to the number of classes increasing as the number of rules grow. Is
there a way to optimize such that all rules in 1 spreadsheet gets converted
to a single java file?
Sample logs during runtime, each "rule applied" log corresponds to firing
of a single row
04/29/2013 15:33:22,434 DEBUG [http-9080-1]
(Rule_Pricing_bracket_352_941a618e0e72407d89d04664d5809e7f.java:8)
aa410236-727c-4d48-8761-79088dca9b31 Rule applied: Default_A_rule40
04/29/2013 15:33:22,435 DEBUG [http-9080-1]
(Rule_Pricing_bracket_201_e2c74982a30d4e8eb128f07fbba73803.java:8)
aa410236-727c-4d48-8761-79088dca9b31 Rule applied: Default_B_rule40
04/29/2013 15:33:22,436 DEBUG [http-9080-1]
(Rule_Pricing_bracket_50_5de087aa5a3345adbc06748474dc53b3.java:8)
aa410236-727c-4d48-8761-79088dca9b31 Rule applied: Default_C_rule40
--
View this message in context: http://drools.46999.n3.nabble.com/Decision-table-1-java-file-per-rule-opt...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 7 months
having trouble using accumulate to create a list of non null objects
by burmanator
I have 2 objects, Foo and Bar. Foo can store an instance of Bar. I am trying
to create a list of all the Bar objects that correspond to all the Foo
objects with a given name.
the line in my rule I am using is:
Foo($name : Name)
$list : List() from accumulate( Foo( Name == $name, $b : Bar != null),
collectList($b))
Yet when I print out the list, it includes null elements. But if I instead
make the rule:
$list : List() from accumulate( Foo( Name == $name, $b : Bar != null),
collectList($b!=null))
I get false for all the null Bar objects.
Am I missing something?
--
View this message in context: http://drools.46999.n3.nabble.com/having-trouble-using-accumulate-to-crea...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 8 months
KnowledgeAgent to update knowledge base built with Guvnor pkg
by riri
Hello everyone,
I am trying to take advantage of the automatic uploading that the
KnowledgeAgent provides and am using the 5.5.Final Drools version. The
Drools Expert documentation states that one can use an existing knowledge
base to create an agent, and the agent will subscribe to the resources that
it finds (Example 3.26. Using an existing KnowledgeBase).
I am at first creating the knowledge base using a set of .drl files defined
in a change-set file and also a Guvnor url :
http://127.0.0.1:8080/guvnor/org.drools.guvnor.Guvnor/package/<package-name>/LATEST.
I then create the knowledge agent as shown in Example 3.26 of the
documentation. The problem is that if I modify the Guvnor package (add or
remove a rule) and then rerun a stateful knowledge session, the knowledge
base is not updated. I thought that I needed to build the package in Guvnor
every time I modify it but doing so does not solve the problem. Modifying
the rules in the change-set files seems to update the knowledge base.
I start the ResourceChangeScanner and ResourceChangeNotifier and if I call
isMonitorChangeSetEvents() and isScanResources() they return true. And also,
whenever I create a session, I use the getKnowledgeBase() method and am not
caching it somewhere in my program. Should I not be creating the agent with
an existing knowledge base and instead use the applyChangeSet() method? If
so, how would I be able to configure the knowledge base to use
AssertBehaviorOption.EQUALITY?
Thany you very much for any help or tips to point me in the right direction.
Best regards
--
View this message in context: http://drools.46999.n3.nabble.com/KnowledgeAgent-to-update-knowledge-base...
Sent from the Drools: User forum mailing list archive at Nabble.com.
11 years, 8 months