Drools templates header arguments
by petert
I am working on a project, using templates to generate all my rules. I have
one problem though, I wanna parse my arguments to the template as a
ArrayList, and do somthing like this:
template header
ruleId
args
package dk.prks
import com.poc.entity.Bill;
import com.poc.entity.BillLine;
import com.poc.entity.Description;
import java.util.ArrayList;
template "01"
rule "@{ruleId}_(a){row.rowNumber}"
dialect "mvel"
when
$bill : Bill ($line : lines) and
BillLine( service == @{args.get(0)}, $lineNr : lineNr) from $line and
BillLine( service == @{args.get(1)}, lineNr < $lineNr) from $line
then
$bill.setColor(1);
end
end template
However, this is not possible. Furthermore I want to stretch that
performance is an issue, and i want the generated file to only contain the
values from the list, and not make any look ups in the array when running my
rules
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-templates-header-arguments-tp402...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 5 months
Drools 6 getting started
by captainrhino
Basically I have a web app in which I would like to run some drools rules
from the new KIW-WB objects. e.g. KieContainer objects
Does anyone have a link to an idiots guide to getting started to Drools 6?
I'm looking to build a drools 6 maven project from one of the standard
example KIE-WB projects. What do i need MAven , GIthub etc and how do I
build it?
I then need to be able to use this project within a non-maven project, i.e.
build a jar from within the maven project that can then be used by my
non-maven java project. With the old deprecated KnowledgeBase classes I
used to be able to do this really easily.
Any suggestions would be most welcome and appreciated.
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-6-getting-started-tp4026911.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 5 months
Exception when uploading JAR without POM in 6.0.0-Final
by SrjTx
If you try to upload a JAR without a pom.xml, it requests GAV info and then
throws the exception included at the bottom of the list.
I'm thinking that at line 141 in FileServlet.java, gav is not null and
therefore fileData is not converted to a BufferedInputStream at line 146,
which cause line 174 to throw the exception.
This is on CentOS 6.4
Work-around is to make sure you always have pom.xml in META-INF/maven
09:29:27,273 ERROR
[org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/guvnor].[M2RepoFileServlet]]
(http-localhost/127.0.0.1:8080-4) JBWEB000236: Servlet.service() for servlet
M2RepoFileServlet threw exception:
org.guvnor.common.services.shared.exceptions.GenericPortableException:
mark/reset not supported
at
org.guvnor.common.services.backend.exceptions.ExceptionUtilities.handleException(ExceptionUtilities.java:24)
[guvnor-services-api-6.0.0.Final.jar:6.0.0.Final]
at
org.guvnor.m2repo.backend.server.FileServlet.uploadFile(FileServlet.java:180)
[guvnor-m2repo-editor-backend-6.0.0.Final.jar:6.0.0.Final]
at
org.guvnor.m2repo.backend.server.FileServlet.processUpload(FileServlet.java:84)
[guvnor-m2repo-editor-backend-6.0.0.Final.jar:6.0.0.Final]
at
org.guvnor.m2repo.backend.server.FileServlet.doPost(FileServlet.java:70)
[guvnor-m2repo-editor-backend-6.0.0.Final.jar:6.0.0.Final]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
[jboss-servlet-api_3.0_spec-1.0.2.Final.jar:1.0.2.Final]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
[jboss-servlet-api_3.0_spec-1.0.2.Final.jar:1.0.2.Final]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295)
[jbossweb-7.2.0.Final.jar:7.2.0.Final]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
[jbossweb-7.2.0.Final.jar:7.2.0.Final]
at
org.uberfire.security.server.UberFireSecurityFilter.doFilter(UberFireSecurityFilter.java:266)
[uberfire-security-server-0.3.0.Final.jar:0.3.0.Final]
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
[jbossweb-7.2.0.Final.jar:7.2.0.Final]
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
[jbossweb-7.2.0.Final.jar:7.2.0.Final]
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
[jbossweb-7.2.0.Final.jar:7.2.0.Final]
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149)
[jbossweb-7.2.0.Final.jar:7.2.0.Final]
at
org.jboss.as.web.session.ClusteredSessionValve.handleRequest(ClusteredSessionValve.java:134)
[jboss-as-web-7.2.0.Final.jar:7.2.0.Final]
at
org.jboss.as.web.session.ClusteredSessionValve.invoke(ClusteredSessionValve.java:99)
[jboss-as-web-7.2.0.Final.jar:7.2.0.Final]
at
org.jboss.as.web.session.JvmRouteValve.invoke(JvmRouteValve.java:92)
[jboss-as-web-7.2.0.Final.jar:7.2.0.Final]
at
org.jboss.as.web.session.LockingValve.invoke(LockingValve.java:64)
[jboss-as-web-7.2.0.Final.jar:7.2.0.Final]
at
org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)
[jboss-as-web-7.2.0.Final.jar:7.2.0.Final]
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145)
[jbossweb-7.2.0.Final.jar:7.2.0.Final]
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97)
[jbossweb-7.2.0.Final.jar:7.2.0.Final]
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102)
[jbossweb-7.2.0.Final.jar:7.2.0.Final]
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336)
[jbossweb-7.2.0.Final.jar:7.2.0.Final]
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
[jbossweb-7.2.0.Final.jar:7.2.0.Final]
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653)
[jbossweb-7.2.0.Final.jar:7.2.0.Final]
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920)
[jbossweb-7.2.0.Final.jar:7.2.0.Final]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_10]
--
View this message in context: http://drools.46999.n3.nabble.com/Exception-when-uploading-JAR-without-PO...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 5 months
Drools 6 Unable to build index of kmodule.xml
by captainrhino
I have a non maven project which I think I have included all the relevant
dependencies manually into
I run the following code
KieServices ks = KieServices.Factory.get();
KieContainer kContainer = ks.getKieClasspathContainer();
KieBase kieBase = kContainer.getKieBase();
StatelessKieSession session = kContainer.newStatelessKieSession();
session.execute("test");
and get the following error message. Is there anything obvious anyone can
suggest? kmodule.xml is in a META_INF folder on the classpath.
SLF4J: Actual binding is of type [org.slf4j.impl.JDK14LoggerFactory]
15-Nov-2013 16:12:41
org.drools.compiler.kie.builder.impl.ClasspathKieProject discoverKieModules
INFO: Found kmodule:
file:/C:/eclipse%20workspace/Sales/build/classes/META-INF/kmodule.xml
15-Nov-2013 16:12:41
org.drools.compiler.kie.builder.impl.ClasspathKieProject getPomProperties
WARNING: Unable to load pom.properties tried recursing down from/eclipse
workspace/Sales/build/classes
null
15-Nov-2013 16:12:41
org.drools.compiler.kie.builder.impl.ClasspathKieProject discoverKieModules
SEVERE: Unable to build index of kmodule.xml
url=file:/C:/eclipse%20workspace/Sales/build/classes/META-INF/kmodule.xml
null
Exception in thread "main" java.lang.RuntimeException: Cannot find a default
KieBase
at
org.drools.compiler.kie.builder.impl.KieContainerImpl.getKieBase(KieContainerImpl.java:160)
at com.axa.travel.drools.DroolsSalesTest.go(DroolsSalesTest.java:82)
at com.axa.travel.drools.DroolsSalesTest.main(DroolsSalesTest.java:26)l
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-6-Unable-to-build-index-of-kmodu...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 5 months
Drools Problems
by Kumarshorav
Hi All,
I have deployed the rest service in Tomcat 7. When I am hitting the resource through browser; resulting is coming. But when I am sending continuous hit for the resource through CTRL+F5 or through Apache J Meter; it is throwing Exception:
Some errors exists in packageBuilder
[DialectError message='Unable to wire compiled classes, probably related to compilation failures:null']
Or some times -
Some errors exists in packageBuilder
[DialectError message='Unable to wire compiled classes, probably related to compilation failures:JavaDialect ']
But when I added "core-3.4.2.v_883_R34x.jar" in the class path; first error message come up frequently.
I am using DroolsInitializer java class where different way of executing rules method is written. I am also using some of your method; where in both cases same exception is coming up.
Please look on this.
Love
Kumar Shorav
12 years, 5 months
SolutionInitializer for Nullable Planning Variable
by newbie
I created a custom solver which assign planning variables to planning
entities. I have a simple rule checking if there are no assign variable
that adds negative soft constraint. But when I assigned my planning variable
it increases the negative score instead of reducing it. I have for example
12 entities and my starting score was
0/-12.But when I initialized it with 4 variables it increases to 0/-16.
rule "null variable"
when
$myEntity : Entity( variable == null )
then
scoreHolder.addSoftConstraintMatch(kcontext, 0, -1);
end
--
View this message in context: http://drools.46999.n3.nabble.com/SolutionInitializer-for-Nullable-Planni...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 5 months
Inquiring about Online Drools Training quality ...
by profversaggi
I'm curious about the experiences anyone has had investing in the online
training offerings for Drools. I've seen a lot of offerings coming from many
different directions, with equally disparate price tags, and originating
from different places on the globe. This immediately brings up a question of
quality.
I'm one who would rather forage my way through the 3 recommended books, and
the online docs, free tutorials, etc to get a solid foundation before
embarking on anything more, but I do appreciate opportunities to shorten up
the learning curve if it's good quality stuff.
I'm soliciting opinions please, your thoughts?
--
View this message in context: http://drools.46999.n3.nabble.com/Inquiring-about-Online-Drools-Training-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 5 months
Compiling drools-examples
by baloodevil
Newbie question. I've imported drools-examples project into Eclipse (Kepler)
(which has GEF installed). I resolved build path errors by creating folders
src/test/java and src/test/resources. I resolved another issue by adding an
External JAR of org.eclipse.jdt.core_3.10.0.v20131029-1755.jar to the
project. (Those two changes allow me to create a new Drools Hello World
project and execute, however no such luck with complete examples) There are
hundreds of Drools Errors and hundreds of Java Problems, which I assume can
only be because of setup issues. The first Drools error is
"ArrayList is a raw type. References to generic type ArrayList<E> should be
parameterized AdventureFrame.java
/drools-examples/src/main/java/org/drools/games/adventures". That file
shows an import problem with
"import net.miginfocom.layout.ConstraintParser;" and "import
net.miginfocom.swing.MigLayout;". Those are referenced in the pom.xml file
in...
<dependency>
<groupId>com.miglayout</groupId>
<artifactId>miglayout</artifactId>
<version>3.7.4</version>
</dependency>
I don't know where to go next. Complete Drools newbie, and also fumbling
around with Eclipse.
--
View this message in context: http://drools.46999.n3.nabble.com/Compiling-drools-examples-tp4026895.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 5 months
Optaplanner: Unexpected global [scoreHolder]
by jonathan.labin
I am using Optaplanner 6.0.0-Beta2 and I am in some cases receiving the
following error during initial solution construction:
Exception in thread "main" java.lang.RuntimeException: Unexpected global
[scoreHolder]
at
org.drools.core.common.AbstractWorkingMemory.setGlobal(AbstractWorkingMemory.java:515)
at
org.drools.core.impl.StatefulKnowledgeSessionImpl.setGlobal(StatefulKnowledgeSessionImpl.java:360)
at
org.optaplanner.core.impl.score.director.drools.DroolsScoreDirector.resetKieSession(DroolsScoreDirector.java:83)
at
org.optaplanner.core.impl.score.director.drools.DroolsScoreDirector.setWorkingSolution(DroolsScoreDirector.java:74)
at
org.optaplanner.core.impl.solver.scope.DefaultSolverScope.setWorkingSolutionFromBestSolution(DefaultSolverScope.java:176)
at
org.optaplanner.core.impl.solver.DefaultSolver.solvingStarted(DefaultSolver.java:176)
at
org.optaplanner.core.impl.solver.DefaultSolver.solve(DefaultSolver.java:154)
I noticed this error in gist:
https://gist.github.com/ge0ffrey/5236604
If this is the same error, what are the current constraints that I need
adhere to in order to avoid this error?
Jon
--
View this message in context: http://drools.46999.n3.nabble.com/Optaplanner-Unexpected-global-scoreHold...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 5 months
using Drools in Tomcat 6.0 enviourment
by Erez Zarini
Hi,
I am new to Drools.
I have successfully created a project from the Examples provided at the site
using Java APP project.
but when trying to move it as a Dynamic Web Project in Eclipse I get the
following Exception:
(the files kmodule and pom.xml resides in all subfolders of the project)
21/11/2013 15:49:42 org.drools.compiler.kie.builder.impl.ClasspathKieProject
discoverKieModules
INFO: Found kmodule:
file:/C:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/DecisionTableGvia/WEB-INF/classes/META-INF/kmodule.xml
21/11/2013 15:49:43 org.drools.compiler.kie.builder.impl.ClasspathKieProject
getPomProperties
WARNING: Unable to load pom.properties tried recursing down
from/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/DecisionTableGvia/WEB-INF/classes
null
21/11/2013 15:49:43 org.drools.compiler.kie.builder.impl.ClasspathKieProject
discoverKieModules
SEVERE: Unable to build index of kmodule.xml
url=file:/C:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/DecisionTableGvia/WEB-INF/classes/META-INF/kmodule.xml
null
[]
21/11/2013 15:49:43 org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet getDecisionGvia threw exception
java.lang.NullPointerException
at
org.drools.compiler.kie.builder.impl.KieContainerImpl.newStatelessKieSession(KieContainerImpl.java:360)
at
org.drools.compiler.kie.builder.impl.KieContainerImpl.newStatelessKieSession(KieContainerImpl.java:351)
at
gvia.PricingRuleDTExample.executeExample(PricingRuleDTExample.java:39)
at gvia.PricingRuleDTExample.main(PricingRuleDTExample.java:32)
at gvia.getDecisionGvia.doGet(getDecisionGvia.java:33)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Unknown Source)
when running as a Java project (not Java EE) it seems to work find and
continues to find pom.xml instead of pom.properties.
any ideas?
--
View this message in context: http://drools.46999.n3.nabble.com/using-Drools-in-Tomcat-6-0-enviourment-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 5 months