[rules-users] Help with DefaultAgenda.java
Hello, I have tried to change the source code of DefaultAgenda.Java by adding the code below: //drools orginial sequential code /* while ( continueFiring( fireLimit ) && fireNextItem( agendaFilter ) ) { fireCount++; fireLimit = updateFireLimit( fireLimit ); this.workingMemory.executeQueuedActions(); } */ //code with concurrency InternalAgendaGroup myGroup = (InternalAgendaGroup) getNextFocus(); fireCount = myGroup.size(); for(int i =0; i< fireCount; ++i) { new Thread(new Runnable(){ public void run() { fireNextItem( agendaFilter ); } }).start(); } I am getting an Errorjava.lang.NullPointerException because my code flow is going to consequenceExceptionHandler ! = null exception. else if ( this.consequenceExceptionHandler != null ) { this.consequenceExceptionHandler.handleException( activation, this.workingMemory.getKnowledgeRuntime(), e ); Could you kindly help me with this? I am pasting the exception below and I am using Drools 5.4 Final version. In DA: [Activation rule=Rule 1, act#=0, salience=0, tuple=[fact 0:0:1773684356:1306428912:0:DEFAULT:org.drools.reteoo.InitialFactImpl@4dde85f0] ] Exception in thread "Thread-1" Exception in thread "Thread-0" Exception executing consequence for rule "Rule 1" in defaultpkg: java.lang.NullPointerException In DA WM: org.drools.impl.StatefulKnowledgeSessionImpl@542487b1 In DA Errorjava.lang.NullPointerException In DA: [Activation rule=Rule 2, act#=1, salience=0, tuple=[fact 0:0:1773684356:1306428912:0:DEFAULT:org.drools.reteoo.InitialFactImpl@4dde85f0] ] In DA WM: org.drools.impl.StatefulKnowledgeSessionImpl@542487b1 In DA Errorjava.lang.NullPointerException at org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39) at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1287) at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1208) at org.drools.common.DefaultAgenda$1.run(DefaultAgenda.java:1471) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.NullPointerException at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1272) ... 3 more Exception executing consequence for rule "Rule 2" in defaultpkg: java.lang.NullPointerException at org.drools.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39) at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1287) at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:1208) at org.drools.common.DefaultAgenda$1.run(DefaultAgenda.java:1471) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.NullPointerException at org.drools.common.DefaultAgenda.fireActivation(DefaultAgenda.java:1272) ... 3 more Thanks a lot for the help. Regards, Malory -- View this message in context: http://drools.46999.n3.nabble.com/Help-with-DefaultAgenda-java-tp4022758.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 in Activator.java
Thanks! That worked:) -- View this message in context: http://drools.46999.n3.nabble.com/Error-in-Activator-java-tp4022753p4022755.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] Error in Activator.java
Hi All, I am new to drools and I am looking forward to receive help from experts out here. I have created a new drools project where I will be using drools-distribution-5.4.0.Final. I have created three Source folders for drools-compiler-5.4.0.Final-sources, drools-core-5.4.0.Final-sources and knowledge-api-5.4.0.Final-sources. I have imported all the other binaries/JAR's available from the same drools-distribution-5.4.0.Final folder using Java Build path. I have been getting errors in all the three source folders and the errors are related to Activator.java. In all the import statements I am getting an error called The import org.osgi cannot be resolved. import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import org.osgi.framework.ServiceRegistration; import org.osgi.util.tracker.ServiceTracker; import org.osgi.util.tracker.ServiceTrackerCustomizer; I am not sure where to find org.osgi. Any help related to this is greatly appreciated. Thanks in advance, Mallory -- View this message in context: http://drools.46999.n3.nabble.com/Error-in-Activator-java-tp4022753.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] Editing DefaultAgenda.java file from org.drools.common
Hello, I would be grateful to receive some help regarding editing Drools engine source code. I am looking at making the drools engine execute rules parallel so I went ahead and changed the DefaultAgenda.java source file. On running this file everything worked perfectly well. I tried to run two different for loops from 1 to 500 in two different rules and I saw that both threads were working together. On the other hand when I make a jar file of this by using the class file for DefaultAgenda and try to run in a new project I am getting the error below: java.lang.NoSuchMethodError: org.drools.RuleBaseConfiguration.getComponentFactory()Lorg/drools/reteoo/ReteooComponentFactory; at org.drools.common.DefaultAgenda.setWorkingMemory(DefaultAgenda.java:215) at org.drools.reteoo.ReteooWorkingMemory.(ReteooWorkingMemory.java:110) at org.drools.reteoo.ReteooStatefulSession.(ReteooStatefulSession.java:81) at org.drools.reteoo.ReteooRuleBase.newStatefulSession(ReteooRuleBase.java:402) at org.drools.reteoo.ReteooRuleBase.newStatefulSession(ReteooRuleBase.java:387) at org.drools.impl.KnowledgeBaseImpl.newStatefulKnowledgeSession(KnowledgeBaseImpl.java:176) at org.drools.impl.KnowledgeBaseImpl.newStatefulKnowledgeSession(KnowledgeBaseImpl.java:163) at drools.main.DroolsApi.createKnowledgeBase(DroolsApi.java:38) at drools.main.TestMain.main(TestMain.java:8) Can someone please help me fix this issue? Thanks in advance:) -- View this message in context: http://drools.46999.n3.nabble.com/Editing-DefaultAgenda-java-file-from-org-drools-common-tp4022549.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