Drools Dyanmic Class creation Problem
by saurabh maheshwari
Hi sir ,
I am facing one issue regarding dyamic class cretion and inserting it's
object into drools memory.
i have created a dyanmic class test and loads it like that
MyClassLoader clr =new
MyClassLoader(Obj.getClass().getClassLoader());
Obj.clazz= clr.loadClass("test");
//Drools Configuration
KnowledgeBuilderConfiguration kbc =
KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(null,clazz.getClassLoader());
KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder(kbc);
String path = System.getProperty("user.dir");
StringBuilder drlFile = new StringBuilder(path);
drlFile.append(System.getProperty("file.separator")).append("myRule.drl");
kbuilder.add(ResourceFactory.newFileResource(drlFile.toString()),
ResourceType.DRL);
if (kbuilder.hasErrors())
{
System.out.println(kbuilder.getErrors());
return;
}
KnowledgeBaseConfiguration kbaseConfig
=KnowledgeBaseFactory.newKnowledgeBaseConfiguration(null,
clazz.getClassLoader());
kbase = KnowledgeBaseFactory.newKnowledgeBase(kbaseConfig);
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
ksession = kbase.newStatefulKnowledgeSession();
Now my drl file is like that
package dyanmicclass;
dialect "java"
rule mytest1
when
$tx : test($pp : name )
then
globalArrayList.add($tx);
System.out.println($tx );
end
this is giving me a error
KnowledgeBuilder created.
Unable to generate rule invoker. : [Rule name='mytest1']
dyanmicclass/Rule_mytest1_0DefaultConsequenceInvoker.java (22:886) :
test cannot be resolved to a type
dyanmicclass/Rule_mytest1_0DefaultConsequenceInvoker.java (22:898) :
test cannot be resolved to a type
Rule Compilation error : [Rule name='mytest1']
dyanmicclass/Rule_mytest1_0.java (6:214) : txn cannot be resolved to
a type
but while i am doing like that
dialect "java"
rule mytest1
when
$tx : test($pp : name )
then
System.out.println($pp );
end
it gives no error .
I am not able to find the cause of the problem .
am i wrong in any configuaration.
Thanks
Saurabh
13 years, 9 months
accumulate min over java.util.Date
by jkrupka
Should I be able to do an accumulate min over java.util.Date objects? Like
this:
$minDate : Date() from accumulate(MyFact ($startDate : startDate),
min($startDate))
I would have thought so, but when I try it, I'm getting:
Caused by: java.lang.ClassCastException: java.util.Date cannot be cast to
java.lang.Number
at
org.drools.base.accumulators.MinAccumulateFunction.accumulate(MinAccumulateFunction.java:76)
If it should work, then it's possible I'm doing something else wrong, but
everything looks correct to me. I can always work around it by getting the
milliseconds from the Date object and doing the min over that... it's just
not as clean looking.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/accumulate-min-over-j...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 9 months
[Drools Interest] Dynamic rule loading from DB
by bilasini sahoo
Hi All,
I am new to this Drool rule ingine use.
Normal drl is working for me.
But mu requirement is i need to configure all the rules in Data base and
from there i need to inject to the Rule engine.This is beacuse Rules can be
configured any point of time.
Please let me know if is there any special foemat of rule configuration is
required so that creating rule file would be easier
currently i have configured as
(Company=CCC && Organisation=OOO and Dept=HR) OR (Country=UK)
(Company=CCC && Organisation=OOO )and (Dept=HR OR Country=UK)
please advice. I am stuck with this proble since 2days
Thanks,
Bilasini
13 years, 9 months
Attempted JIRA on BPMN2 issue in Eclipse
by drdaveg
I tried to submit this to https://issues.jboss.org/secure/, but my password
reset, while successful doesn't let me in to submit a JIRA.
On the stable (M1?) version of 5.2 I encounter the following exception.
- Create a BPMN2 diagram with a nest subprocess that has a rule task with
ruleflow-group specified (or not)
- Save it
- Reopen it
Dialog box in Eclipse:
Could not read RuleFlow file
An exception occurred while reading in the RuleFlow XML: the prefix "G" for
attribute "g:ruleFlowGroup" associated with the element type
"businessRuleTask" is not bound. See the error log for more details.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Attempted-JIRA-on-BPM...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 9 months
execute Rules selectively
by Benson Fung
Hi,
I have setup about 10 rules in the rulebase. Can you tell me how I
can execute more than one specific rule at the same time? Please help
Thanks
Benson
13 years, 9 months
This Tuesday!!! - Red Hat & Accenture: BRMS & BPMS Event (London)
by Mark Proctor
http://blog.athico.com/2011/02/red-hat-accenture-brms-bpms-event.html
Reminder that this Tuesday 24th of March you can come and hear all about
Drools and jBPM5!!!!
Registration Page:
https://engage.redhat.com/forms/UK_Event_Accenture290311
Join Red Hat and Accenture on Tuesday 29th March at Accenture Old Bailey
to understand how Business Rules Management Systems (BRMS) and Business
Process Management Systems (BPMS) can help businesses leverage
technology more effectively and increase productivity. See how
Enterprise Open Source is leading the way with powerful capabilities and
industry-leading innovation.
There will be 2.5 hours of technical talks, starting at 9am. Full
timings and agenda here:
http://www.europe.redhat.com/events/rh-accenture-seminar/
Speakers:
Mark Proctor - Drools Co-Founder and Poject Lead
Kris Verlaenen - jBPM Lead
Michael Anstis
Geoffrey de Smet
Talks (from core developers, there are other talks too:
Introduction to Rule Based Systems (Mark Proctor)
Introduces Drools and explains what a rule based system is and how it
works. We will also cover event processing on a rule based system.
Why BPMN2 Matters (Kris Verlaenen)
jBPM5 has just been released as premier Open Source BPMN2
implementation. Come and hear how this changes your whole legacy
approach to BPM.
Using Guvnor for Enterprise Systems (Geoffrey de Smet)
Guvnor provides a web interface to your knowlege systems, such as rules
and bpm. This talk provides a gentle introduction into Guvnor and how to
use it.
Decision Tables in Depth (Michael Anstis)
Decision Tables is now a major focus for us, we want to show you why
we'll have the slicket decision table environment out there.
13 years, 9 months
endless loop even with "no-loop"
by James Gu
Hi, I am working on rule and found that it is very easy to cause endless
loop.
For example:
Rule 1 match status and update message.
Rule 2 match type and update message.
This will cause endless loop even I add "no-loop" on each rule. Is there
anyway to avoid this? for example: each rule only execute one time, or set a
maximum execute times.
rule "rule 1"
no-loop
when
m : Message( status == Message.HELLO)
then
System.out.println( "rule 1" );
m.setMessage( "update 1" );
update( m );
end
rule "rule 2"
no-loop
when
m:Message( type=="type1" )
then
System.out.println( "rule 2" );
m.setMessage( "update 2" );
update( m );
end
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/endless-loop-even-wit...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 9 months
combining fact model and processes
by Jordi Alvarez
Hello, we are starting a project using Drools and we are interested in the
conbination of fact models defined in drl files and processes.
We have been looking for documentation regarding this issue, but we have
seen only examples of combining drl-defined types from within rules.
We are interested in using types defined in drl files (as explained in
section 4.7.2 of the drools engine reference) inside process constraints.
Is this possible?
many thanks in advance,
Jordi
13 years, 9 months
Merge repository in Guvnor and editing brl with eclipse plugin
by ioda100
Hi,
I try to figure out how to import a package from an instance of guvnor to
another instance of guvnor without destroying all the existing repository.
There is an import/export function in the administration part of guvnor but
it export all the repository and when import a repository, it's erasing all
before importing.
What i would like to be able to do is : i have a package with rules,
functions, enum, dsl, test scenarios... under an instance of guvnor and i
have another package under another instance and i would like to import the
second package to the other instance of guvnor without erasing the existing
repository. Is it a way to do this? i can't find it. maybe with the eclipse
plugin? I don't want to import from a drl file because i would loose the
graphical part (use of dsl, enum...).
My second question is that i try to use the guvnor plugin for eclipse to
manage rules in the guvnor repository. I can access to it and read/modify
all but i can't modify the ".brl" files, i get for all the files this
message : "Could not open the editor: An unexpected exception was thrown.
java.lang.NullPointerException
at org.drools.eclipse.rulebuilder.ui.ActionSetFieldWidget.(Unknown Source)
at
org.drools.eclipse.rulebuilder.ui.RuleModeller.addActionSetFieldWidget(Unknown
Source)
at org.drools.eclipse.rulebuilder.ui.RuleModeller.redrawRhs(Unknown Source)
at org.drools.eclipse.rulebuilder.ui.RuleModeller.reloadRhs(Unknown Source)
at org.drools.eclipse.rulebuilder.ui.RuleModeller.reloadWidgets(Unknown
Source)
at org.drools.eclipse.rulebuilder.editors.BrlPage.setModelXML(Unknown
Source)
at org.drools.eclipse.rulebuilder.editors.RuleEditor.pageChange(Unknown
Source)
at
org.eclipse.ui.part.MultiPageEditorPart.setActivePage(MultiPageEditorPart.java:1076)
at
org.eclipse.ui.forms.editor.FormEditor.setActivePage(FormEditor.java:597)
at
org.eclipse.ui.part.MultiPageEditorPart.createPartControl(MultiPageEditorPart.java:361)
at
org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:662)
at
org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:462)
at
org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
at
org.eclipse.ui.internal.EditorReference.getEditor(EditorReference.java:286)
at
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2857)
at
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2762)
at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2754)
at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2705)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at
org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2701)
at
org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2685)
at
org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2668)
at org.guvnor.tools.utils.PlatformUtils.openEditor(Unknown Source)
at org.guvnor.tools.views.RepositoryView.doubleClick(Unknown Source)
at org.guvnor.tools.views.RepositoryView.access$4(Unknown Source)
at org.guvnor.tools.views.RepositoryView$7.run(Unknown Source)
at org.guvnor.tools.views.RepositoryView$9.doubleClick(Unknown Source)
at
org.eclipse.jface.viewers.StructuredViewer$1.run(StructuredViewer.java:821)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.runtime.Platform.run(Platform.java:888)
at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:48)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
at
org.eclipse.jface.viewers.StructuredViewer.fireDoubleClick(StructuredViewer.java:819)
at
org.eclipse.jface.viewers.AbstractTreeViewer.handleDoubleSelect(AbstractTreeViewer.java:1419)
at
org.eclipse.jface.viewers.StructuredViewer$4.widgetDefaultSelected(StructuredViewer.java:1195)
at
org.eclipse.jface.util.OpenStrategy.fireDefaultSelectionEvent(OpenStrategy.java:238)
at org.eclipse.jface.util.OpenStrategy.access$0(OpenStrategy.java:235)
at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:296)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3910)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3503)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
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.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
at org.eclipse.equinox.launcher.Main.main(Main.java:1287)
"
Thanks in advance for your help.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Merge-repository-in-G...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 9 months