How do you use Ruleflows with StatelessSession's?
by Shahad Ahmed
Does anyone know if it's possible to use a ruleflow with a StatelessSession?
The current documentation and API seem to show examples with
StatefullSessions i.e.:
statefullSession.startProcess(id);
statefullSession.fireAllRules();
etc...
However, there doesn't seem to be anything equivalent in the API for
StatelessSesssion's. I'd really like to be able to use the new sequential
mode (i.e. with a StatelessSession) and ruleflow.
Regards,
Shahad
16 years, 8 months
BRMS
by Markus Helbig
Hi,
i tryed to deploy the BRMS on a WebSphere Server, but i get
incompatibility errors. It seems BRMS can not be used with JRE 1.4.x,
right? Why? JRE 1.4.x is still very common and often used in
enterprises ...
Cheers
Markus
Stacktrace is:
Could not be defined due to: (org/jboss/seam/servlet/SeamListener) bad
major version at offset=6
This is often caused by having a class defined at multiple
locations within the classloader hierarchy. Other potential causes
include compiling against an older or newer version of the class
that has an incompatible method signature.
Dumping the current context classloader hierarchy:
==> indicates defining classloader
16 years, 9 months
How to write constraint about a Map inside a Map?
by Felipe Piccolini
Suppouse I have a Map attribute and one of the values is another
Map...how can I check a member of the inner Map?
class MyFact{
Map map;
public MyFact(){
this.map = new HashMap();
}
....setter and getter...
}
-- test --
MyFact myFact = new MyFact();
Map innerMap = new HashMap();
innerMap.put("innerKey", new String("InnerValue"));
Map map = new HashMap();
map.put("mapKey", innerMap);
myFact.setMap(map);
.... set the RuleBase and insert myFact as a fact for the
WorkingMemory...
-------
Now... how should I write the rule to check the innerKey ??
rule "test InnerMap"
when
$mf: MyFact( map['mapKey']['innerKey'] ==
"InnerValue" ) // doesnt work...
....
$mf: MyFact( map['mapKey'].this['innerKey'] ==
"InnerValue" ) // doesnt work...
$mf: MyFact( map['mapKey'].['innerKey'] == "InnerValue" ) //
doesnt work...
$mf: MyFact( $innerMap: map['mapKey'], $innerMap['innerKey'] ==
"InnerValue" ) // doesnt work...
$mf: MyFact( $innerMap: map['mapKey'] -> ($innerMap
['innerKey'] == "InnerValue" )) // doesnt work...
Thanks.
Felipe Piccolini M.
felipe.piccolini(a)bluesoft.cl
16 years, 10 months
Using JBoss Rules in cases where users need to add / remove rules
by Robert Burdick
Hello All:
I am trying to figure out if JBoss Rules will be suitable for my
application
needs. Maybe you can give some insight.
My application needs to implement / use a rules engine for evaluating
conditions and firing off events when those conditions are met. So far
this
sounds exactly like the sort of thing that JBoss Rules is for. The
twist is
that my application will also provide an administrative utility that
allows
admins to add or remove rules, as well as modify the conditions that
trigger
these rules. Can JBoss Rules be used to do this? All of the examples
I've
seen so far seem to incorporate rules whose consequences are fixes, but
with
changeable conditions. For example, there are lots of samples out there
like an insurance application. Such an example has consequences such as
offerQuote, turnDownCustomer etc. that don't change, but with conditions
that do change. For example, today offer quotes to all good drivers,
tomorrow change the rule to offer quotes to all good drivers over the
age of
18. The conditions change, but the basic actions in the system are
common.
What I think my requirement implies is a way to define rules with
conditions
and the corresponding consequences code at runtime. This seems to imply
that the application code needs to be dynamic, in order to allow users
to
define arbitrary consequence code. Has anyone ever tried to do
something
this generic with JBoss Rules, and better, can you fill me in on how to
go
about this?
Thanks, Robert
16 years, 11 months
BRMS Insurance Sample - Invalid Class Exception
by John Nader
I am seeing the same issue. My configuration is slightly different in
that I am using Drools 4.0.3 and JBoss 4.2.2GA with Java 5. I have been
searching very hard to find where these two different version of
AbstractParser are coming from. This class comes out of the MVEL. The
jar in the drools-jbrms is mvel14-1.2.10.jar. I only see this jar
within the deployment.
My thought is that a serialized version of the class is stored in a file
somewhere in the demo project or the BRMS itself, and that it is from an
older version mvel.
-J
--Original Message-
Folks,
Using BRMS 4.0.2 and examples 4.02 as downloaded from the 'official
release' site.
Working my way through the Drools Insurance Sample (on BRMS). I'm
deploying BRMS successfully on JBoss 4.2.1 with Java 1.6.0_02. I can
import the repository_export.xml ok and see the files. I leave this part
of the sample running as per the instructions.
When I go to the 2nd part of the example I have a problem running the
unit tests: within /drools-examples/drools-insurance I run: mvn clean
package. I get the error(1) at the bottom of this email. I do *not* get
the output as per the documentaiton. I skip the tests, build and deploy
the drools-insurance.war
When deploying the war I see the following error (2) in the JBoss logs .
However main drools insurance page loads ok as per the screenshot in the
documentation):
22:43:13,576 INFO [WebappClassLoader]
validateJarFile(C:\software\jboss-4-2-1\server\default\.\tmp\deploy\tmp2
6632drool
s-insurance-exp.war\WEB-INF\lib\servlet-api-2.3.jar) - jar not loaded.
See Servlet Spec 2.3, section 9.7.2. Offending class:
javax/servlet/Servlet.class
I enter some values in the web app (make sure there are no nulls) press
'continue' then get the same error (3)
22:48:55,294 ERROR [STDERR] java.io.InvalidClassException:
org.mvel.AbstractParser; local class incompatible: stream cla
ssdesc serialVersionUID = 256028721591955695, local class
serialVersionUID = -7464517220700761297
22:48:55,310 ERROR [STDERR] at
java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:562)
As an aside , when I look for the latest BRMS , as mentioned in the docs
(http://cruisecontrol.jboss.com/cc/artifacts/jboss-rules) - I get a
'Invalid File or Directory'
Is there anything I should try to resolve this?
Paul
RuleAgent(insuranceconfig) INFO (Thu Oct 18 22:37:44 BST 2007):
Configuring package provider : URLScanner monitoring URL
s:
http://localhost:8080/drools-jbrms/org.drools.brms.JBRMS/package/org.acm
e.insurance.base/InsuranceDemo
RuleAgent(insuranceconfig) EXCEPTION (Thu Oct 18 22:37:45 BST 2007):
org.mvel.AbstractParser; local class incompatible:
stream classdesc serialVersionUID = 256028721591955695, local class
serialVersionUID = -7464517220700761297. Stack trace
should follow..io.ObjectStreamClass.initNonProxy(Unknown Source)
java.io.InvalidClassException: org.mvel.AbstractParser; local class
incompatible: stream classdesc serialVersionUID = 25
6028721591955695, local class serialVersionUID = -7464517220700761297
at java.io.ObjectStreamClass.initNonProxy(Unknown Source)rce)
at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)urce)
at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)rce)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)ce)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)Source
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)ce)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)ce)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)ource)
at java.io.ObjectInputStream.readObject(Unknown Source)own
Source)
at java.util.HashMap.readObject(Unknown Source)ce)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
at java.lang.reflect.Method.invoke(Unknown Source)known Source)
at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)urce)
at java.io.ObjectInputStream.readObject(Unknown Source) Source)
at org.drools.rule.Package.readExternal(Package.java:194)
at java.io.ObjectInputStream.readExternalData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown
Source)java:54)
at java.io.ObjectInputStream.readObject0(Unknown Source)va:137)
at java.io.ObjectInputStream.readObject(Unknown Source)java:109)
at
org.drools.agent.HttpClientImpl.fetchPackage(HttpClientImpl.java:54)
at
org.drools.agent.URLScanner.readPackage(URLScanner.java:137)0)
at
org.drools.agent.URLScanner.getChangeSet(URLScanner.java:109))
at
org.drools.agent.URLScanner.loadPackageChanges(URLScanner.java:88)
at
org.drools.agent.RuleAgent.checkForChanges(RuleAgent.java:330)
at
org.drools.agent.RuleAgent.refreshRuleBase(RuleAgent.java:298)
at org.drools.agent.RuleAgent.configure(RuleAgent.java:284)48)
at org.drools.agent.RuleAgent.init(RuleAgent.java:208)ava:216)
at
org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:176)romRuleAgent(
InsuranceSessionHelper.java:26)
at
org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:148)suranceSessio
nHelper.java:17)
at
org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:216)ntalInfoTest.
java:23)
at
org.acme.insurance.web.InsuranceSessionHelper.loadRuleBaseFromRuleAgent(
InsuranceSessionHelper.java:26)
at
org.acme.insurance.web.InsuranceSessionHelper.getSession(InsuranceSessio
nHelper.java:17)
at
org.acme.insurance.test.SupplementalInfoTest.setUp(SupplementalInfoTest.
java:23)
at junit.framework.TestCase.runBare(TestCase.java:125)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)tive Method)
at junit.framework.TestSuite.runTest(TestSuite.java:208)ource)
at junit.framework.TestSuite.run(TestSuite.java:203)nknown
Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
Source)estSet.java:210)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)uteTestSet(AbstractDirectoryTestSuite.java:135
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:2
10)DirectoryTestSuite.java:122)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSe
t(AbstractDirectoryTestSuite.java:135
) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(Abstr
actDirectoryTestSuite.java:122)
at
org.apache.maven.surefire.Surefire.run(Surefire.java:129)ource)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
Source)Process(SurefireBooter.java:225)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)oter.java:747)
at java.lang.reflect.Method.invoke(Unknown Source)psed: 0.671
sec <<< FAILURE!
at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(Suref
ireBooter.java:225)
at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java
:747)
Tests run: 5, Failures: 0, Errors: 5, Skipped: 0, Time elapsed: 0.655
sec <<< FAILURE!
Running org.acme.insurance.test.DriverTestped: 0, Time elapsed: 0 sec
<<< FAILURE!
Tests run: 7, Failures: 0, Errors: 7, Skipped: 0, Time elapsed: 0.016
sec <<< FAILURE!
Running org.acme.insurance.test.DriverAdditionalInfoTestlapsed: 0.015
sec <<< FAILURE!
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.015
sec <<< FAILURE!
Running org.acme.insurance.test.InsuranceCalculateTest
Tests run: 3, Failures: 0, Errors: 3, Skipped: 0, Time elapsed: 0.016
sec <<< FAILURE!
17 years
Re: [rules-users] RuntimeDroolsException: Unable to load
by Chong Minsk Goh
Hi Mark,
Thank for the tips. : )
I have added the required mvel14-1.2.8.jar in my classpath. However, I still
encounter the same error.
Could it be a class loader issue or JRE version?
I tried to trace the class loader. Drools is used in my application (running
in netbeans). My application is using java.net.FactoryURLClassLoader. On
plain netbeans project (before the error occurs), the class loader is
sun.misc.Launcher$AppClassLoader. My netbeans is using JRE v 1.6.0
The error occurs when PackageBuilder is initialised.
Package Builder builder = new PackageBuilder();
Also, for the Drools Eclipse plugin (on a seperate occassion), when i import
some codes, it prompt me that Drools project is not a Java 5.0 project.
Best regards!
Eric
Chong Minsk Goh wrote:
> Hi,
>
> I am trying to run Drools on Netbeans. I have added the jars from
> Drools 4.0.2.
>
> However, I encountered an error
>
> org.doxa.rules.RulesManager - org.drools.RuntimeDroolsException:
> Unable to load dialect
> 'org.drools.rule.builder.dialect.mvel.MVELDialectConfiguration:mvel'
MVEL is a required jar, not an optional one, put it on your classpath
and hopefully this should work for you.
>
> I did not use any MVEL dialects in my rules definition. Here is my rule:
> *
>
> rule
>
> * "Out of Range" *when* m : Message( message == "checkRange" , status
> == 1 )
>
> Range(myMin : myMin, myMax : myMax, myValue : myValue)
>
> Range(myValue < myMin || myValue > myMax)
>
> *then* m.setMessage("");
>
> m.setStatus(0);
>
> *end*
>
> Has anyone attempted using Netbeans with Drools and faced this problem?
>
> Best regards
> Eric
17 years
Problem with removePackage()
by igor_b
Hi,
I'm using drools 4.0.1. I'm first adding one package to my RuleBase object,
and everything works just fine:
...
builder.addPackageFromDrl(new InputStreamReader(resource.getInputStream()));
if(ruleBase == null) {
ruleBase = RuleBaseFactory.newRuleBase();
}
ruleBase.addPackage(builder.getPackage());
But after some time i need to refresh my rules, so i'm using following code
to remove previous package:
ruleBase.removePackage("org.sample.mypackage");
and i'm getting the following error:
java.lang.NullPointerException
at org.drools.reteoo.ReteooBuilder.removeRule(ReteooBuilder.java:222)
at org.drools.reteoo.ReteooRuleBase.removeRule(ReteooRuleBase.java:272)
at
org.drools.common.AbstractRuleBase.removePackage(AbstractRuleBase.java:460)
at
com.diosphere.diomedia.common.drools.impl.RulesServiceImpl.refresh(RulesServiceImpl.java:121)
at
com.diosphere.diomedia.service.impl.PromotionManagerImpl.refreshDRLs(PromotionManagerImpl.java:39)
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 uk.ltd.getahead.dwr.impl.ExecuteQuery.execute(ExecuteQuery.java:170)
at
uk.ltd.getahead.dwr.impl.DefaultProcessor.doExec(DefaultProcessor.java:552)
at
uk.ltd.getahead.dwr.impl.DefaultProcessor.handle(DefaultProcessor.java:88)
at uk.ltd.getahead.dwr.DWRServlet.doPost(DWRServlet.java:178)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118)
at
com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
net.sf.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:167)
at
net.sf.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:120)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Does anyone have a clue what might be the problem, and how to fix it?
Kind regards!
--
View this message in context: http://www.nabble.com/Problem-with-removePackage%28%29-tf4727072.html#a13...
Sent from the drools - user mailing list archive at Nabble.com.
17 years
Agenda filter based on package name
by Hooman Mozaffari
It seems "Rule" class doesn't store its parent "Package" information and Rule.getPackage() always returns null.
I would like to create an AgendaFilter based on package name but there is no way to get the parent package of each rule.
Thanks,
Hooman
public class PackageNameAgendaFilter implements AgendaFilter {
private final String packageSuffix;
private final boolean accept;
public PackageNameAgendaFilter(String packageSuffix){
this(packageSuffix, true);
}
public PackageNameAgendaFilter(String packageSuffix, boolean accept){
this.packageSuffix = packageSuffix;
this.accept = accept;
}
public boolean accept(Activation activation) {
if(activation.getRule().getPackage().startsWith(packageSuffix))
return accept;
else
return false;
}
}
_________________________________________________________________
Discover the new Windows Vista
http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QBRE
17 years
Executing rules actions asynchronously
by Carlos Vieira
Hi,
I'm facing a situation, that maybe some of you just solved out in the past.
I need that the execution of matched rules ( Activations that are
already in the Agenda, referencing those rules) is done asynchronously.
In more detail, i need that each set of actions owned by two or more
rules, runs in a separated thread.
The problem here is that i need to invoke external Web Services in rule
actions.... well, some Web Services may take too long to return
something, what makes the other actions of other rules to wait for
this... what is not an expected behavior...
Any one knows if jboss rules already support this kind of approach? If
not, any one has passed through this?
Accessing to the mechanism of firing individual rules seems to be the
best way, overriding a couple of classes..... how can i fire just one
rule with jboss rules? is this the best choice?
Well, if anyone has any idea, it would be nice
Regards
Carlos V.
17 years
Using java.util.List in rules
by Anderson Pazza Mello
Hi everyone,
I'm trying to use a java.util.List like this:
rule "Test"
when
e : Especialista(retratoUser.lstCarac.get(0).codCarac != 0)
then
System.out.println("test");
end
The property lstCarac is a java.util.List<Caracteristica>. I'm getting this
error :
org.drools.rule.InvalidRulePackage: [18,44]: unknown:18:44 Unexpected token
'0'[18,46]: unknown:18:46 Unexpected token '.'
at org.drools.rule.Package.checkValidity(Package.java:419)
Someone knows what i have to do to fix the problem??
--
Anderson Pazza Mello
Tecnologia em Informática - UFPR
17 years