Debug rule functions ?
by ipeshev
Hello,
could some give me some tips for debugging *functions* in .drl ?
by now I'm not able to debug *inside the functions* which are called by the
rule sequence.
I follow the
http://docs.jboss.org/tools/3.0.0.GA/en/drools_tools_ref_guide/html_singl...
JBoss Drools Tools Reference Guide but what is show there is how to debug a
very simple *rule sequence*. I have no problem with that - following the
guide everything is ok.
BUT
There is nothing shown about a more complex case when there are functions
(java-like) in the .drl file and the rule calls one or more of these
functions. And one function calls another etc. (just like in normal
programming)
When a put a breakpoint inside functions I cannot debug them.
I can only debug the *rule* ("then" section)
Any help would be appreciated?
Or any official info if this supported at all.
versions etc.
Best Regards
Ivan
--
View this message in context: http://drools.46999.n3.nabble.com/Debug-rule-functions-tp3689774p3689774....
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 1 month
Decision Table Help
by qwertyqwerty
hi
I was wondering if I could get some help on how to achieve something using
an Excel based decision table to do the following:
I have an ArrayList of Objects.
The Object will contain: name, value, result
In my spreasheet i need to check to see if the value confroms to a
particular regex, and set the response in the <result> of my Object.
Each name will have a different regex applied to it.
Does anyone have any suggestions on the best way/steps to achieve this?
--
View this message in context: http://drools.46999.n3.nabble.com/Decision-Table-Help-tp4019281.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 2 months
java.lang.OutOfMemoryError: Java heap space
by vdelbart
Hello,
In my tests of the 4.0.3, I have some : java.lang.OutOfMemoryError.
So, I try a simple test with 10.000 sequential execution of 1 rule with no
context and just a workingmemorylogger and I have the error :
java.lang.OutOfMemoryError: Java heap space
My code is :
public class ExecReglesMemotyTest
{
private static final Reader DRL = new
InputStreamReader(ExecReglesMemotyTest.class
.getResourceAsStream("/rules/exemple.drl"));
private static final String FICHIER_LOG = "session";
/**
* @param args
*/
public static void main(String[] args)
{
try
{
PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl(DRL);
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage(builder.getPackage());
for (int i = 0; i < 10000; i++)
{
StatefulSession session = ruleBase.newStatefulSession();
WorkingMemoryFileLogger logger = new WorkingMemoryFileLogger(session);
logger.setFileName(FICHIER_LOG);
session.fireAllRules();
logger.writeToDisk();
session.dispose();
}
}
catch (Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
with this rule (doesn't matter):
#created on: Fri Nov 09 15:48:45 CET 2007
package initPackage
#list any import classes here.
rule "ERG9"
when
then
end
I try this in 4.0.1, and it's working (no OutOfMemoryError)
What's the problem ?
thanks for any information,
V.
--
View this message in context: http://www.nabble.com/java.lang.OutOfMemoryError%3A-Java-heap-space-tf477...
Sent from the drools - user mailing list archive at Nabble.com.
12 years, 2 months
getting mismatched '==' error
by zeeshan
Hi !
Please find my attached Decision Table. I am getting following error...
log4j:WARN No appenders could be found for logger (com.sample.RuleRunner).
log4j:WARN Please initialize the log4j system properly.
Warning: Cell at E20 not present - adding a blank
Warning: Cannot read name ranges for Excel_BuiltIn__FilterDatabase_1 -
setting to empty
Warning: Cannot read name ranges for Excel_BuiltIn__FilterDatabase_1 -
setting to empty
Warning: Cannot read name ranges for Excel_BuiltIn__FilterDatabase_1 -
setting to empty
Exception in thread "main" org.drools.rule.InvalidRulePackage: [10,9]: [ERR
102] Line 10:9 mismatched input '==' in rule "Distribution Cost Rules_11"
[23,9]: [ERR 102] Line 23:9 mismatched input '==' in rule "Distribution Cost
Rules_12"
[36,9]: [ERR 102] Line 36:9 mismatched input '==' in rule "Distribution Cost
Rules_13"
[49,9]: [ERR 102] Line 49:9 mismatched input '==' in rule "Distribution Cost
Rules_14"
[62,9]: [ERR 102] Line 62:9 mismatched input '==' in rule "Distribution Cost
Rules_15"
[75,9]: [ERR 102] Line 75:9 mismatched input '==' in rule "Distribution Cost
Rules_16"
[88,9]: [ERR 102] Line 88:9 mismatched input '==' in rule "Distribution Cost
Rules_17"
[101,9]: [ERR 102] Line 101:9 mismatched input '==' in rule "Distribution
Cost Rules_18"
[114,9]: [ERR 102] Line 114:9 mismatched input '==' in rule "Distribution
Cost Rules_19"
[127,9]: [ERR 102] Line 127:9 mismatched input '==' in rule "Distribution
Cost Rules_20"
[140,9]: [ERR 102] Line 140:9 mismatched input '==' in rule "Distribution
Cost Rules_21"
[153,9]: [ERR 102] Line 153:9 mismatched input '==' in rule "Distribution
Cost Rules_22"
[166,9]: [ERR 102] Line 166:9 mismatched input '==' in rule "Distribution
Cost Rules_23"
[179,9]: [ERR 102] Line 179:9 mismatched input '==' in rule "Distribution
Cost Rules_24"
[192,9]: [ERR 102] Line 192:9 mismatched input '==' in rule "Distribution
Cost Rules_25"
[205,9]: [ERR 102] Line 205:9 mismatched input '==' in rule "Distribution
Cost Rules_26"
[218,9]: [ERR 102] Line 218:9 mismatched input '==' in rule "Distribution
Cost Rules_27"
[231,9]: [ERR 102] Line 231:9 mismatched input '==' in rule "Distribution
Cost Rules_28"
[244,9]: [ERR 102] Line 244:9 mismatched input '==' in rule "Distribution
Cost Rules_29"
[257,9]: [ERR 102] Line 257:9 mismatched input '==' in rule "Distribution
Cost Rules_30"
[270,9]: [ERR 102] Line 270:9 mismatched input '==' in rule "Distribution
Cost Rules_31"
[283,9]: [ERR 102] Line 283:9 mismatched input '==' in rule "Distribution
Cost Rules_32"
[296,9]: [ERR 102] Line 296:9 mismatched input '==' in rule "Distribution
Cost Rules_33"
[309,9]: [ERR 102] Line 309:9 mismatched input '==' in rule "Distribution
Cost Rules_34"
[0,0]: Parser returned a null Package
at org.drools.rule.Package.checkValidity(Package.java:471)
at
org.drools.common.AbstractRuleBase.addPackages(AbstractRuleBase.java:481)
at org.drools.reteoo.ReteooRuleBase.addPackages(ReteooRuleBase.java:436)
at org.drools.reteoo.ReteooRuleBase.addPackage(ReteooRuleBase.java:443)
at com.sample.RuleRunner.loadRules(RuleRunner.java:70)
at com.sample.RuleRunner.runStatelessRules(RuleRunner.java:185)
at com.sample.RuleMain.main(RuleMain.java:132)
http://drools.46999.n3.nabble.com/file/n4017627/Distribution_Factor.xls
Distribution_Factor.xls
--
View this message in context: http://drools.46999.n3.nabble.com/getting-mismatched-error-tp4017627.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 2 months
Unable to find implementation for BusinessRuleProvider
by John Peterson
Hi,
I've been experimenting with the Guided Rule Editor plug-in in Eclipse.
I've built a Drools Project using the default Hello World sample
application. I've created a new "Guided Rule" in my project called
"GuidedRule.brl" and get the associated "drools.package" with it. The
rule is simple:
WHEN
THEN
System.out.println("Rule has fired");
I build the knowledge base as follows:
private static KnowledgeBase readKnowledgeBase() throws
Exception {
KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("SampleGuided.drl"),
ResourceType.BRL);
KnowledgeBuilderErrors errors = kbuilder.getErrors();
if (errors.size() > 0) {
for (KnowledgeBuilderError error: errors) {
System.err.println(error);
}
throw new IllegalArgumentException("Could not
parse knowledge.");
}
KnowledgeBase kbase =
KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
return kbase;
}
The only line changed is adding the resource of type BRL.
When I try to run, I get the following error:
java.lang.RuntimeException: org.drools.compiler.DroolsParserException:
org.drools.CheckedDroolsException: Unable to find implementation for
BusinessRuleProvider
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.j
ava:544)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.ja
va:28)
at com.sample.DroolsTest.readKnowledgeBase(DroolsTest.java:41)
at com.sample.DroolsTest.main(DroolsTest.java:23)
Caused by: org.drools.compiler.DroolsParserException:
org.drools.CheckedDroolsException: Unable to find implementation for
BusinessRuleProvider
at
org.drools.compiler.PackageBuilder.addPackageFromBrl(PackageBuilder.java
:386)
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.j
ava:470)
... 3 more
Caused by: org.drools.CheckedDroolsException: Unable to find
implementation for BusinessRuleProvider
at
org.drools.compiler.BusinessRuleProviderFactory.throwNoImplementationFou
nd(BusinessRuleProviderFactory.java:66)
at
org.drools.compiler.BusinessRuleProviderFactory.loadProvider(BusinessRul
eProviderFactory.java:42)
at
org.drools.compiler.BusinessRuleProviderFactory.getProvider(BusinessRule
ProviderFactory.java:25)
at
org.drools.compiler.PackageBuilder.addPackageFromBrl(PackageBuilder.java
:366)
... 4 more
I've tried variations to add the drools.package as a PKG type, I've had
the rules (and package) in both "com.sample" and /src/main/rules, but I
can't seem to resolve the problem. "drools.package" has been updated to
include the package name (package com.sample;) and I import the message
class as well (even though it isn't being used currently).
I suspect the issue is simple, but I haven't been able to figure it out.
Any help would be appreciated.
12 years, 2 months
Protobuf Marshaller Question (ScheduledActivation Persistence)
by Philipp Herzig
Dear developers,
I believe this is a question for Edson.
I wonder if ScheduledActivations are added to the Agenda when
unmarshalling an existing session and fired as well, e.g., non-expired
timers.
I guess that this worked with the DefaultMarshaller implementation (at
least I can see LOCs in the InputMarshaller where normal or scheduled
activations are added to the newly created agenda). I cannot find
similar code in the ProtobufMarshaller or, more precisely, the
ProtobufInputMarshaller.
I also tried to override MarshallerProvider in order to use the
DefaultMarshaller but that is obviously not-consistent
(ClassCastException) with the current codebase anymore.
Hopefully, I am doing/understanding sth. completely wrong here.
Thanks for any help regarding this issue,
Philipp
12 years, 2 months
All the values from one list must be present in other
by Suvek
I tried looking for similar posts but could not find any that fits the
requirements.
Really speaking this is a 2 part question.
What I need to do is compare 2 lists and ensure that all the fields inside
the reference list are present in passed in list.
following is the simplified version of test that I want to perform...
$requiredAddressTypes : List() from [ AddressType.BUSINESS,
AddressType.FOREIGN_BUSINESS ]
$taxpayer : Taxpayer(taxpayerType == TaxpayerType.FOREIGN_BUISINESS &&
addresses.size > 0,
$addresses : addresses)
1 - Based on the taxpayer type I need to ensure that ALL the
requiredAddressTypes must be present, how can I achieve this?
2 - is the this statement correct ? ($requiredAddressTypes : List() from [
AddressType.BUSINESS, AddressType.FOREIGN_BUSINESS ])
--
View this message in context: http://drools.46999.n3.nabble.com/All-the-values-from-one-list-must-be-pr...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 2 months
Deploy Drools in AS7 as OSGi bundles
by Dan Seaver
I'd like to use Drools as OSGi services in the JBoss Adaptive Server (version
7.1.1).
I haven't found any specifics about how to do this in the drools
documentation (or anywhere else with my google searches), so I'm attempting
to deploy the jars mentioned in the droolsjbpm-integration-docs via the
JBoss Management console. The jars are:
knowledge-api
drools-core
drools-compiler
drools-templates
drools-decisiontables
All of the jars install ok, but when I try to enable them (start the
bundles), I run into problems.
knowledge-api seems to start fine.
However, the other bundles have dependencies on drools-core.
When I try to enable drools-core, I get exceptions claiming the required
bundle, org.drools.internalapi, is missing. So, I added the following
bundle:
knowledge-internal-api.jar
Now I get the exception that package com.google.protobuf is missing.
*Any guidance on how to install drools in AS7 as OSGi services would be
greatly appreciated!*
Stack trace snippet from JBoss console when trying to deploy drools-core:
12:45:43,783 ERROR [org.jboss.osgi.framework.internal.FrameworkEventsPlugin]
(MSC service thread 1-2) Framework ERROR:
org.osgi.framework.BundleException: Cannot resolve bundle resModule:
[org.drools.core:5.4.0.Final]
at
org.jboss.osgi.framework.internal.ResolverPlugin.resolve(ResolverPlugin.java:157)
[jbosgi-framework-core-1.1.8.Final.jar:1.1.8.Final]
at
org.jboss.osgi.framework.internal.AbstractBundleState.ensureResolved(AbstractBundleState.java:551)
[jbosgi-framework-core-1.1.8.Final.jar:1.1.8.Final]
at
org.jboss.osgi.framework.internal.HostBundleState.startInternal(HostBundleState.java:211)
[jbosgi-framework-core-1.1.8.Final.jar:1.1.8.Final]
at
org.jboss.osgi.framework.internal.AbstractBundleState.start(AbstractBundleState.java:494)
[jbosgi-framework-core-1.1.8.Final.jar:1.1.8.Final]
at
org.jboss.as.osgi.deployment.BundleStartTracker$1.processService(BundleStartTracker.java:144)
[jboss-as-osgi-service-7.1.1.Final.jar:7.1.1.Final]
at
org.jboss.as.osgi.deployment.BundleStartTracker$1.transition(BundleStartTracker.java:119)
[jboss-as-osgi-service-7.1.1.Final.jar:7.1.1.Final]
at
org.jboss.msc.service.ServiceControllerImpl.invokeListener(ServiceControllerImpl.java:1416)
[jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at
org.jboss.msc.service.ServiceControllerImpl.access$2700(ServiceControllerImpl.java:49)
[jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at
org.jboss.msc.service.ServiceControllerImpl$ListenerTask.run(ServiceControllerImpl.java:1954)
[jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
[rt.jar:1.6.0_26]
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
[rt.jar:1.6.0_26]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_26]
Caused by: org.jboss.osgi.resolver.XResolverException: Unable to resolve
Module[org.drools.core:5.4.0.Final]: missing requirement
[Module[org.drools.core:5.4.0.Final]] package; (package=com.google.protobuf)
at
org.jboss.osgi.resolver.felix.FelixResolver.resolveInternal(FelixResolver.java:117)
[jbosgi-resolver-felix-1.0.13.Final.jar:1.0.13.Final]
at
org.jboss.osgi.resolver.spi.AbstractResolver.resolve(AbstractResolver.java:149)
[jbosgi-resolver-spi-1.0.13.Final.jar:1.0.13.Final]
at
org.jboss.osgi.framework.internal.ResolverPlugin.resolve(ResolverPlugin.java:155)
[jbosgi-framework-core-1.1.8.Final.jar:1.1.8.Final]
... 11 more
--
View this message in context: http://drools.46999.n3.nabble.com/Deploy-Drools-in-AS7-as-OSGi-bundles-tp...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 2 months