Re: [rules-users] Starting optaplanner with your own initialized solution
Hi, OptaPlanner should be able to start with your initialized solution and let localSearch attempt to optimize it. You should not need to have a custom solver phase for this. Is your score calculation correct? What is the score of the solution when you run with actual start time populated vs when you leave start time as null? If you turn on debug logging for package org.optaplanner you should get some more info on what goes on inside the solver. Regards, Mattias - Original Message - From: paavanm paavan.mat...@clairvoyantsoft.com To: rules-users@lists.jboss.org Sent: Wednesday, 20 August, 2014 11:42:56 PM Subject: [rules-users] Starting optaplanner with your own initialized solution I have a relatively simple question. How do I have OptaPlanner use my own initialized solution as a starting point instead of having a construction heuristic create one? Does this have to be done with a custom SolverPhase? A little more detail on what I'm trying to do: I am scheduling a series of classes and related activities on a calendar. Let's say I have some class BA101 that occurs several times a week (these classes are immovable entities). There are homeworks, exams etc. associated with these classes which I need to schedule. E.g. on Feb 1st, a homework might be due, or on Mar 1st, there might be an exam. So I need to schedule time to do the homework or time to study for the exam. My initial solution for this would be very simple: I would schedule the homework/study time at the same time of the class itself, and let optaplanner move it around till it meets my hard soft constraints. However, when I tried to do that (i.e. give my homework/study tasks an actual start time instead of just leaving the start time as null), OptaPlanner fell right through without actually making any moves to find the best score. How do I do this? This is my config at the moment, pretty basic (tried this with without the construction heuristic; same result): ?xml version=1.0 encoding=UTF-8? solver solutionClasscom.copilot.optaplanner.domain.ActivityScheduler/solutionClass planningEntityClasscom.copilot.optaplanner.domain.Activity/planningEntityClass scoreDirectorFactory scoreDefinitionTypeHARD_SOFT/scoreDefinitionType simpleScoreCalculatorClasscom.copilot.optaplanner.solver.score.ActivitySchedulingSimpleScoreCalculator/simpleScoreCalculatorClass /scoreDirectorFactory termination maximumSecondsSpend10/maximumSecondsSpend /termination constructionHeuristic constructionHeuristicTypeFIRST_FIT/constructionHeuristicType /constructionHeuristic localSearch acceptor entityTabuSize7/entityTabuSize /acceptor forager acceptedCountLimit1000/acceptedCountLimit /forager /localSearch /solver Thanks for any assistance. -- View this message in context: http://drools.46999.n3.nabble.com/Starting-optaplanner-with-your-own-initialized-solution-tp4030697.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users -- Mattias Nilsson Grip Redpill Linpro AB - Changing the game Tel: +46 734 09 22 34 ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] debug
Hi Kevin, did you try the workaround I suggested; setting rule dialect to mvel? That works for me. There is a JIRA issue for the problem with debugging Java rules here: https://issues.jboss.org/browse/JBRULES-3676 I created a pull request for it a few weeks ago but I don't think anyone from the core team have had a look at it yet. So if you think this is an important bug you could always vote for the JIRA! :-) Regards, Mattias - Original Message - From: Kevin Kelleher kelleher_ke...@hotmail.com To: rules-users@lists.jboss.org Sent: Thursday, 29 November, 2012 3:20:18 PM Subject: Re: [rules-users] debug Hi, As I see it , this is a big problem. I was looking at drools about 10 months ago (5.3.0 Final) and debug worked just fine ... ... so similar to earlier comment of Bruno here. Today I downloaded drools 5.5.0 Final eclipse Juno and debug is broken ... Can we expect a patch? I can't see how we could proceed if this issue is not resolved. Any suggestions welcome. Regards, Kevin -- View this message in context: http://drools.46999.n3.nabble.com/debug-tp3889772p4021012.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Question about drools-spring in a multi-treaded container (like tomcat).
Hi Gurvinder, knowledge sessions are not thread-safe so I believe your assumptions are correct. To be on the safe side you should change the ksession bean to have scope prototype. Regards, Mattias - Original Message - From: Gurvinder Narula1 gnaru...@la-z-boy.com To: rules-users@lists.jboss.org Sent: Tuesday, 27 November, 2012 3:08:18 PM Subject: [rules-users] Question about drools-spring in a multi-treaded container (like tomcat). Hello all, I've been reading up about drool-spring integration and have put together a simple project that wires together a KnowledgeBase and KnowledgeSession as follows : drools:resource id = GroupUnit type = DRL source = file:/Users/drools/drools-spring-test/src/Rules/drls/GroupUnit.drl / drools:resource id = GradeUnit type = DRL source = file:/Users/drools/drools-spring-test/src/Rules/drls/GradeUnit.drl / drools:resource id = EvaluateUnit type = DRL source = file:/Users/drools/drools-spring-test/src/Rules/drls/ EvaluateUnit .drl / drools:grid-node id = node1 / drools:kbase id = kbase1 node = node1 drools:resources drools:resource ref = GroupUnit / drools:resource ref = GradeUnit / drools:resource ref = EvaluateUnit / / drools:resources / drools:kbase drools:ksession id = ksession type = stateful kbase = kbase1 node = node1 / ... The main question that I have is that – is this solution thread-safe ? From what I understand of spring is that beans configured without any additional qualifiers are inherently singletons. And when deployed in a multi-theaded container like tomcat, Spring assumes that the beans being severed up a thread-safe. So from I have read is that KnowledeSessions are inherently not thread safe. So putting the 2 together, I leaning towards the assessment that this above solution is NOT thread safe and that if I do want it to be thread safe I should set the StatefulKnowledgeSession to 'prototype' and not leave it as a singleton. Please let me know if I'm missing anything in my assessment here ! Thanks in advance, Gurvinder This message is intended only for the individual or entity to which it is addressed. It may contain privileged, confidential information which is exempt from disclosure under applicable laws. If you are not the intended recipient, please note that you are strictly prohibited from disseminating or distributing this information (other than to the intended recipient) or copying this information. If you have received this communication in error, please notify us immediately by e-mail or by telephone at the above number. Thank you. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] lock-on-active clarification needed
Armand/Esteban, I had a look at source code ( org.drools.common.DefaultAgenda.createActivation(...) ) and as far as I can tell it should not matter if the rules match on the same facts or not. I interpret the source code like this: While an agenda group or rule flow group is active, any rules within that group with lock-on-active set to true are prevented from creating new activations I.e. the rule Rule 1 cannot create an activation since its agenda group MAIN is already active when its conditions are fulfilled. Regards, Mattias - Original Message - From: Armand Welsh awe...@statestreet.com To: Rules Users List rules-users@lists.jboss.org Sent: Wednesday, 14 November, 2012 11:04:36 PM Subject: Re: [rules-users] lock-on-active clarification needed Esteban, I too have been confused by lock-on-active. Only after reading the definition many times, have I come to the following conclusion: Looking at the documentation, and other examples, I think I can how lock-on-active behaves. From what I gather, it looks like when “init “ rule fires, the activations for that rule consist of the DataSample() facts (all of them). You then modify the fact, but at the same time, the lock-on-active blocks any further activations from occur as a result of modifying the DataSample() fact. Since “Rule 1” depends on DataSample, and it is in the same agenda group as init, “Rule 1” cannot fire until the agenda group is changed, or the ruleflow-group is changed. What is being blocked by lock-on-active is not the reactivation of the rule. What is being blocked is the resultant activations as a result of modify the DataSample fact. This block only holds true on the current focus (agenda-group or ruleflow-group). Think of it as a way of temporarily removing the facts from the knowledge tree. From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Esteban Aliverti Sent: Wednesday, November 14, 2012 3:41 AM To: Rules Users List Subject: [rules-users] lock-on-active clarification needed Hi all, I'm dealing with a set of rules having the lock-on-active attribute and I'm not getting the (at least what I understand as) expected results. I've created an isolated JUnit test. I'm attaching it to this email. Basically, I have 2 rules: rule init lock-on-active true when $d: DataSample() then System.out.println(Setting predefined value); modify($d){ addValue(Parameter.PARAM_A, 10.0) } end rule Rule 1 lock-on-active true when DataSample($v: values[Parameter.PARAM_A] 20) then System.out.println(Rule 1: +$v); end DataSample is a Java class containing a MapParameter, Double where Parameter is an enum. In the test I'm creating a ksession and inserting an empty DataSample object. I understand that as soon as the object is inserted, both rules are evaluated and the result is going to be an activation of rule init; and this is what is actually happening. So far so good. Now, after I call fireAllRules() I expect that 'Rule 1' becomes active because of the modification of the fact in init. Well, this is not the case. I don't see any activation for Rule 1. My understanding about lock-on-active is that a rule that WAS ACTIVATED is not going to be re-activated until the current agenda group is switched. The odd thing here is that I never had an activation for Rule 1 so I don't see why it activation after init is executed should be prevented. So my question is: Is my understanding wrong? What is the expected behavior of lock-on-active in this situation? I read the documentation but I couldn't get any hint: Whenever a ruleflow-group becomes active or an agenda-group receives the focus, any rule within that group that has lock-on-active set to true will not be activated any more ; irrespective of the origin of the update, the activation of a matching rule is discarded. This is a stronger version of no-loop, because the change could now be caused not only by the rule itself. It's ideal for calculation rules where you have a number of rules that modify a fact and you don't want any rule re-matching and firing again. Only when the ruleflow-group is no longer active or the agenda-group loses the focus those rules with lock-on-active set to true become eligible again for their activations to be placed onto the agenda. Best Regards, Esteban Aliverti - Blog @ http://ilesteban.wordpress.com ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] How to get notified just before rule is picked up for evaluation
Hi Ghanshyam, I'm afraid there is no such way. The reason is that Drools does not evaluate rules one by one. A rule can consist of multiple conditions and some of those conditions can be shared by multiple rules (node sharing in RETE network). When you insert a fact into your session, conditions from multiple rules for that fact type are evaluated. So different parts of a rule's conditions may be evaluated at different times during your insert of facts. Only when all conditions for a rule have been evaluated to true an activation is created. Regards, Mattias - Original Message - From: gpa...@tsys.com To: rules-users@lists.jboss.org Sent: Thursday, 15 November, 2012 2:41:04 AM Subject: [rules-users] How to get notified just before rule is picked up for evaluation Is there a way to get a hook into just before a rule is evaluated to determine whether an activation is created ? The earliest hook available is DefaultAgendaEventListener . activationCreated(ActivationCreatedEvent event) What I am looking for is to get notified just before a rule is picked up for evaluation and just after it has been evaluated. Thanks Ghanshyam - The information contained in this communication (including any attachments hereto) is confidential and is intended solely for the personal and confidential use of the individual or entity to whom it is addressed. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this communication in error and that any review, dissemination, copying, or unauthorized use of this information, or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. Thank you ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Is there a default activation group
Hi Richie, there is no default activation group. They will be treated as in different group. Both rules can fire. Regards, Mattias richie wrote Hi, Is there a default activation group in drools? I mean if we do not set activation-group in two rules, do they will be treated as in same group or different group? -- View this message in context: http://drools.46999.n3.nabble.com/Is-there-a-default-activation-group-tp4020834p4020837.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Error while upgrdaing drools version
Hi Mohan, I would suspect that this problem is caused by having two versions of Drools in classpath. Maybe rules are compiled with one version of Drools compiler and then attempting to run with a different version of Drools core. JBoss ESB comes with an embedded version of Drools (in jbrules.esb). So if you are planning to run rules inside ESB deployments I would recommend sticking to that version. Otherwise you may have to use class loader isolation to make sure your deployment does not attempt to load classes from jbrules.esb. Regards, Mattias - Original Message - From: mohan mohan.narang...@gmail.com To: rules-users@lists.jboss.org Sent: Monday, 5 November, 2012 2:47:51 PM Subject: [rules-users] Error while upgrdaing drools version Hi folks, I'm using JBoss 5.1.0 GA, Jboss ESB 4.9 and Drool 5.1.0 recently i have tried to upgrade all my entities as below. *jboss-6.1.0.Final, jbossesb-4.11, drools 5.3.1.Final* while i start app server i'm getting below error and still i couldn't trace it. Is it because of compatibility issue or bug? I'm using same drl file as earlier. 19:01:56,634 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Start: name=jboss.esb.vfs:///I:/c ep/jboss-6.1.0.Final/server/cep/deploy/cep-esb-1.0-SNAPSHOT.esb state=Create: java.lang.VerifyError: (class: lk/dialog/cep/mobile/Rule_ No_such_offer_yetDefaultConsequenceInvoker, method: evaluate signature: (Lorg/drools/spi/KnowledgeHelper;Lorg/drools/WorkingMemory;)V) Expecting to find integer on stack at java.lang.Class.getDeclaredConstructors0(Native Method) [:1.6.0] at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389) [:1.6.0] at java.lang.Class.getConstructor0(Class.java:2699) [:1.6.0] at java.lang.Class.newInstance0(Class.java:326) [:1.6.0] at java.lang.Class.newInstance(Class.java:308) [:1.6.0] at org.drools.rule.JavaDialectRuntimeData.wire(JavaDialectRuntimeData.java:409) [:5.3.1.Final] at org.drools.rule.JavaDialectRuntimeData.wire(JavaDialectRuntimeData.java:396) [:5.3.1.Final] at org.drools.rule.JavaDialectRuntimeData.onBeforeExecute(JavaDialectRuntimeData.java:237) [:5.3.1.Final] at org.drools.rule.DialectRuntimeRegistry.onBeforeExecute(DialectRuntimeRegistry.java:132) [:5.3.1.Final] at org.drools.compiler.PackageBuilder.reloadAll(PackageBuilder.java:875) [:5.3.1.Final] at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:828) [:5.3.1.Final] at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:404) [:5.3.1.Final] at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:586) [:5.3.1.Final] at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:37) [:5.3.1.Final] at org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(KnowledgeAgentImpl.java:712) [:5.3.1.Final] at org.drools.agent.impl.KnowledgeAgentImpl.incrementalBuildResources(KnowledgeAgentImpl.java:917) [:5.3.1.Final] at org.drools.agent.impl.KnowledgeAgentImpl.buildKnowledgeBase(KnowledgeAgentImpl.java:659) [:5.3.1.Final] at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:190) [:5.3.1.Final] at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:169) [:5.3.1.Final] at lk.dialog.charging.cep.StatefullCepEngineSingleton.init(StatefullCepEngineSingleton.java:805) [:] at lk.dialog.charging.cep.StatefullCepEngineSingleton.init(StatefullCepEngineSingleton.java:83) [:] at lk.dialog.charging.cep.StatefullCepEngineSingleton.intialize(StatefullCepEngineSingleton.java:152) [:] at lk.dialog.charging.cep.feeders.StatefullINUDPVoiceEventFeeder.initialise(StatefullINUDPVoiceEventFeeder.java:30) at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.initialise(ActionProcessingPipeline.java:397) [:] at org.jboss.soa.esb.listeners.message.MessageAwareListener.doInitialise(MessageAwareListener.java:188) [:] at org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle.initialise(AbstractManagedLifecycle.java:133) [:] at org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleController.initialiseInstances(ManagedLifecycleController.java:109) [: ] kind regards Mohan -- View this message in context: http://drools.46999.n3.nabble.com/Error-while-upgrdaing-drools-version-tp4020702.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] How can I nested rules
Hi Leo, another option could be to add some extra fact classes or declared types and do logical inserts. E.g. you could do: rule Age and gender women when $p : Person(p1 = 12 p2 = 1) then insertLogical( new CouldHaveBeenPregnant($p) ); end rule Pregnant when $p : Person(p3 1) CouldHaveBeenPregnant( person == $p ) then insertLogical( new HasBeenPregnant($p) ); end rule Pregnant2 no-loop when $p : Person(p4 = P3) HasBeenPregnant( person == $p ) then $p.setStatus(OK); update($p); end Regards, Mattias - Original Message - From: salt writemesaltwo...@gmail.com To: rules-users@lists.jboss.org Sent: Friday, 2 November, 2012 7:09:14 PM Subject: Re: [rules-users] How can I nested rules Leo, This can be achieved by using agendagroup. By drools.setFocus you can jump from one rule to another. Pls try that. -- View this message in context: http://drools.46999.n3.nabble.com/How-can-I-nested-rules-tp4020488p4020681.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Error while upgrdaing drools version
Sorry, just realised that Drools 5.3.1.Final _is_ the version of Drools embedded in JBoss ESB 4.11. But please double check that you are not including another version of Drools somewhere in your deployments. This looks like a conflict between two versions on classpath. Regards, Mattias - Original Message - From: Mattias Nilsson Grip mattias.nilsson.g...@redpill-linpro.com To: Rules Users List rules-users@lists.jboss.org Sent: Monday, 5 November, 2012 6:02:06 PM Subject: Re: [rules-users] Error while upgrdaing drools version Hi Mohan, I would suspect that this problem is caused by having two versions of Drools in classpath. Maybe rules are compiled with one version of Drools compiler and then attempting to run with a different version of Drools core. JBoss ESB comes with an embedded version of Drools (in jbrules.esb). So if you are planning to run rules inside ESB deployments I would recommend sticking to that version. Otherwise you may have to use class loader isolation to make sure your deployment does not attempt to load classes from jbrules.esb. Regards, Mattias - Original Message - From: mohan mohan.narang...@gmail.com To: rules-users@lists.jboss.org Sent: Monday, 5 November, 2012 2:47:51 PM Subject: [rules-users] Error while upgrdaing drools version Hi folks, I'm using JBoss 5.1.0 GA, Jboss ESB 4.9 and Drool 5.1.0 recently i have tried to upgrade all my entities as below. *jboss-6.1.0.Final, jbossesb-4.11, drools 5.3.1.Final* while i start app server i'm getting below error and still i couldn't trace it. Is it because of compatibility issue or bug? I'm using same drl file as earlier. 19:01:56,634 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Start: name=jboss.esb.vfs:///I:/c ep/jboss-6.1.0.Final/server/cep/deploy/cep-esb-1.0-SNAPSHOT.esb state=Create: java.lang.VerifyError: (class: lk/dialog/cep/mobile/Rule_ No_such_offer_yetDefaultConsequenceInvoker, method: evaluate signature: (Lorg/drools/spi/KnowledgeHelper;Lorg/drools/WorkingMemory;)V) Expecting to find integer on stack at java.lang.Class.getDeclaredConstructors0(Native Method) [:1.6.0] at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389) [:1.6.0] at java.lang.Class.getConstructor0(Class.java:2699) [:1.6.0] at java.lang.Class.newInstance0(Class.java:326) [:1.6.0] at java.lang.Class.newInstance(Class.java:308) [:1.6.0] at org.drools.rule.JavaDialectRuntimeData.wire(JavaDialectRuntimeData.java:409) [:5.3.1.Final] at org.drools.rule.JavaDialectRuntimeData.wire(JavaDialectRuntimeData.java:396) [:5.3.1.Final] at org.drools.rule.JavaDialectRuntimeData.onBeforeExecute(JavaDialectRuntimeData.java:237) [:5.3.1.Final] at org.drools.rule.DialectRuntimeRegistry.onBeforeExecute(DialectRuntimeRegistry.java:132) [:5.3.1.Final] at org.drools.compiler.PackageBuilder.reloadAll(PackageBuilder.java:875) [:5.3.1.Final] at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:828) [:5.3.1.Final] at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:404) [:5.3.1.Final] at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:586) [:5.3.1.Final] at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:37) [:5.3.1.Final] at org.drools.agent.impl.KnowledgeAgentImpl.createPackageFromResource(KnowledgeAgentImpl.java:712) [:5.3.1.Final] at org.drools.agent.impl.KnowledgeAgentImpl.incrementalBuildResources(KnowledgeAgentImpl.java:917) [:5.3.1.Final] at org.drools.agent.impl.KnowledgeAgentImpl.buildKnowledgeBase(KnowledgeAgentImpl.java:659) [:5.3.1.Final] at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:190) [:5.3.1.Final] at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:169) [:5.3.1.Final] at lk.dialog.charging.cep.StatefullCepEngineSingleton.init(StatefullCepEngineSingleton.java:805) [:] at lk.dialog.charging.cep.StatefullCepEngineSingleton.init(StatefullCepEngineSingleton.java:83) [:] at lk.dialog.charging.cep.StatefullCepEngineSingleton.intialize(StatefullCepEngineSingleton.java:152) [:] at lk.dialog.charging.cep.feeders.StatefullINUDPVoiceEventFeeder.initialise(StatefullINUDPVoiceEventFeeder.java:30) at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.initialise(ActionProcessingPipeline.java:397) [:] at org.jboss.soa.esb.listeners.message.MessageAwareListener.doInitialise(MessageAwareListener.java:188) [:] at org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle.initialise(AbstractManagedLifecycle.java:133) [:] at org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleController.initialiseInstances(ManagedLifecycleController.java:109) [: ] kind regards Mohan -- View this message in context: http
Re: [rules-users] debug
Hi, release notes for 5.4.0.Final mention that Breakpoints in Rule RHS are not working with Java dialect. Try adding this attribute to your rule and see if that makes debugging work: dialect mvel Regards, Mattias - Ursprungligt meddelande - Från: benq2188 bengisag...@gmail.com Till: rules-users@lists.jboss.org Skickat: onsdag, 31 okt 2012 10:58:06 Ämne: Re: [rules-users] debug Hello, I faced with the same problem. Breakpoints are not being hit by debugger. I have Eclipse SDK version: 4.2.1 and went through the reference manual of Drools and followed each step carefully. -Installed GEF - Downloaded drools-distribution-5.4.0.Final.zip -Unzipped it into Eclipse main folder -Restarted Eclipse -Defined run time based on the latest Drools project jars included in the plugin itself. -Created Drools Project -Created new launch configuration for Drools Application. -Put a breakpoint in the helloworld simple project on the first line of the section then. When I debug it as Drools Application, debugger stops in Java breakpoints but doesn't stop in drl rule. Also tried what Bruno suggested but it did not worked too. Any other solutions, how can I fix it? Thanks in advance. -- View this message in context: http://drools.46999.n3.nabble.com/debug-tp3889772p4020597.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] java.lang.LinkageError, but only sometimes
Hi Kenneth, I have never experienced this myself, but after having a quick look at the code I believe this could be a multi-threading problem. In the abstract class java.lang.ClassLoader the method loadClass(String, boolean) is synchronized, but both org.drools.util.CompositeClassLoader and org.drools.rule.JavaDialectRuntimeData$PackageClassLoader override this method without the use of synchronized. I would suggest you create a JIRA issue for this. Regards, Mattias - Ursprungligt meddelande - Från: kennywest kenneth.westeli...@telenet.be Till: rules-users@lists.jboss.org Skickat: onsdag, 31 okt 2012 12:41:29 Ämne: [rules-users] java.lang.LinkageError, but only sometimes Dear list, We have an application (A) deployed on JBoss 7.1.1 accepting commands (CQRS, but only C and Q :) ). A console application (B) is sending a large volume of commands to create entities in A. Entities in A are validated by Drools (plain drl files, configured in spring using drools-spring). Most of the time this works just fine. But sometimes, we get the following exception: java.lang.LinkageError: loader (instance of org/drools/rule/JavaDialectRuntimeData$PackageClassLoader): attempted duplicate class definition for name: a/b/c/Rule_person_unique___name_656ee3db19d34e689d95e2d6b2be67b6 at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.6.0_30] at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) [rt.jar:1.6.0_30] at java.lang.ClassLoader.defineClass(ClassLoader.java:615) [rt.jar:1.6.0_30] at org.drools.rule.JavaDialectRuntimeData$PackageClassLoader.fastFindClass(JavaDialectRuntimeData.java:615) [drools-core-5.4.0.Final.jar:5.4.0.Final] at org.drools.util.CompositeClassLoader$CachingLoader.load(CompositeClassLoader.java:254) [knowledge-api-5.4.0.Final.jar:5.4.0.Final] at org.drools.util.CompositeClassLoader$CachingLoader.load(CompositeClassLoader.java:237) [knowledge-api-5.4.0.Final.jar:5.4.0.Final] at org.drools.util.CompositeClassLoader.loadClass(CompositeClassLoader.java:88) [knowledge-api-5.4.0.Final.jar:5.4.0.Final] at java.lang.ClassLoader.loadClass(ClassLoader.java:295) [rt.jar:1.6.0_30] at java.lang.ClassLoader.loadClass(ClassLoader.java:247) [rt.jar:1.6.0_30] at a.b.c.Rule_gg___unique___name_656ee3db19d34e689d95e2d6b2be67b6Eval0InvokerGenerated.evaluate(Unknown Source) at a.b.c.Rule_gg___unique___name_656ee3db19d34e689d95e2d6b2be67b6Eval0Invoker.evaluate(Unknown Source) at org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:114) [drools-core-5.4.0.Final.jar:5.4.0.Final] Any idea where this is coming from or what's causing this. We are using: - JBoss 7.1.1 - drools 5.4.0.Final - jdk 1.6u30 - Windows 7 64 bit regards, Kenneth -- View this message in context: http://drools.46999.n3.nabble.com/java-lang-LinkageError-but-only-sometimes-tp4020606.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] java.lang.LinkageError, but only sometimes
I'm guessing now. But since the stack trace includes org.drools.rule.JavaDialectRuntimeData I would rather say it is related to Java and not to MVEL. Actually org.drools.rule.MVELDialectRuntimeData seems to have less class-loading logic than JavaDialectRuntimeData so if this is indeed a bug a workaround may be to switch from java to mvel dialect. Another workaround could be to warm up your rules by firing them from a single thread before exposing the knowledge base to the multi-threaded client code. Regards, Mattias - Original Message - From: kennywest kenneth.westeli...@telenet.be To: rules-users@lists.jboss.org Sent: Wednesday, 31 October, 2012 4:33:07 PM Subject: Re: [rules-users] java.lang.LinkageError, but only sometimes Thank you for your reply. I have created the following issue: https://issues.jboss.org/browse/JBRULES-3675 We are now running the same setup on 5.5.0.CR1 and so far, we haven't encountered the linkage error. Could this be related to mvel? -- View this message in context: http://drools.46999.n3.nabble.com/java-lang-LinkageError-but-only-sometimes-tp4020606p4020616.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Noob desperately needing help
I was just about to suggest something similar. Use JDB or some other utility to get a thread dump from the JVM when it is hung. That should let you know exactly in what class and method the thread hangs. You could also change your code to catch (and rethrow) Throwable instead of Exception to double-check that the call to ZipOutputStream is not throwing an Error that is secretly caught somewhere without being logged. Regards, Mattias - Original Message - From: Esteban Aliverti esteban.alive...@gmail.com To: Rules Users List rules-users@lists.jboss.org Sent: Wednesday, 31 October, 2012 4:46:53 PM Subject: Re: [rules-users] Noob desperately needing help Did you try to debug your code to see exactly where the hung is? zip4j seems to be open source, you could even debug its internals to see where the problem is and maybe you can get a clue of what is going wrong. Best Regards, Esteban Aliverti - Blog @ http://ilesteban.wordpress.com On Wed, Oct 31, 2012 at 4:26 PM, zaphod pcoo...@emspic.org wrote: Wolfgang, Here's my dilemma...there is no exception thrown! I wouldn't even be here asking the question if I was getting an OOME...my problem is that the rule hangs, and from that point on, the entire rules engine is hung, even though other processing continues on that jboss node. Note that I'm using zip4j, as the default zip library provided in Java does not support password-protecting the zip file. That is a requirement of this process. And this is new code...it works perfectly outside the rules container, but not at all inside it. What baffles me is the process hanging...I've been writing Java code for 13 years, and I've never seen a process just hang... Paul ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] startsWith function
aftab wrote: I want to define rules for below function, private boolean isFixedNumber(Call call){ if(call.getCalledNumber().startsWith(01) || call.getCalledNumber().startsWith(02) || call.getCalledNumber().startsWith(03) ){ return true; } else{ return false; } } Give some hints how can i define it ? I was trying to define it in below format, rule Is Fixed Number dialect java when c : CDRRecords (calledNumber.startsWith( 011) ) then c.setFixedNetNumber(true); System.out.println(c.setFixedNetNumber (true) ); // consequence end Thanks in advance for your support ... If you're using Drools 5.2 you should be able to do: c : CDRRecords( calledNumber str[startsWith] 011 ) If you are on earlier version of Drools you can match with a regular expression: c : CDRRecords( calledNumber matches 011.* ) /Mattias -- View this message in context: http://drools.46999.n3.nabble.com/startsWith-function-tp3228735p3234795.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Help needed
prasad.pbc wrote: Hi Guys, Iam using Eclipse tool for writing drl , i have written drl . Then i have written an ant script to convert this drl to PKG . i have used drools5.1.1.jars. i was sucessfully convert drl to pkg. knowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add( ResourceFactory.newFileResource( c:/Sample.pkg ), ResourceType.PKG ); iam getting below error: java.lang.ClassCastException: org.drools.reteoo.ReteooRuleBase cannot be cast to org.drools.rule.Package at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:487) at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28) at com.test.rules.MyRulesEngine.init(MyRulesEngine.java:51) at com.test.rules.MyRulesEngine.getInstance(MyRulesEngine.java:39) at com.test.rules.MyRulesExecuter.main(MyRulesExecuter.java:38) Can anybody help resolving my problem.. Thanks prasad Based on the stack trace I would guess that the file Sample.pkg contains a serialized KnowledgeBase and not a serialized KnowledgePackage. Maybe you could try to do your export like this: KnowledgeBase kbase = ...; KnowledgePackage kpackage = kbase.getKnowledgePackages().iterator().next(); FileOutputStream fos = new FileOutputStream(new File(c:/Sample.pkg)); DroolsStreamUtils.streamOut(fos, kpackage); /Mattias -- View this message in context: http://drools.46999.n3.nabble.com/Help-needed-tp3224168p3234832.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[
bhavindalal wrote: Hello, I am new to Drools. On starting to execute a simple program, eclipse gives the following stacktrace as error. I even included the org.eclipse.jdt that comes with eclipse, but it is still giving me error. Anybody please suggest the problem. I am using Drools 5.0 and its dependencies and Eclipse Helios java.lang.NoSuchMethodError: org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[Lorg/eclipse/jdt/core/compiler/CategorizedProblem; at org.drools.commons.jci.compilers.EclipseJavaCompiler$3.acceptResult(EclipseJavaCompiler.java:321) at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:335) at org.drools.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJavaCompiler.java:351) at org.drools.commons.jci.compilers.AbstractJavaCompiler.compile(AbstractJavaCompiler.java:51) at org.drools.rule.builder.dialect.java.JavaDialect.compileAll(JavaDialect.java:389) at org.drools.compiler.DialectCompiletimeRegistry.compileAll(DialectCompiletimeRegistry.java:56) at org.drools.compiler.PackageRegistry.compileAll(PackageRegistry.java:74) at org.drools.compiler.PackageBuilder.compileAll(PackageBuilder.java:690) at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:653) at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:290) at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:488) at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25) at com.sample.DroolsTest.readKnowledgeBase(DroolsTest.java:40) at com.sample.DroolsTest.main(DroolsTest.java:23) Thanks Looks like the problem could be caused by the existence of multiple versions of JDT compiler on the classpath. Similar problems are described here: http://community.jboss.org/wiki/RulesTomcat You could try switching to janino compiler instead of JDT by setting system property drools.compiler to JANINO. For example: -Ddrools.compiler=JANINO in your program launch settings. /Mattias -- View this message in context: http://drools.46999.n3.nabble.com/org-eclipse-jdt-internal-compiler-CompilationResult-getProblems-tp3211240p3234883.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Fire Rule in Stateless Knowledge Session
snehils wrote: Hi, I am new in Drools. I am using Drools version 5.1.0 My requirement is kind of request response, where I have to perform some checks for the request and respond the result. Hence, I decided to go with stateless knowledge session. I have prepared .DRL file and it contains set of rules. When some request receives I have to identify the rule(s) belongs to that request and then fire the rule(s). I am not able to figure out how to categories the rules request wise in DRL file? Also, how to fire only those rules which belongs to the category. For example, there are three kinds of requests Rq1, Rq2 and Rq3. There are rules in DRL file: R1, R2, R3, R4 and R5. R1, R2 belongs to Rq1, R3 belongs to Rq2 and R4, R5 belongs to Rq3. When some request receives only its belonging rules should be fired. For example, on receiving of Rq2 only R3 should be fired. Please provide me some code snipped or link. Thanks One way could be to have conditions in your rules that check what kind of request it is. Without knowing your problem in detail it's hard to know if this is feasible. E.g. you could insert a request object as a fact into the session and let rules in R3 have condition: when Request(type = Rq2) ... If you switch to stateful session instead of stateless you could use agenda groups to achieve something similar. See Drools Expert user guide for details on how to use agenda groups. /Mattias -- View this message in context: http://drools.46999.n3.nabble.com/Fire-Rule-in-Stateless-Knowledge-Session-tp3234893p3234944.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Fire Rule in Stateless Knowledge Session
snehils wrote: I thought of doing same but this will become slow when number of rules are more (100 or 200 rules). The given condition will be checked in each rule. The Rete algorithm will make sure that this does not become slow when number of rules increases. Multiple rules with the same condition will only result in one node in the Rete tree. I.e. each unique condition will only be checked once. /Mattias -- View this message in context: http://drools.46999.n3.nabble.com/Fire-Rule-in-Stateless-Knowledge-Session-tp3234893p3234977.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Fire Rule in Stateless Knowledge Session
snehils wrote: Is there any disadvantage switching in stateful session? If you switch to stateful sessions you have to ensure that you call the dispose-method on your session when you are done with it. Otherwise you could get a memory leak. Other than that I can't think of any disadvantage. /Mattias -- View this message in context: http://drools.46999.n3.nabble.com/Fire-Rule-in-Stateless-Knowledge-Session-tp3234893p3235136.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users