Re: [rules-users] Classnotfound exception on POJO model upload in guvnor
Thanks, that makes sense. I was suspecting that would be the case. I'll give that a go. -- View this message in context: http://drools.46999.n3.nabble.com/Classnotfound-exception-on-POJO-model-upload-in-guvnor-tp4001060p4001282.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] Classnotfound exception on POJO model upload in guvnor
I think (not sure) that an uploaded jar must be complete by itself. The only things (classes) it can reference must be in guvnor's classpath (guvnor own libs and tomcat and java, but not current package other jars). So : - try using a single jar - or put all your jars in guvnor classpath (tomcat libs or guvnor war's libs) PS : When using your app, the classpath will be your app's one. When you get rules from guvnor, you don't get jars with them ... so it is two different environments. - Mail original - De: "mpgong" À: rules-users@lists.jboss.org Envoyé: Vendredi 18 Mai 2012 17:37:55 Objet: [rules-users] Classnotfound exception on POJO model upload in guvnor Hello, I'm trying to use Guvnor but when i upload my POJO models that my DRL needs i get a classnotfoundexception even though i uploaded the jar that has the class in it first. So i basically upload a jar that provides some common classes,utilities, that have no dependencies other than on the core java libs. This jar uploads fine. I then upload my model jar that contains my facts and other classess that the DRL needs and it complains that it can't find the class from the first common jar even though i uploaded it first and it is loaded without errors. How do i load all of my jars so that they are available in Guvnor to use such as in creating a test scenario? It looks like the jars are upload but i get the error, i can also build the package but i'm worried it won't work when i try to use it in my app. Any ideas or insight to this issue. I'm using drools.5.3.0 final. Thanks -- View this message in context: http://drools.46999.n3.nabble.com/Classnotfound-exception-on-POJO-model-upload-in-guvnor-tp4001060.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] ProcessInstance from StartProcessCommand
Yes I have read it. I now see that by specifying the 'outIdentifier' I get the processInstanceId returned in the executionResults. Thanks Mauricio, Herm -- View this message in context: http://drools.46999.n3.nabble.com/ProcessInstance-from-StartProcessCommand-tp383p4001106.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] Classnotfound exception on POJO model upload in guvnor
Hello, I'm trying to use Guvnor but when i upload my POJO models that my DRL needs i get a classnotfoundexception even though i uploaded the jar that has the class in it first. So i basically upload a jar that provides some common classes,utilities, that have no dependencies other than on the core java libs. This jar uploads fine. I then upload my model jar that contains my facts and other classess that the DRL needs and it complains that it can't find the class from the first common jar even though i uploaded it first and it is loaded without errors. How do i load all of my jars so that they are available in Guvnor to use such as in creating a test scenario? It looks like the jars are upload but i get the error, i can also build the package but i'm worried it won't work when i try to use it in my app. Any ideas or insight to this issue. I'm using drools.5.3.0 final. Thanks -- View this message in context: http://drools.46999.n3.nabble.com/Classnotfound-exception-on-POJO-model-upload-in-guvnor-tp4001060.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] [5.4.0] Combining custom operators with OR results in compile error
Hello List, I recently migrated from Drools.5.0.1 to Drools.5.4.0 and I am having issues when combining constraints with OR when custom operators are involved. For example, the following rule: rule "r548695.1" no-loop true dialect "mvel" when gnId : GN() la : t547147( ) v1717 : Tra48( gnId.gNo==gNo , name F_str[startsWith] la.c547148 || postCode F_str[contains] la.c547149 ) then System.out.println("Rule r548695.1 fired"); end results in the following exception: Unable to Analyse Expression gnId.gNo == gNo && ( F_str0.evaluate( name, la.c547148 ) || F_str1.evaluate( postCode, la.c547149 ) ): [Error: unable to resolve method using strict-mode: my.package.rulez.Tra48.F_str0()] [Near : {... gNo == gNo && ( F_str0.evaluate( name, la.c54 }] ^ : [Rule name='r548695.1'] Please note, that the same rule using AND (&&) between the custom operators compiles OK. The above rule had not problem whatsoever in Drools.5.0.1. Any ideas to overcome this issue, are most welcomed. -Stathis ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Plugging custom verification rules into Guvnor
Pull requests are always welcome :) I'll hold my breath for as long as humanly possible. On 18 May 2012 14:07, Joe Ammann wrote: > Hi Wolfgang > > On 05/17/2012 06:31 PM, Wolfgang Laun wrote: > > you might also consider adding your own rule to one of the existing > > verifyer DRL files. I think they are part of some .jar file, so all > > you'd need to do is de-jar, edit, re-jar, or just fiddle with class > > path if that's the way the verifiy locates the DRL resources. > > I think I will do this stepwise, to get a feeling of the needed changes > in Guvnor > > 1) as you suggest, fiddle the drools-verifier.jar and provide new rules > 2) import the rules into a Guvnor package package, and try to change the > invocation of VerifierBuilderConfiguration inside Guvnor to pick up the > rules from this package (instead of the changeset.xml in the > drools-verifier) > 3) make the name of the package configurable somehow in the Guvnor GUI > and automate the import of the default rules from drools-verifier > > But don't hold your breath :-) > > -- > CU, Joe > > ___ > 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] Plugging custom verification rules into Guvnor
Hi Wolfgang On 05/17/2012 06:31 PM, Wolfgang Laun wrote: > you might also consider adding your own rule to one of the existing > verifyer DRL files. I think they are part of some .jar file, so all > you'd need to do is de-jar, edit, re-jar, or just fiddle with class > path if that's the way the verifiy locates the DRL resources. I think I will do this stepwise, to get a feeling of the needed changes in Guvnor 1) as you suggest, fiddle the drools-verifier.jar and provide new rules 2) import the rules into a Guvnor package package, and try to change the invocation of VerifierBuilderConfiguration inside Guvnor to pick up the rules from this package (instead of the changeset.xml in the drools-verifier) 3) make the name of the package configurable somehow in the Guvnor GUI and automate the import of the default rules from drools-verifier But don't hold your breath :-) -- CU, Joe ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Exception on at org.drools.reteoo.LeftTuple.get(LeftTuple.java:300) drools 5.0.1
When using "or", only one pattern of the or expression will be bound. So, at runtime, onlty one variable $p1 or $p2 exists, and the other is null so the NPE at runtime. By the way, I can't see you are using a or here, as you test exactly the same things ... - Mail original - De: "Joana Lopes" À: rules-users@lists.jboss.org Envoyé: Vendredi 18 Mai 2012 13:14:19 Objet: [rules-users] Exception on at org.drools.reteoo.LeftTuple.get(LeftTuple.java:300) drools 5.0.1 Hi There, I'm new to drools and i'm having a problem with a rule which has an OR: /* Rule 25_OFF */ rule "25_OFF" when $p1:InferenceFactValue( param!=null, param.parameterName == "sonar_8_cm", $v1:param.valueFloat >= 10 ) or $p2:InferenceFactValue( param!=null, param.parameterName == "sonar_8_cm", $v2:param.valueFloat >= 10 ) then InferenceUtils.log( LogLevel.DEBUG, InferenceUtils.DROOLS_RULE, "Global Clock: " + InferenceDateUtils.dateString( globalClock, false ), true, false ); InferenceUtils.log( LogLevel.DEBUG, InferenceUtils.DROOLS_RULE, "\t\tRegra 25_OFF " + "25", true, false ); InferenceFactValue[] params = {$p1, $p2}; RuleFire.addEndAlarm( inferenceAgent, droolsEngine, "AlarmPackage", "25", "25", params, globalClock ); end No errors in knowledge builder What happens is: org.drools.runtime.rule.ConsequenceException: java.lang.NullPointerException at org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:23) at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:943) at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:885) at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1086) at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:660) at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:627) at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:183) at pt.holos.dva.agents.inference.process.DroolsInferenceEngine.fireAllRules(DroolsInferenceEngine.java:644) at pt.holos.dva.agents.inference.process.DroolsInferenceEngine.receiveDataFromBuffer(DroolsInferenceEngine.java:342) at pt.holos.dva.agents.inference.process.BufferedDataReceiver.sendDataToDrools(BufferedDataReceiver.java:454) at pt.holos.dva.agents.inference.process.BufferedDataReceiver.run(BufferedDataReceiver.java:68) Caused by: java.lang.NullPointerException at org.drools.reteoo.LeftTuple.get(LeftTuple.java:300) at AlarmPackage.Rule_25_OFF_0ConsequenceInvoker.evaluate(Rule_25_OFF_0ConsequenceInvoker.java:15) at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:934) ... 9 more I've tried to see the source code and the declaration in org.drools.reteoo.LeftTuple.get(LeftTuple.java:300) is null. Can you give me some pointers please? Thank you, Joana P Lopes -- LinkedIn - http://pt.linkedin.com/in/joanpl My Bla Bla Bla: http://joanpl.blogspot.com ... The intuitive mind is a sacred gift and the rational mind is a faithful servant. We have created a society that honors the servant and has forgotten the gift. Albert Einstein. "Doubt is not a pleasant condition, but certainty is absurd." Voltaire ___ 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] Object activiates same rule many times
I've taken the rule on nabble (for strange reasons, it does not display correctly on mails ...). Wolfgang was right : rule "C020 - Gate charge (Out M)-B" salience 45 no-loop true when ChargeDetailEntity( opsDate_currentLeg >= "20110101 00" ) and $charge : ChargeDetailEntity ( $tariffType : tariffType, $tariffCode : tariffCode, $chargeEtd : etd, billToCompany == "C020", chargeType == "YH", cntrStatus1 == "XM" ) and not( exists( $seq : ChargeDetailRefSeqEntity( $seqEtd : etd, (invSepCriteriaName == "C020 - Gate charge (Out M)") && ((adjType == $charge.adjType) && ((bargeJobId == $charge.bargeJobId) && ((billToCompany == $charge.billToCompany) && ((chargeType == $charge.chargeType) && ((consortiumCode == $charge.consortiumCode) && ((serviceCode == $charge.serviceCode) && ((vesselCode == $charge.vesselCode) && ((voyageCode == $charge.voyageCode) && (etd == $chargeEtd) ) ) ) then insert(createChargeDetailRefSeqEntity("C020 - Gate charge (Out M)", $charge, newSeqList)); retract($charge); end the first ChargeDetailEntity( opsDate_currentLeg >= "20110101 00" ) is the problem. Don't know why there is 2 ChargeDetailEntity patterns, but I would put the contraint in the other ChargeDetailEntity pattern. This way, adding one ChargeDetailEntity object will only lead one rule activation. With the rule as this, the number of activiation you show in your log is normal ... PS : using a exists inside a not is redundant. not means "not exists" by itself. not( exists (X) ) is the same as not( X ) . - Mail original - De: "Wolfgang Laun" À: "Rules Users List" Envoyé: Vendredi 18 Mai 2012 13:02:09 Objet: Re: [rules-users] Object activiates same rule many times Please show the rule. Exponentially growing activations can be caused by rules where the same fact type is used more than once. You'll have to use constraints inhibiting useless duplications, e.g., when $a1: A() $a2: A(this != $a1 ) then -W On 18/05/2012, Christina Lau wrote: Hi all, I find an odd pattern in the audit log. When an Object is inserted to the working memory, activation is created many times on same rule. The more objects are inserted, the duplicated activations are growing exponentially which degrade the performance a lot. Here attached part of the audit log: http://drools.46999.n3.nabble.com/file/n4000630/rule-DOCSEP-1337325521971.log rule-DOCSEP-1337325521971.log In the log, - when object (130) is inserted, rule "C020 - Gate charge (Out M)-B" is activiated 129 times. - when object (131) is inserted, rule "C020 - Gate charge (Out M)-B" is activiated 130 times. Here is the rule of "C020 - Gate charge (Out M)-B", The "insert" in RHS only add ChargeDetailRefSeqEntity to working memory that I don't think it causes the recursive activation. And I'd already set no-loop to true. Does anyone offer some help here? Thank you very much, Christina -- View this message in context: http://drools.46999.n3.nabble.com/Object-activiates-same-rule-many-times-tp4000630.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 ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] ProcessInstance from StartProcessCommand
Did you take a look at the documentation? http://docs.jboss.org/drools/release/5.4.0.Final/droolsjbpm-integration-docs/html_single/index.html#d0e1070 Cheers On Fri, May 18, 2012 at 12:11 AM, Hrumph wrote: > What would one call with the outIdentifier to get a result? > > -- > View this message in context: > http://drools.46999.n3.nabble.com/ProcessInstance-from-StartProcessCommand-tp383p4000166.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 > -- - MyJourney @ http://salaboy.wordpress.com - Co-Founder @ http://www.jugargentina.org - Co-Founder @ http://www.jbug.com.ar - Salatino "Salaboy" Mauricio - ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Exception on at org.drools.reteoo.LeftTuple.get(LeftTuple.java:300) drools 5.0.1
Hi There, I'm new to drools and i'm having a problem with a rule which has an OR: /* Rule 25_OFF */ rule "25_OFF" when $p1:InferenceFactValue( param!=null, param.parameterName == "sonar_8_cm", $v1:param.valueFloat >= 10 ) or $p2:InferenceFactValue( param!=null, param.parameterName == "sonar_8_cm", $v2:param.valueFloat >= 10 ) then InferenceUtils.log( LogLevel.DEBUG, InferenceUtils.DROOLS_RULE, "Global Clock: " + InferenceDateUtils.dateString( globalClock, false ), true, false ); InferenceUtils.log( LogLevel.DEBUG, InferenceUtils.DROOLS_RULE, "\t\tRegra 25_OFF " + "25", true, false ); InferenceFactValue[] params = {$p1, $p2}; RuleFire.addEndAlarm( inferenceAgent, droolsEngine, "AlarmPackage", "25", "25", params, globalClock ); end No errors in knowledge builder What happens is: org.drools.runtime.rule.ConsequenceException: java.lang.NullPointerException at org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:23) at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:943) at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:885) at org.drools.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1086) at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:660) at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:627) at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:183) at pt.holos.dva.agents.inference.process.DroolsInferenceEngine.fireAllRules(DroolsInferenceEngine.java:644) at pt.holos.dva.agents.inference.process.DroolsInferenceEngine.receiveDataFromBuffer(DroolsInferenceEngine.java:342) at pt.holos.dva.agents.inference.process.BufferedDataReceiver.sendDataToDrools(BufferedDataReceiver.java:454) at pt.holos.dva.agents.inference.process.BufferedDataReceiver.run(BufferedDataReceiver.java:68) Caused by: java.lang.NullPointerException at org.drools.reteoo.LeftTuple.get(LeftTuple.java:300) at AlarmPackage.Rule_25_OFF_0ConsequenceInvoker.evaluate(Rule_25_OFF_0ConsequenceInvoker.java:15) at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:934) ... 9 more I've tried to see the source code and the declaration in org.drools.reteoo.LeftTuple.get(LeftTuple.java:300) is null. Can you give me some pointers please? Thank you, Joana P Lopes -- LinkedIn - http://pt.linkedin.com/in/joanpl My Bla Bla Bla: http://joanpl.blogspot.com ... The intuitive mind is a sacred gift and the rational mind is a faithful servant. We have created a society that honors the servant and has forgotten the gift. Albert Einstein. "Doubt is not a pleasant condition, but certainty is absurd." Voltaire ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Object activiates same rule many times
Please show the rule. Exponentially growing activations can be caused by rules where the same fact type is used more than once. You'll have to use constraints inhibiting useless duplications, e.g., when $a1: A() $a2: A(this != $a1 ) then -W On 18/05/2012, Christina Lau wrote: > Hi all, > > I find an odd pattern in the audit log. When an Object is inserted to the > working memory, activation is created many times on same rule. The more > objects are inserted, the duplicated activations are growing exponentially > which degrade the performance a lot. > > Here attached part of the audit log: > > http://drools.46999.n3.nabble.com/file/n4000630/rule-DOCSEP-1337325521971.log > rule-DOCSEP-1337325521971.log > > In the log, > - when object (130) is inserted, rule "C020 - Gate charge (Out M)-B" is > activiated 129 times. > - when object (131) is inserted, rule "C020 - Gate charge (Out M)-B" is > activiated 130 times. > > Here is the rule of "C020 - Gate charge (Out M)-B", > > > > The "insert" in RHS only add ChargeDetailRefSeqEntity to working memory > that > I don't think it causes the recursive activation. > > And I'd already set no-loop to true. Does anyone offer some help here? > > > Thank you very much, > Christina > > > -- > View this message in context: > http://drools.46999.n3.nabble.com/Object-activiates-same-rule-many-times-tp4000630.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
[rules-users] Object activiates same rule many times
Hi all, I find an odd pattern in the audit log. When an Object is inserted to the working memory, activation is created many times on same rule. The more objects are inserted, the duplicated activations are growing exponentially which degrade the performance a lot. Here attached part of the audit log: http://drools.46999.n3.nabble.com/file/n4000630/rule-DOCSEP-1337325521971.log rule-DOCSEP-1337325521971.log In the log, - when object (130) is inserted, rule "C020 - Gate charge (Out M)-B" is activiated 129 times. - when object (131) is inserted, rule "C020 - Gate charge (Out M)-B" is activiated 130 times. Here is the rule of "C020 - Gate charge (Out M)-B", The "insert" in RHS only add ChargeDetailRefSeqEntity to working memory that I don't think it causes the recursive activation. And I'd already set no-loop to true. Does anyone offer some help here? Thank you very much, Christina -- View this message in context: http://drools.46999.n3.nabble.com/Object-activiates-same-rule-many-times-tp4000630.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] Object activiates same rule many times
Please post your complete question. I notice your original question is showing as "not accepted" on nabble. On 18 May 2012 10:39, Christina Lau wrote: > In the RHS of the rule, the function calling by insert only return > ChargeDetailRefSeqEntity but not ChargeDetailEntity. That's why I think it > is not the area causing recursive activation of the rule. > > Is that right? > > > > > > -- > View this message in context: > http://drools.46999.n3.nabble.com/Object-activiates-same-rule-many-times-tp4000563p4000596.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] Building Guvnor from source
Good point. done. On 18 May 2012 10:31, anchi wrote: > Thanks. It works after setting this in run configuration: > -Xmx1500M -XX:MaxPermSize=512m > > There is a note about setting VM arguments in eclipse.ini file (which is > only used for launching Eclipse). But it doesn't say about setting it in > run > configuration. Maybe you might update it with this info. > > -- > View this message in context: > http://drools.46999.n3.nabble.com/Building-Guvnor-from-source-tp3999132p4000581.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] Object activiates same rule many times
In the RHS of the rule, the function calling by insert only return ChargeDetailRefSeqEntity but not ChargeDetailEntity. That's why I think it is not the area causing recursive activation of the rule. Is that right? -- View this message in context: http://drools.46999.n3.nabble.com/Object-activiates-same-rule-many-times-tp4000563p4000596.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] Drools function not working with Javassist facts
Set-up of the classpath for compile and execute: ADDON=javassist/javassist-3.16.1-GA/javassist.jar root=/extra/drools-distribution-5.3.0.Final/binaries tag=5.3.0.Final export CLASSPATH=.:$root/drools-core-${tag}.jar:$root/knowledge-api-${tag}.jar:$root/drools-compiler-${tag}.jar:$root/antlr-2.7.7.jar:$root/antlr-3.3.jar:$root/antlr-runtime-3.3.jar:$root/mvel2-2.1.0.drools7.jar:$root/ecj-3.5.1.jar:/extra/quartz-1.8.3/quartz-1.8.3.jar:$root/drools-decisiontables-${tag}.jar:$root/drools-templates-${tag}.jar:$root/xstream-1.4.1.jar:$root/xmlpull-1.1.3.1.jar:$ADDON // === dynamic/Main.java package dynamic; import java.io.IOException; import org.drools.KnowledgeBase; import org.drools.KnowledgeBaseConfiguration; import org.drools.KnowledgeBaseFactory; import org.drools.builder.KnowledgeBuilder; import org.drools.builder.KnowledgeBuilderFactory; import org.drools.builder.ResourceType; import org.drools.conf.EventProcessingOption; import org.drools.io.ResourceFactory; import org.drools.runtime.StatefulKnowledgeSession; import dynamic.FactGenerator; public class Main { void myCode () throws Exception { System.out.println ("myCode()"); final Object obj = new FactGenerator ().getFact (); final KnowledgeBase knowledgeBase = createKnowledgeBase (); final StatefulKnowledgeSession session = knowledgeBase.newStatefulKnowledgeSession (); try { session.insert (obj); System.out.println ("Firing rule..."); final int count = session.fireAllRules (); System.out.println ("rules count: " + count); } finally { session.dispose (); } } private static KnowledgeBase createKnowledgeBase () { System.out.println ("DroolsInvokerServlet.createKnowledgeBase()"); final KnowledgeBaseConfiguration config = KnowledgeBaseFactory.newKnowledgeBaseConfiguration (); config.setOption (EventProcessingOption.STREAM); final KnowledgeBuilder builder = KnowledgeBuilderFactory.newKnowledgeBuilder (); builder.add (ResourceFactory.newClassPathResource ("dynamic/testRule.drl"), ResourceType.DRL); if (builder.hasErrors ()) { throw new RuntimeException (builder.getErrors ().toString ()); } final KnowledgeBase knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase (config); knowledgeBase.addKnowledgePackages (builder.getKnowledgePackages ()); return knowledgeBase; } public static void main (final String[] args) throws Exception { Main m = new Main(); m.myCode (); } } // === FactGenerator.java package dynamic; import java.io.*; import java.lang.reflect.Modifier; import javassist.CannotCompileException; import javassist.NotFoundException; import javassist.ClassPool; import javassist.CtClass; import javassist.CtField; import javassist.CtMethod; import javassist.CtNewMethod; public class FactGenerator { static Class msgClass; public Object getFact () throws IOException, NotFoundException, CannotCompileException, InstantiationException, IllegalAccessException { if (msgClass != null) { return msgClass.newInstance (); } else { final ClassPool pool = ClassPool.getDefault (); CtClass msgCtClass = null; System.out.println ("creating new class..."); msgCtClass = pool.makeClass ("drools.dynamic.Message"); final CtField field = new CtField (CtClass.intType, "Count", msgCtClass); field.setModifiers (Modifier.PRIVATE); msgCtClass.addField (field); final CtMethod getter = CtNewMethod.getter ("getCount", field); msgCtClass.addMethod (getter); final CtMethod setter = CtNewMethod.getter ("setCount", field); msgCtClass.addMethod (setter); msgCtClass.writeFile(); msgClass = msgCtClass.toClass (); return msgClass.newInstance (); } } } import drools.dynamic.Message; function void logMessage() { } // === testRule.drl = rule "Hello World" ## dialect "mvel" when $m : Message( count == 0 ) then System.out.println("count: "+$m.getCount()); logMessage(); retract($m); end On 18/05/2012, Ayush wrote: > Thanks Laune, I tried executing it after adding msgCtClass.writeFile(); > but > it's still throwing the same exception. > > If you could please share the version of lib files you are using along with > the file with the changes? > > -- > View this message in context: > http://drools.46999.n3.nabble.com/Drools-function-not-working-with-Javassist-facts-tp3996584p4000536.html > Sent from the Drools: User forum mailing list archive at Nabble.com. > ___ > rules-use
Re: [rules-users] Building Guvnor from source
Thanks. It works after setting this in run configuration: -Xmx1500M -XX:MaxPermSize=512m There is a note about setting VM arguments in eclipse.ini file (which is only used for launching Eclipse). But it doesn't say about setting it in run configuration. Maybe you might update it with this info. -- View this message in context: http://drools.46999.n3.nabble.com/Building-Guvnor-from-source-tp3999132p4000581.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] Drools function not working with Javassist facts
Thanks Laune, I tried executing it after adding msgCtClass.writeFile(); but it's still throwing the same exception. If you could please share the version of lib files you are using along with the file with the changes? -- View this message in context: http://drools.46999.n3.nabble.com/Drools-function-not-working-with-Javassist-facts-tp3996584p4000536.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] Building Guvnor from source
Personally, I have these set in Eclipse:- -XX:MaxPermSize=512m -Xms512m -Xmx2048m Lower values might work (I believe there is something about this in the droolsjbpm-build-bootstrap\README.md). With kind regards, Mike On 17 May 2012 15:23, anchi wrote: > Hi! > > I'm trying to build Guvnor from source. I have followed instructions listed > here: > > https://github.com/droolsjbpm/droolsjbpm-build-bootstrap/blob/master/README.md > > I am able to start the application. After clicking on URL in Development > Mode tab, Guvnor app starts to load but after a few seconds becomes > unresponsive and I get an OutOfMemoryException: > [org.drools.guvnor.Guvnor] Out of memory; to increase the amount of > memory, > use the -Xmx flag at startup (java -Xmx128M ...) > > I have increased VM memory, however, no matter how much memory I give, it > always throws this exception. > > I get this output in the console: > WARN 17-05 16:14:26,525 > (RulesRepositoryManager.java:createRulesRepository:65) Creating > RulesRepository with default username. > INFO 17-05 16:14:26,530 (RulesRepositoryConfigurator.java:getInstance:46) > Creating an instance of the RulesRepositoryConfigurator. > WARN 17-05 16:14:30,598 > (RulesRepositoryManager.java:createRulesRepository:65) Creating > RulesRepository with default username. > WARN 17-05 16:14:31,764 > (RulesRepositoryManager.java:createRulesRepository:65) Creating > RulesRepository with default username. > > Any suggestions? > > -- > View this message in context: > http://drools.46999.n3.nabble.com/Building-Guvnor-from-source-tp3999132.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