Drools examples don't run
by 赵侃侃
Hello,
I checked out the latest source from svn repository. It compiled OK and
imported the example projects to my eclipse workspace but the examples run
with error.
The two example projects are namely drools-examples-drl
& drools-examples-fusion.
org.drools.examples.pacman.Main gives the errors:
Exception in thread "main" java.lang.NoClassDefFoundError:
com/thoughtworks/xstream/XStream
at
org.drools.audit.KnowledgeRuntimeLoggerProviderImpl.newThreadedFileLogger(KnowledgeRuntimeLoggerProviderImpl.java:34)
at
org.drools.logger.KnowledgeRuntimeLoggerFactory.newThreadedFileLogger(KnowledgeRuntimeLoggerFactory.java:69)
at org.drools.examples.pacman.Main.initKsession(Main.java:88)
at org.drools.examples.pacman.Main.main(Main.java:39)
Caused by: java.lang.ClassNotFoundException:
com.thoughtworks.xstream.XStream
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 4 more
org.drools.examples.broker.Main gives the errors:
java.lang.NullPointerException
at
org.drools.compiler.PackageBuilder.addProcessFromXml(PackageBuilder.java:432)
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:468)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
at org.drools.examples.broker.Broker.loadRuleBase(Broker.java:95)
at org.drools.examples.broker.Broker.createSession(Broker.java:80)
at org.drools.examples.broker.Broker.<init>(Broker.java:57)
at org.drools.examples.broker.Main.main(Main.java:53)
Does anyone experience the similar issues and know how to fix that?
Best Regards,
Kevin
14 years, 2 months
Using Declared types in Decision Tables
by Uday Kodukula
Hello,
I have a question on how one can import declared types into a decision
table, that are declared in a separate DRL file.
Take for instance the following declared type which is defined in an
isolated DRL file:
declare Offer
id: String
name: String
isValid: boolean
end
This type can be used in Java code if we were to use the Knowledge base to
give us a FactType via code like:
FactType offerType = kbase.getFactType("package.to.model.offer", "Offer");
and then use them accordingly. However, i'm not sure if such an approach /
api exists for importing declared types from DRLs into decision tables.
How can something like this be done in Decision tables?
When I import the declared Offer, which isn't complied yet, the decision
table complains.
Thanks,
Uday
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Using-Declared-types-...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 2 months
Post XML requests to Drools Server 5.1
by Jeffrey Miller
I am attempting to setup the latest version of Drools Server. The sample on
the website uses a jsp to forward an xml request to the same server the jsp
is running on (using a camel-client.xml.) I am unclear what the
camel-client.xml is actually responsible for doing.
Is this camel-client.xml configuration necessary if you want to send fully
formed requests in xml to the server? I have tried to set this up, but, for
example, by doing something like this:
curl --data "<batch-execution lookup="ksession1"> <insert
out-identifier="message"><org.test.Message><text>msg</text></org.test.Message></insert></batch-execution>"
http://localhost:8080/drools-server/kservice/kservice/rest
but the tomcat log just shows this:
Oct 21, 2010 4:10:55 PM org.apache.cxf.jaxrs.utils.JAXRSUtils
findTargetMethod
WARNING: .No operation matching request path / is found, HTTP Method : POST,
ContentType : application/x-www-form-urlencoded, Accept : */*,.
Oct 21, 2010 4:10:55 PM
org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper toResponse
WARNING: WebApplicationException has been caught : no cause is available
Does anyone know how to set this up properly?
Thanks,
Jeff
14 years, 2 months
Adding a programmatically created RuleFlowProcess to a KnowledgeBuilder
by Jason van Zyl
Hi,
I have been following the documentation to create a RuleFlowProcess, and I went the route of creating the flow programmatically, but I can't find an example of adding this process to the knowledge builder. It seems to want an external resource of a given type. In my little code scenario below how would I add this programmatically created RuleFlowProcess?
DefaultFlowGenerator flowGenerator = new DefaultFlowGenerator();
RuleFlowProcess flow = flowGenerator.generateFlow( "flow" );
KnowledgeBuilder knowledgeBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
knowledgeBuilder.add( flow.getResource() /* this is null */, null /* what do i put here*/ );
Do I have to serialize to an external form and deserialize?
Thanks,
Jason
----------------------------------------------------------
Jason van Zyl
Founder, Apache Maven
http://twitter.com/jvanzyl
---------------------------------------------------------
Three people can keep a secret provided two of them are dead.
-- Unknown
Thanks,
Jason
----------------------------------------------------------
Jason van Zyl
Founder, Apache Maven
http://twitter.com/jvanzyl
---------------------------------------------------------
A language that doesn’t affect the way you think about programming is not worth knowing.
-— Alan Perlis
14 years, 2 months
Drools Sample Project Won't Execute on Spring STS IDE 2.3.2
by Jason Mihalick
Versions involved:
IDE: Spring STS 2.3.2.RELEASE
Eclipse Drools Plugin: 5.1.1 (Includes JBoss Drools Core, JBoss Drools
Guvnor, JBoss Drools Task)
Java: JDK 1.6.0_11
Platform: Windows XP
1) Create a sample Drools application using the New Project Wizard and
selecting "Drools Project"
2) Name it MyDroolsProject
3) Check all options on the add sample classes (e.g., 'Add a sample
HelloWorld rule file to this project', etc.)
4) Check to 'Use default Drools Runtime (currently Drools 5.1.0 runtime)'.
Also choose to Generate code compatible with 'Drools 5.1.x'. Click Finish.
5) In your newly created 'MyDroolsProject', drill down to
com.sample.DecisionTableTest.java, right click and choose to 'Run As | Java
Application'
The following stack trace ensues. (Note, yes, I do have the STS Groovy
plugin installed)
Warning: Cell at E21 not present - adding a blank
Build groovy files option has not been set one way or the other: use
'options.put(CompilerOptions.OPTIONG_BuildGroovyFiles,
CompilerOptions.ENABLED);'
java.lang.NoClassDefFoundError: org/eclipse/core/runtime/Plugin
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at
org.eclipse.jdt.internal.compiler.Compiler.initializeParser(Compiler.java:755)
at
org.eclipse.jdt.internal.compiler.Compiler.<init>(Compiler.java:312)
at
org.eclipse.jdt.internal.compiler.Compiler.<init>(Compiler.java:177)
at
org.drools.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJavaCompiler.java:349)
at
org.drools.commons.jci.compilers.AbstractJavaCompiler.compile(AbstractJavaCompiler.java:51)
at
org.drools.rule.builder.dialect.java.JavaDialect.compileAll(JavaDialect.java:389)
at
org.drools.compiler.DialectCompiletimeRegistry.compileAll(DialectCompiletimeRegistry.java:56)
at
org.drools.compiler.PackageRegistry.compileAll(PackageRegistry.java:74)
at
org.drools.compiler.PackageBuilder.compileAll(PackageBuilder.java:677)
at
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:640)
at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:254)
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:484)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:34)
at
com.sample.DecisionTableTest.readKnowledgeBase(DecisionTableTest.java:44)
at com.sample.DecisionTableTest.main(DecisionTableTest.java:25)
Caused by: java.lang.ClassNotFoundException: org.eclipse.core.runtime.Plugin
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
... 27 more
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Sample-Project...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 2 months
Adding a programmatically created RuleFlowProcess to a KnowledgeBuilder
by Jason van Zyl
Hi,
I have been following the documentation to create a RuleFlowProcess, and I went the route of creating the flow programmatically, but I can't find an example of adding this process to the knowledge builder. It seems to want an external resource of a given type. In my little code scenario below how would I add this programmatically created RuleFlowProcess?
DefaultFlowGenerator flowGenerator = new DefaultFlowGenerator();
RuleFlowProcess flow = flowGenerator.generateFlow( "flow" );
KnowledgeBuilder knowledgeBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
knowledgeBuilder.add( flow.getResource() /* this is null */, null /* what do i put here*/ );
Do I have to serialize to an external form and deserialize?
Thanks,
Jason
----------------------------------------------------------
Jason van Zyl
Founder, Apache Maven
http://twitter.com/jvanzyl
---------------------------------------------------------
Three people can keep a secret provided two of them are dead.
-- Unknown
Thanks,
Jason
----------------------------------------------------------
Jason van Zyl
Founder, Apache Maven
http://twitter.com/jvanzyl
---------------------------------------------------------
We know what we are, but know not what we may be.
-- Shakespeare
14 years, 2 months
xdrl, matches and nested method calls
by Veit Guna
Hi.
We're using Drools 5.1.0 with .xdrl files. Now we encountered a strange
problem with the 'matches' behavior.
We have the following pattern that seems to have the problem:
<dro:pattern object-type="EMail">
<dro:field-constraint field-name="subject">
<dro:literal-restriction evaluator="matches" value=".*\QCRYPT\E.*"/>
</dro:field-constraint>
</dro:pattern>
Subject is a String with the content "my CRYPT subject".
The rule isn't fired as expected. If we ONLY change
field-name="subject"
to
field-name="subject.trim"
the rule fires.
Any pointers what that is?
Thanks
Veit
14 years, 2 months
DSL to multiline DRL?
by Tim 4076
Is it possible to have a single line of DSL convert into multiple lines of DRL?
I want to hide the implementation of my rules from the user. So, using
my previous post as an example:
rule "group 1"
when
$a : Trans( $groupValue : prodCat, $date : date )
not Trans( this != $a, prodCat == $groupValue, date < $date )
$b : LinkedList( size >= 1 ) from collect ( Trans( this != $a,
prodCat == $groupValue, date > $date ) )
then
//do something
end
should become something like:
rule "group 1"
when
There are mutliple transactions with the same value for prodCat
then
//do something
end
Thanks,
Tim
14 years, 2 months
access guvnor information from extern
by Dominik Hüttner
Hi everyone, I work with the guvnor and want to use documentation
information externally. For example the description of a rule or the
description of a package, what is also posted in the documentation.pdf, that
is accessible through the url (f.e.:
http://192.168.1.192:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/Tes
t/LATEST/documention.pdf), on the buttom of the package overview page is the
link. But I want to work with the data, so the pdf is not usable, is there a
way to access these information in the guvnor directly from outside for
example from a reporting-tool?
Kind regards,
Dominik
14 years, 2 months