the BRMS and queries
by Benjamin J McMillan
All,
Either the BRMS, when uploading a DRL file, doesn't read in queries, or
it doesn't build them into the deployment package.
Is this by design, or a bug? For now my application (my unit tests,
actually) queries the working memory for decision objects, instead of
having rules respond to the decisions and put them into a data structure
the java app can see. I could do the latter, but I'm just wondering if
maybe I'm doing something wrong regarding queries and the BRMS.
Thanks!
Ben
16 years, 4 months
Multiple DRL files uploading into BRMS
by Thalupula Ravi
Hi,
I created a Rule project and couple of .drl file in Eclipse, i'm planning to
upload all .drl files into BRMS in a single shot. I know the we can upload
only one .drl file into BRMS at a time.
My questions are
1) can we uploading entire rule project into BRMS? I read that inform of XML
we can do that? some body help me, how it can be done?
or
2) uploading .pkg files into BRMS
or
3) multiple .drl files into BRMS at a time
Thanks in advance. This is very urgent requirement for us. plz help me.
Ravi Thalupula
--
View this message in context: http://www.nabble.com/Multiple-DRL-files-uploading-into-BRMS-tp17528851p1...
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 4 months
Re: Ant script for creating pkg files
by ravi thalupula
Hi,
You can use below ant script to build .pkg files
<project default="rules" name="RuleProject">
<!-- Uncomment this for Maven Runner -->
<property name="eclipsepath" value="."/>
<!-- Uncomment this for Eclipse Runner -->
<!-- <property name="eclipsepath" value="../../../"/> -->
<path id="cheese.classpath">
<pathelement location="${eclipsepath}/build/Beans.jar"/>
</path>
<target name="beans" >
<tstamp/>
<echo message="CREATING Beans JAR..."/>
<jar
jarfile="./build/Beans.jar">
<fileset
dir="./bin"/>
</jar>
</target>
<path>
<pathelement></pathelement>
</path>
<path id="drools.classpath">
<fileset dir="${eclipsepath}/build/lib/">
<include name="*.jar"/>
</fileset>
<pathelement location="target"/>
</path>
<taskdef name="compiler"
classname="org.drools.contrib.DroolsCompilerAntTask"
classpathref="drools.classpath" />
<target name="rules" >
<compiler
srcdir="${eclipsepath}/src/main/rules"
tofile="${eclipsepath}/target/cheese.pkg"
classpathref="cheese.classpath"
binformat="package" >
<include name="*.drl" />
<!-- <include name="*.brl" />
<include name="*.xml" />
<include name="*.dslr" /> -->
</compiler>
</target>
</project>
reference http://www.nabble.com/Ant-compiler-task--td15906277.html#a15907448
Regards,
Ravi T
16 years, 4 months
Ant script for creating pkg files
by Shreekanta Prasad
Hi All,
We are using Jboss BRMS web interface(drools-jbrms.war)
deployed on jboss-4.2.1.GA app server to generate .pkg files from drl
and xls(for decision tables) files
Necessary jars (application dependent) also uploading as model
archive as available in the interface.
After generating .pkg files we are uploading those into database by
using batch script.
Now our requirement is we like do the .pkg file creation through ant
script.I have searched and tried out using drools-ant task but not able
to get the proper results.
Is there any solution for that?
<?xml version="1.0"?>
<project default="rules" basedir="."
name="createpackage">
<path id="rules.lib" >
<pathelement location="drools-ant-4.0.2.jar" />
<pathelement
location="drools-compiler-4.0.3.jar" />
<pathelement location="drools-core-4.0.3.jar" />
<pathelement
location="drools-decisiontables-4.0.2.jar" />
<pathelement location="drools-jsr94-4.0.2.jar"
/>
<pathelement location="janino-2.5.10.jar" />
<pathelement
location="core-3.2.3.v_686_R32x.jar" />
<pathelement location="jsr94-1.1.jar" />
<pathelement location="jxl-2.4.2.jar" />
<pathelement location="mvel14-1.2.8.jar" />
<pathelement location="xercesImpl-2.4.0.jar" />
<pathelement location="xml-apis-1.0.b2.jar" />
<pathelement location="xpp3_min-1.1.3.4.O.jar"
/>
<pathelement location="ant-1.6.5.jar" />
<pathelement location="antlr-runtime-3.0.jar" />
<pathelement location="ant-nodeps-1.6.5.jar" />
</path>
<taskdef name="rulebase"
classname="org.drools.contrib.DroolsCompilerAntTask"
classpathref="rules.lib"/>
<target name="rules" >
<rulebase
srcdir="."
tofile="ProductConflictRules.pkg"
classpathref="rules.lib" >
<include name="*.drl" />
</rulebase>
</target>
</project>
The above script is giving error like
BUILD FAILED
build.xml:66: RuleBaseTask failed: Unable to load dialect
'org.drools.rule.builder.dialect.java.JavaDialectConfiguration:java'
All the necessary jars are there in the classpath.
Is it anyway to automate using ant the whole process done by BRMS
webcleint itself ?
Thanks and Regards -
Shreekanta Prasad
Banglore ,India
16 years, 4 months
no-loop and update vs. PropertyChangeListener
by Jaroslaw Kijanowski
Hi,
I'm running the StateExampleUsingSalience example. It uses a fact with
PropertyChangeSupport.
AFAIUI I don't have to call update() every time I modify this fact in
the RHS, when I want to have my rules to be reconsidered.
I've modified the drl to look like this:
rule "a"
no-loop true
when
b : State(name == "B", state == State.NOTRUN )
then
System.out.println(b.getName() + " finished" );
b.setState( State.FINISHED );
System.out.println(b.getName() + " finished 2" );
b.setState( State.NOTRUN );
end
When I insert a State object (name="B", state="State.NONE"), this rule
would run forever if no-loop wouldn't be set to true. Unfortunately I'm
wrong. If I want to have no-loop working I need to provide update()
after b.setState().
So it looks like PropertyChangeSupport doesn't cancel an activation,
like update() does.
Thanks,
Jarek
16 years, 4 months
ClassCastException in JBoss 4.2.2
by David Norwood
Hi, all of a sudden this error shows up. So, I upgrade from 4.0.4 to 4.0.7,
and the issue is still there. Some posts mention this may be related to the
JDT. Do I need to have JDT in my path? Another post said to add the
-Ddrools.compiler=JANINO as a Sys prop, which doesn't fix the problem
either.
Help?
-david in Atlanta
Code is here:
private RuleFactory() {
bases = new HashMap();
dsls = new HashMap();
packages = new HashMap();
conf = new PackageBuilderConfiguration(); <----- error happens here
/* JavaDialectConfiguration jConf = (JavaDialectConfiguration)
conf.getDialectConfiguration( "java" );
jConf.setCompiler( JavaDialectConfiguration.JANINO );
//conf.setJavaLanguageLevel( "1.5" );
conf.setCompiler( PackageBuilderConfiguration. ); */
}
And error here:
Caused by: java.lang.ExceptionInInitializerError
at
com.virtuant.mobilitee.helper.DroolsHelper.getWorkingMemory(DroolsHelper.java:57)
at
com.virtuant.mobilitee.ejb.RuleControllerBean.runPackage(RuleControllerBean.java:395)
at
com.virtuant.mobilitee.ejb.RuleControllerBean.runPackage(RuleControllerBean.java:361)
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:585)
at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
at
org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
... 55 more
Caused by: org.drools.RuntimeDroolsException: Unable to load dialect
'org.drools.rule.builder.dialect.java.JavaDialectConfiguration:java'
at
org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:160)
at
org.drools.compiler.PackageBuilderConfiguration.buildDialectConfigurationMap(PackageBuilderConfiguration.java:146)
at
org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:121)
at
org.drools.compiler.PackageBuilderConfiguration.(PackageBuilderConfiguration.java:98)
at com.virtuant.mobilitee.workflow.RuleFactory.(RuleFactory.java:55)
at com.virtuant.mobilitee.workflow.RuleFactory.(RuleFactory.java:44)
... 64 more
Caused by: java.lang.ClassCastException:
org.drools.rule.builder.dialect.java.JavaDialectConfiguration
at
org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:155)
... 69 more
--
View this message in context: http://www.nabble.com/ClassCastException-in-JBoss-4.2.2-tp17494918p174949...
Sent from the drools - user mailing list archive at Nabble.com.
16 years, 4 months
RE: [rules-users] Newbie question / NoSuchMethodError error
by Cabou, Carl
Edson,
My problem is solved since I can use RuleAgent API which allows me to consume rules via url by using the brms or by using package files (depending on the directive « file » or « url » in the properties file).
See in Drools doc in section 9.4.4.1
Am I right ?
Regards,
Carl.
_____
De : Cabou, Carl
Envoyé : mardi 27 mai 2008 17:31
À : Rules Users List
Objet : RE: [rules-users] Newbie question / NoSuchMethodError error
Thanks for the quick answer Edson.
So if I don't want to use Java5 app server for production brms, I may use the brms only for design purpose and then deploy my rules in production by using generated package files.
But it seems to me that the brms can only export package files and the Drools API deals only with drl files.
Regards,
Carl.
_____
De : rules-users-bounces(a)lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] De la part de Edson Tirelli
Envoyé : mardi 27 mai 2008 17:02
À : Rules Users List
Objet : Re: [rules-users] Newbie question / NoSuchMethodError error
Carl,
Yes, BRMS requires Java 5. Only the engine itself (core/compiler/etc) works in java 1.4.
[]s
Edson
2008/5/27 Cabou, Carl <Carl.Cabou(a)prima-solutions.com>:
Edson,
When I use JDK 1.4 using Drools 4.0.7 on JBoss AS 4.0.5 I get the following exception :
java.lang.UnsupportedClassVersionError: org/drools/brms/server/files/AssetFileServlet (Unsupported major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at org.jboss.ws.integration.jboss.DeployerInterceptorJSE.isWebserviceDeployment(DeployerInterceptorJSE.java:124)
at org.jboss.ws.integration.jboss.DeployerInterceptor.create(DeployerInterceptor.java:76)
at org.jboss.ws.integration.jboss.DeployerInterceptorJSE.create(DeployerInterceptorJSE.java:74)
at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.create(SubDeployerInterceptorSupport.java:180)
at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:91)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy39.create(Unknown Source)
at org.jboss.deployment.MainDeployer.create(MainDeployer.java:969)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:818)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
at sun.reflect.GeneratedMethodAccessor56.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy8.deploy(Unknown Source)
at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:417)
at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy4.start(Unknown Source)
at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
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:324)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy5.deploy(Unknown Source)
at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
at org.jboss.Main.boot(Main.java:200)
at org.jboss.Main$1.run(Main.java:490)
at java.lang.Thread.run(Thread.java:534)
I don't get this exception when using jdk5.0.
Beside this in the drools documentation (section 9.2.1.1. « Supported and recommended platforms ») it is written « The BRMS is capable of running in any application server that supports Java SE5 ».
I am unable to reproduced the exception bellow I had before, I guess it was my client code which was not generated in the proper JDK version (5.0 and I need client code to be 1.4).
So I guess I need to use jdk1.4 client code using Drools BRMS url running on jdk5.0.
Regards,
Carl.
_____
De : rules-users-bounces(a)lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] De la part de Edson Tirelli
Envoyé : jeudi 8 mai 2008 13:56
À : Rules Users List
Objet : Re: [rules-users] Newbie question / NoSuchMethodError error
Carl,
Drools 4.0.x is indeed JDK 1.4+ compatible.
Can you please share your complete stack trace?
The snippet you showed:
Caused by: java.lang.NoSuchMethodError: java.lang.Integer.valueOf(I
)Ljava/lang/Integer;
at AL_Calculation.Rule_ setSelecte_10_0.consequence(Unknown Source)
Says that the problem is happening the consequence of a rule called something like:
"setSelecte_10_0"
Where _ is any non-valid character for classnames.
That is not the rule you showed before.
[]s
Edson
2008/5/8 Cabou, Carl <Carl.Cabou(a)prima-solutions.com>:
So Does anybody know how I can make Drools 4 API works in JAVA1.4 ??
Carl
-----Message d'origine-----
De : rules-users-bounces(a)lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] De la part de Cabou, Carl
Envoyé : jeudi 8 mai 2008 10:41
À : Rules Users List
Objet : RE: [rules-users] Newbie question / NoSuchMethodError error
Thomas,
I can not move the headings since I do receive "0 - 50" as a String and then I have to return an Integer.
I've made a little program beside this to test my rule, I've launched it using java5, it worked fine, but it does crash using java1.4.
I just found out the Integer.valueOf(int) is a new feature of java5.
So I guess I must try to run my web application using java5.
Carl.
-----Message d'origine-----
De : rules-users-bounces(a)lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] De la part de Hehl, Thomas
Envoyé : jeudi 8 mai 2008 10:20
À : 'Rules Users List'
Objet : RE: [rules-users] Newbie question / NoSuchMethodError error
No, really, java uses the valueOf methods internally to try to convert the
object specified (a String) into an Integer so it can do the comparison. You
can't do selected == "0 - 50" because "0 - 50" is a String and you cant
compare it to an Integer.
So what are you trying to do? If you want selected to be in the range
between 0 and 50 inclusive, then you need to change the heading in your
decision table. Here's an example:
daysBeforeSummons >= $1, daysBeforeSummons <= $2
and then you specify the data in your column as 0,50.
Good luck!
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Cabou, Carl
Sent: Thursday, May 08, 2008 10:12 AM
To: Rules Users List
Subject: RE: [rules-users] Newbie question / NoSuchMethodError error
Thank you for answering Thomas.
Here is the code below, nothing fancy:
public void setSelected (Integer calculatedSetSelected)
{
this. calculatedSetSelected = calculatedSetSelected;
}
In fact, the problem IS that it is taking an Integer and some Drools
Internal method want to convert it using Integer.valueOf, but there is no
Integer.valueOf taking Integer.
There is something weird, in the stack trace, I get :
Caused by: java.lang.NoSuchMethodError:
java.lang.Integer.valueOf(I)Ljava/lang/Integer;
at AL_Calculation.Rule_ setSelecte_10_0.consequence(Unknown Source)
There is a missing "d" before "_10" ...
Carl
-----Message d'origine-----
De : rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] De la part de Hehl, Thomas
Envoyé : jeudi 8 mai 2008 09:35
À : 'Rules Users List'
Objet : RE: [rules-users] Newbie question / NoSuchMethodError error
Yep. Post the code for setSelected(). I'm guessing it takes an Integer or
int and you're passing it a String.
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Cabou, Carl
Sent: Thursday, May 08, 2008 9:23 AM
To: rules-users(a)lists.jboss.org
Subject: [rules-users] Newbie question / NoSuchMethodError error
Greetings,
I'm new to Drools and I've written a decision table based rule using excel.
The rule validates ok and I've deployed my package fine.
I've written a piece of code to test my rules, I want to set the
calculatedRate to 125 when I get selected field equal to "0 - 50" :
...
StatelessSession statelessSession = rb.newStatelessSession(); Data data=new
Data(); data.setSelected("0 - 50"); statelessSession.execute(data); // set
private Integer field ...
When I run the code I get a exeption :
java.lang.NoSuchMethodError: java.lang.Integer.valueOf(I)Ljava/lang/Integer;
I don't understand why Drools tries to convert to Integer something which is
already Integer !!!!
-----------
Here is the rules code.
rule "setCalculateRate_11"
salience 65525
when
Data(selected == "0 - 50")
then
object.setCalculatedRate(125);
end
--------------
The CalculatedRate field is a java.lang.Integer object.
Does anybody has an idea ??
Regards,
Carl.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
JBoss Drools Core Development
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @ www.jboss.com
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
JBoss Drools Core Development
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @ www.jboss.com
16 years, 4 months
RE: [rules-users] Newbie question / NoSuchMethodError error
by Hehl, Thomas
No, really, java uses the valueOf methods internally to try to convert the
object specified (a String) into an Integer so it can do the comparison. You
can't do selected == "0 - 50" because "0 - 50" is a String and you cant
compare it to an Integer.
So what are you trying to do? If you want selected to be in the range
between 0 and 50 inclusive, then you need to change the heading in your
decision table. Here's an example:
daysBeforeSummons >= $1, daysBeforeSummons <= $2
and then you specify the data in your column as 0,50.
Good luck!
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Cabou, Carl
Sent: Thursday, May 08, 2008 10:12 AM
To: Rules Users List
Subject: RE: [rules-users] Newbie question / NoSuchMethodError error
Thank you for answering Thomas.
Here is the code below, nothing fancy:
public void setSelected (Integer calculatedSetSelected)
{
this. calculatedSetSelected = calculatedSetSelected;
}
In fact, the problem IS that it is taking an Integer and some Drools
Internal method want to convert it using Integer.valueOf, but there is no
Integer.valueOf taking Integer.
There is something weird, in the stack trace, I get :
Caused by: java.lang.NoSuchMethodError:
java.lang.Integer.valueOf(I)Ljava/lang/Integer;
at AL_Calculation.Rule_ setSelecte_10_0.consequence(Unknown Source)
There is a missing "d" before "_10" ...
Carl
-----Message d'origine-----
De : rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] De la part de Hehl, Thomas
Envoyé : jeudi 8 mai 2008 09:35
À : 'Rules Users List'
Objet : RE: [rules-users] Newbie question / NoSuchMethodError error
Yep. Post the code for setSelected(). I'm guessing it takes an Integer or
int and you're passing it a String.
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Cabou, Carl
Sent: Thursday, May 08, 2008 9:23 AM
To: rules-users(a)lists.jboss.org
Subject: [rules-users] Newbie question / NoSuchMethodError error
Greetings,
I'm new to Drools and I've written a decision table based rule using excel.
The rule validates ok and I've deployed my package fine.
I've written a piece of code to test my rules, I want to set the
calculatedRate to 125 when I get selected field equal to "0 - 50" :
...
StatelessSession statelessSession = rb.newStatelessSession(); Data data=new
Data(); data.setSelected("0 - 50"); statelessSession.execute(data); // set
private Integer field ...
When I run the code I get a exeption :
java.lang.NoSuchMethodError: java.lang.Integer.valueOf(I)Ljava/lang/Integer;
I don't understand why Drools tries to convert to Integer something which is
already Integer !!!!
-----------
Here is the rules code.
rule "setCalculateRate_11"
salience 65525
when
Data(selected == "0 - 50")
then
object.setCalculatedRate(125);
end
--------------
The CalculatedRate field is a java.lang.Integer object.
Does anybody has an idea ??
Regards,
Carl.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
16 years, 4 months
Compound rules?
by Jayne
Hi All,
Newbie terminology question: what do you call it when you want to assert the
state of several objects in working memory?
Example: your working memory is full of marble objects. I know how to test
each marble for color, but if there is a red marble, a blue marble and a
yellow marble then I have enough marbles for a set. How can test the state
of the working memory? Is this possible with Drools?
Thanks,
Jayne2520
16 years, 4 months
Re: [rules-users] DSL/DRL Problem
by ringsah@comcast.net
Edson,
Thanks, I had looked at the special "-" character, and had considered doing something like you suggested. It's just that my colleagues had developed the "client is an adult" expression, and wanted to get reuse out of it, rather than doing something different for every situation where there was a person to be checked for adulthood, like for the spouse of the original client.
I know it doesn't make much sense, because its a different entity, perhaps with a relationship to the original entity. It's just that we are new to this, and we are not sure how complete the documentation is, and if there is some syntax we are missing that could be used in this situation.
Thanks,
-Hans
-------------- Original message --------------
From: "Edson Tirelli" <tirelli(a)post.com>
Do you mean like:
There is a client
- which is adult
- whose wife is adult
Mapped to:
Client( age > 17, spouse.age > 17 )
Take a look at the manual and check for the "-" special character.
[]s
Edson
2008/5/27 <ringsah(a)comcast.net>:
Hi All,
I am new to Drools - my company is evaluating it for use in a project. We are doing a proof of concept, and we are developing a DSL. One of our DSL expressions is
"client is an adult"
which is defined as
Client(age > 17)
The problem we have is that there are many different types of people in our system that we would like to test for adulthood. For example, we have the client's spouse (Client.spouse), and the clients children (Client.children), who we also want to test for adulthood. Do we need to make a different DSL expression for each case, or is there a way to "genericize" the DSL expression so it could be used for any person?
TIA,
-Hans
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
JBoss Drools Core Development
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @ www.jboss.com
16 years, 4 months