how to perform some task when rule fails.
by Gaurav2007
Hi All,
My requirment is that i want to send corresponding error when any rule
fails.
for example:
rule "ValidationRuleExp_G250.4_0"
when
IValidationField(attributeId =="G250.4")
(((Map( this["G250.18"] !=4))&&(Map( this["G250.4"]not
in("910","990","983","995","996","997"))))||((Map( this["G250.18"]
==4))&&(Map( this["G250.4"] in("910","990","983","995","996","997")))))
then
System.out.println("comming
here---Success-------------------------------------------------->");
end
In this case i can call some method in success,Is there any way so that i
can call some method when any rule fails.
the problem is that i am trying to generate rule file and all the validation
expressions are already defined.
my task is to evaluate these expression and generate corresponding error
message when any rule fails
can you please suggest me how can i do this using drools.
Thanks,
Gaurav
--
View this message in context: http://www.nabble.com/how-to-perform-some-task-when-rule-fails.-tf4475301...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 4 months
localhost issue with JBoss and Drools BRMS
by Peter Docherty
I am having trouble with the BRMS running under JBoss in that the default for
the JBoss app server is to run as localhost but when you change JBoss to use
the actual hostname of the machine so that it can be accessed remotely, the
repository can't be accessed any more.
I know you can export the repository but then you lose all version history.
Is there any other solution? Thanks.
--
I am using Drools 4.0.1 with JBoss 4.2.1 GA.
--
View this message in context: http://www.nabble.com/localhost-issue-with-JBoss-and-Drools-BRMS-tf447453...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 4 months
Globals and Boolean object
by vdelbart
Hi,
My rule is :
#created on: 29 août 2007
package example
#list any import classes here.
global Boolean test
rule "Your Third Rule"
#include attributes such as "salience" here...
when
then
#actions
test = true;
System.out.println("OK-" + test);
end
In my java codes, I have :
session.setGlobal("test", new Boolean(false));
System.out.println("global " + session.getGlobal("test"));
session.fireAllRules();
System.out.println("global " + session.getGlobal("test"));
I expect this :
global false
OK-true
global true
but I have :
global false
OK-true
global false
Anybody have a solution to manipulate Boolean object in globals ?
thanks,
V.
--
View this message in context: http://www.nabble.com/Globals-and-Boolean-object-tf4474442.html#a12757328
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 4 months
Possible shadow proxy issue with JDK Dynamic proxies in 4.0.1?
by Chris West
Hello,
After stumbling upon an issue with version 4.0.0 using "memberOf", I decided
to upgrade to version 4.0.1. After upgrading, my rules do not seem to fire
correctly. In the past, I had discovered issues (prior to 4.0.0 release)
relating to my use of JDK dynamic proxies as facts. The drools team
developed a fix for my problem, and it involved searching for a base
interface type to build the shadow proxy from when the class type is final
(all JDK dynamic proxies are). This problem I'm seeing now seems very
similar in behavior to what I saw before.
Is there any change related to shadow proxies that went into 4.0.1?
Thanks,
-Chris West
17 years, 4 months
BRMS Issues on Websphere 6 - Repository .lock and PropertyNotFoundException
by Barry K
I have the BRMS running on Websphere 6 and am having 2 issues and hoping
someone else may have run into them and might have potential solutions.
Other than these 2 issues, the brms runs very good.
Thanks
1. The repository .lock file get sets when the server starts but is never
released. The file must be manually deleted before the server is restarted.
2. PropertyNotFoundException when viewing the Packages screen for the first
time. After the first time, the page loads normally.
[9/14/07 13:00:10:010 EDT] 0000001e WebApp A SRVE0181I:
[RAILINC_ADMIN_EAR#RAILINC_ADMIN_RULEMANAGE_WEB.war]
[/RAILINC_ADMIN_RULEMANAGE_WEB] [Servlet.LOG]: Exception while dispatching
incoming RPC call: javax.el.PropertyNotFoundException: Property 'jboss' is
not found on type: org.jboss.seam.Namespace
at javax.el.BeanELResolver.getValue(BeanELResolver.java:230)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:135)
at com.sun.el.parser.AstValue.getValue(AstValue.java:96)
at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:183)
at
org.jboss.seam.util.UnifiedELValueBinding.getValue(UnifiedELValueBinding.java:34)
at org.jboss.seam.core.Expressions$1.getValue(Expressions.java:57)
at org.jboss.seam.Component.getInstanceFromFactory(Component.java:1652)
at org.jboss.seam.Component.getInstance(Component.java:1601)
at org.jboss.seam.Component.getInstance(Component.java:1578)
at org.jboss.seam.Component.getInstance(Component.java:1572)
at org.jboss.seam.jsf.SeamELResolver.getValue(SeamELResolver.java:49)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:135)
at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:44)
at com.sun.el.parser.AstValue.getValue(AstValue.java:85)
at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:183)
at
org.jboss.seam.util.UnifiedELValueBinding.getValue(UnifiedELValueBinding.java:34)
at org.jboss.seam.security.Identity.evaluateExpression(Identity.java:507)
at org.jboss.seam.security.Identity.checkRestriction(Identity.java:151)
at
org.jboss.seam.interceptors.SecurityInterceptor.aroundInvoke(SecurityInterceptor.java:35)
at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
at
org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
at
org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:154)
at
org.jboss.seam.intercept.JavaBeanInterceptor.intercept(JavaBeanInterceptor.java:89)
at
org.drools.brms.server.ServiceImplementation$$EnhancerByCGLIB$$bfa6cbfb.listPackages(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:615)
at
org.jboss.seam.remoting.gwt.GWTToSeamAdapter.callWebRemoteMethod(GWTToSeamAdapter.java:70)
at
org.jboss.seam.remoting.gwt.GWTRemoteServiceServlet.processCall(GWTRemoteServiceServlet.java:300)
at
org.jboss.seam.remoting.gwt.GWTRemoteServiceServlet.doPost(GWTRemoteServiceServlet.java:181)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:966)
at
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:907)
at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:145)
at org.jboss.seam.web.ContextFilter.doFilter(ContextFilter.java:56)
at
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
at
com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
at
com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
at
com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:701)
at
com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:646)
at
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:475)
at
com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:463)
at
com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:92)
at
com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:744)
at
com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1433)
at
com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:93)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:394)
at
com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102)
at
com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:152)
at
com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:213)
at
com.ibm.io.async.AbstractAsyncFuture.fireCompletionActions(AbstractAsyncFuture.java:195)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:194)
at
com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:741)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:863)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1510)
--
View this message in context: http://www.nabble.com/BRMS-Issues-on-Websphere-6----Repository-.lock-and-...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 4 months
Problem in using or operator with values in map.
by Gaurav2007
Hi All,
I am using drool 4.0.1,I am facing some problem in using or operator
i am using 2 maps by inserting in to working memory:
1) ErrorMap<"String","String">
2) validationmap<String,Object>
my requirment is to generate error when rule fails for this i am taking
following steps:
1) i insert one entry in error map in when part and if that rule is success
2)i remove that entry from map and
3) at the end on the basis of this map i generates validation errors.
import java.util.Map;
import com.IValidationField;
rule "ValueAllowed_G10.3"
when
IValidationField(attributeId =="G10.3")
$map : Map( keySet contains "ErrorMap" )
eval($map.put("G10.3_V","E_V_ALLOWED") == null || true)
(or Map( this["G10.2"] not in("5"))
Map( this["G10.2"] in("5")))
then
map.remove("G10.3_V");
System.out.println("comming
here----------------------------------------->");
end
this file is giving classcast exception
org.drools.RuntimeDroolsException: java.lang.ClassCastException:
com.ValidationFieldImpl
at org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:75)
at
org.drools.reteoo.EvalConditionNode.assertTuple(EvalConditionNode.java:141)
at
org.drools.reteoo.SingleTupleSinkAdapter.propagateAssertTuple(SingleTupleSinkAdapter.java:20)
at org.drools.reteoo.JoinNode.assertTuple(JoinNode.java:120)
but when i replace "or" with "and" operator then it is working fine:
import java.util.Map;
import com.IValidationField;
rule "ValueAllowed_G10.3"
when
IValidationField(attributeId =="G10.3")
$map : Map( keySet contains "ErrorMap" )
eval($map.put("G10.3_V","E_V_ALLOWED") == null || true)
(and Map( this["G10.2"] not in("5"))
Map( this["G10.2"] in("5")))
then
map.remove("G10.3_V");
System.out.println("comming
here----------------------------------------->");
end
--
View this message in context: http://www.nabble.com/Problem-in-using-or-operator-with-values-in-map.-tf...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 4 months
DSL syntax and mapping
by kissro@lidp.com
I have the following coded in my .dsl:
[condition][]- with a medical code of "{medcode}"=medcode == "{medcode}"
In the BRMS gui, I write my rule as: - with a medical code of 1045
It gets mapped/converted in the .drl as: medcode == " 1045 "
Why is it adding a space at the beginning and end of the code? Is
something in the way I have it coded causing it to do that? It should
be, and I expected it to be, medcode == "1045".
Also another, separate, question - when I use the BRMS point-and-click
gui to create my rule from the model, it generates the rule and inserts
'Dialect "MVEL"' prior to the "When". Why and what is causing it to be
inserted? Is it needed? Is that just the default? Just wondering.
Thanks,
Rod
17 years, 4 months
Tomcat 6 -Axis2 1.3
by Carlsen, Len
Hi,
I am trying to deploy a web service that uses Drools 4.0.1 to Tomcat 6
and Axis2 1.3. Does anybody know how to do this on Tomcat 6/Axis2.
I have tried to place all the drools' jars (and its dependencies) in the
axis2 lib directory but I keep getting java.lang.NoClassDefFoundError
for all my fact objects. I have even tried to use the
org.drools.rule.MapBackedClassLoader to load all my fact objects
manually like it's done in BRMSPackageBuilder without any luck. The
only way to get the web service to work is to put my fact objects in the
axis2 lib directory. One thing I haven't tried is to compiled all the
rules to Java and then deploy those with my web service.
Has anyone done this before or have any suggestions on how to get the
drools compiler to find fact objects on Tomcat/Axis2?
Thanks very much,
Len Carlsen
17 years, 4 months
Eclipse RuleFlow editor
by kissro@lidp.com
I'm trying to create a ruleflow in eclipse but cannot create more than
one connection. I have a Start node, 2 Ruleflowgroup nodes, and an End
node. Using the connection tool I can connect the Start node to the
only one of the rule nodes but can't make any connections after that. I
get the connection plug symbol and a circle with a slash through it. I
can't connect rule node to rule node or rule node to end node. I've
tried using only a start, rule, and end node but it still only allow me
to connect the start node to the rule node but nothing after that.
What's the trick to this? What am I doing wrong?
Thanks for any help
Rod
17 years, 4 months
Similarly Named DSL Rules Not Working
by Brian Enderle
I have the following DSL entries:
County is invalid for State
[condition][]County is invalid for State=eval(StringUtils.isNotBlank
($i.getCntyCd())) and eval(!$i.getCntyCd().substring(0,2).equals($i.getStateCd
()))
POB County is invalid for State
[condition][]POB County is invalid for State=eval(StringUtils.isNotBlank
($i.getPobCntyCd())) and eval(!$i.getPobCntyCd().substring(0,2).equals
($i.getPobStateCd()))
The rule in which I am using the DSL entry is as follows:
rule "LevelOne: Place Of Birth, County is invalid"
agenda-group "LevelOne"
when
There is a NwCitizenship
- pobCntryCd equals MessageConstants.COUNTRY_CODE_US
POB County is invalid for State
then
<Report error>
end
When I atempt to use the POB County... rule I get the following error:
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'ruleBase' defined in class path resource [spring-beans.xml]:
Invocation of init method failed; nested exception is
org.drools.rule.InvalidRulePackage: [143,33]: unknown:143:33 Unexpected
token '$i'[143,47]: unknown:143:47 mismatched token:
[@987,4726:4726=')',<12>,143:47]; expecting type THEN
Caused by: org.drools.rule.InvalidRulePackage: [143,33]: unknown:143:33
Unexpected token '$i'[143,47]: unknown:143:47 mismatched token:
[@987,4726:4726=')',<12>,143:47]; expecting type THEN
at org.drools.rule.Package.checkValidity(Package.java:420)
at org.drools.common.AbstractRuleBase.addPackage
(AbstractRuleBase.java:292)
at com.sample.RuleBaseBeanFactory.afterPropertiesSet
etc...
However, if I change "POB County" to "POBCounty" (no space, only change the
DSL call leaving the actual code the same) everything works. Can someone
explain why the two rules cannot coexist with the space in "POB County"?
Thanks,
Brian Enderle
17 years, 4 months