FIXED: Mavenizing a new drools project
by eyal edri
OK,
I found 2 missing jars from the maven dependencies that appeared in the
drools project,
and apparantly are mandatory:
jxl.jar
xstream.jar
both were available via the maven2 repo.
Eyal.
On Mon, May 10, 2010 at 2:21 PM, eyal edri <eyal.edri(a)gmail.com> wrote:
> I'm still having problem unfortunately.. :(
>
> i get a strange error that i didn't got before turning to maven:
>
> when running:
>
> *kbuilder.add(ResourceFactory.newClassPathResource("src/main/rules/sample.drl"),
> ResourceType.DRL);*
>
> this errors occurs:
> java.lang.RuntimeException: java.io.FileNotFoundException:
> 'src/main/rules/sample.drl' cannot be opened because it does not exist
> at
> org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:559)
> at
> org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)
> at com.commtouch.drools.DroolsTest.readKnowledgeBase(DroolsTest.java:42)
> at com.commtouch.drools.DroolsTest.main(DroolsTest.java:25)
> Caused by: java.io.FileNotFoundException: 'src/main/rules/sample.drl'
> cannot be opened because it does not exist
> at
> org.drools.io.impl.ClassPathResource.getInputStream(ClassPathResource.java:104)
> at
> org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:287)
> at
> org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:488)
> ... 3 more
>
> i see a difference between the .classpth and .project files in both
> projects (Drools project vs Maven Project).
> could this be the reason?
>
> Eyal.
>
> On Mon, May 10, 2010 at 12:20 PM, eyal edri <eyal.edri(a)gmail.com> wrote:
>
>> OK, the eclipse maven plugin added those deps type as 'pom' instead of
>> 'jar',
>> so the drools jars weren't included.
>>
>> fixed that.
>>
>> thanks.
>>
>>
>> On Mon, May 10, 2010 at 11:25 AM, eyal edri <eyal.edri(a)gmail.com> wrote:
>>
>>> OK, Still got problems.
>>>
>>> i've created a maven project, and all looks good in compile time (with
>>> all the org.drools dep below).
>>>
>>> but i think i still missing a 'runtime' dependency, cause when i try to
>>> run the Hello World example, i get this error:
>>>
>>> [the src line is this:
>>> KnowledgeBuilder kbuilder =
>>> KnowledgeBuilderFactory.newKnowledgeBuilder();]
>>>
>>> org.drools.ProviderInitializationException: Provider
>>> org.drools.builder.impl.KnowledgeBuilderProviderImpl could not be set.
>>> at
>>> org.drools.builder.KnowledgeBuilderFactory.loadProvider(KnowledgeBuilderFactory.java:111)
>>> at
>>> org.drools.builder.KnowledgeBuilderFactory.getKnowledgeBuilderProvider(KnowledgeBuilderFactory.java:101)
>>> at
>>> org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuilder(KnowledgeBuilderFactory.java:29)
>>> at
>>> com.commtouch.drools.DroolsTest.readKnowledgeBase(DroolsTest.java:38)
>>> at com.commtouch.drools.DroolsTest.main(DroolsTest.java:24)
>>> Caused by: java.lang.ClassNotFoundException:
>>> org.drools.builder.impl.KnowledgeBuilderProviderImpl
>>> at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>>> at java.security.AccessController.doPrivileged(Native Method)
>>> at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
>>> at java.lang.Class.forName0(Native Method)
>>> at java.lang.Class.forName(Class.java:169)
>>> at
>>> org.drools.builder.KnowledgeBuilderFactory.loadProvider(KnowledgeBuilderFactory.java:108)
>>> am i missing org.drools.builder? (i didn't see it in the maven repo..)
>>>
>>> On Sun, May 9, 2010 at 3:35 PM, Salaboy <salaboy(a)gmail.com> wrote:
>>>
>>>> I always prefer to create the maven projects from the scratch. You
>>>> only need to add the following deps (groupid and artifactid)
>>>>
>>>> org.drools
>>>> drools-api
>>>>
>>>> org.drools
>>>> drools-core
>>>>
>>>> org.drools
>>>> drools-compiler
>>>>
>>>> You probably need to add the jboss repository as well in order to get
>>>> this deps
>>>>
>>>> Repository.jboss.org/maven2
>>>>
>>>>
>>>> - Ing. Mauricio Salatino -
>>>>
>>>> On May 9, 2010, at 5:01, eyal edri <eyal.edri(a)gmail.com> wrote:
>>>>
>>>> > Hi,
>>>> >
>>>> > I've created the HelloWorld drools sample project and i want to turn
>>>> > it into a maven project.
>>>> >
>>>> > i know i can create and empty maven project and copy all sources
>>>> > from the drools project to it,
>>>> > but how do i handle the dependant jars (drools runtime?)
>>>> >
>>>> > is there a guide of how to mavenize your drools projects?
>>>> >
>>>> > --
>>>> > Eyal Edri
>>>> > _______________________________________________
>>>> > 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
>>>>
>>>
>>>
>>>
>>> --
>>> Eyal Edri
>>>
>>
>>
>>
>> --
>> Eyal Edri
>>
>
>
>
> --
> Eyal Edri
>
--
Eyal Edri
14 years, 6 months
Insert Fact Speed bottleneck
by djb
Hi Drools team,
I wrote a Drools application for my company, which evaluates clinical claim
processing rules. That is, it checks current medical claims against the
patient's historical claims.
It appears that 95% of the run time is dedicated to inserting facts, which
is presumably when it propagates through the RETE graph, since firing the
rules takes no time.
But it seems like it's not fast enough. I made a rule template, which by
trial and error of moving the conditions around, is optimised. I'm
averaging 310ms, and need it to be under 170ms for it to be viable.
Is there any not-too-technical guide to optimisation somewhere? (alpha and
beta-nodes scare me a bit).
Regards,
Daniel
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Insert-Fact-Speed-bot...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 6 months
Drools Server Problem java.lang.String cannot be cast to [B
by Seltir
Hello All.
I have a problem using Drools Server with example domain.
During sending Rest Request to Drools Server I have an exception:
15:45:56,578 ERROR [STDERR] 2010-05-05 15:45:56
org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
INFO: Application
{http://service.server.drools.org/}knowledgeService#{http://service.server.drools.org/}execute
has thrown exception, unwinding now: org.drools.CheckedDroolsException:
java.lang.String cannot be cast to [B
Could anybody tell me what could couse this ? Somebody had this problem?
Im running Drools Server on Jboss 5.0.0 with test drools server domain added
to the libs.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Server-Problem...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 6 months
creating custom flow components for the eclipse gui
by Geir Gullestad Pettersen
Hi,
I'm considering Drools Flow for our application which currently runs a
proprietary flow engine. This flow engine wires the nodes/tasks in the flow
using spring xml which essentially lets our customers build custom flows
which executes pojos which implement a predefined interface. It does however
lack any GUI for editing the flow, and that is my reason for considering
Drools Flow.
I have skimmed through the documentation and found many examples on how to
buld flows using the Drools components, yet I am wondering how to create
custom gui flow components for our java pojos - is that possible? Any
documentations/examples I can look at?
Thanks.
Geir Pettersen
14 years, 6 months
Drools Classloader Leak?
by malkhafaji
Hello,
I noticed (using JConsole) that my application keeps loading more and more
classes. I have over 105K classes loaded! I did a lot of debugging and
isolation until I found the line that brings the number of classes loaded
from 20K to 105K. It is this line:
this.knowledgeBase.addKnowledgePackages(packages);
packages is an array list of 8 DRLs that are compiled successfully. I am
calling the line above exactly 99 times. However, I do have 99 instances of
this.knowledgeBase. So, I have a total of 99 instances of "knowledgeBase",
and each instance is called once (line above) with 8 successfully compiled
DRLs.
I am starting to think that each instance of a KnowledgeBase somehow uses
its own Classloader? Do I need to manually get the current application
Classloader and pass it on to each instance of KnowledgeBase to ensure that
no classes are loaded more than once? Is this a leak in the Classloader that
comes inside the KnowledgeBase.addKnowledgePackage method? I did post
somewhere else about delays on the line above, and no wonder it sometimes
takes a couple of seconds to execute that line (the largest rules file I
have is 150 KB with no more than 100 rules) if it creates a new Classloader
and loads the same loaded classes AGAIN. Any insights on this?
P.S. I did a search on the forum and couldn't find anything related to this.
If you have better searching skills and found a post in that regards, please
kindly point me to it. This is a very important issue as we are going to a
live production environment in 3 weeks and I am not too happy with the
performance, specifically around the line above.
Thank you, and have a great weekend.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Classloader-Le...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 6 months
compilation problem
by Puneet duggal
Friends i am getting this error when i am preparing the package in the
business rules.
Error 500:
org/eclipse/jdt/internal/compiler/CompilationResult.getProblems()[Lorg/eclipse/jdt/core/compiler/CategorizedProblem;
why i am getting this error ?
14 years, 6 months
facts hierarchy
by Giovanni Motta
Hi all, i have a question concerning facts hierarchy, i'm looking for some
hint as i suppose the same problem could have been faced by someone on the
list.
I try to eplain with an example:
- Suppose to have a tree of facts, each object representing an UI widget.
<root>
<A id="1">
<B />
</A>
<A id="2">
<B />
</A>
</root>
- The individual elements A(1), B, A(2), B are mapped to facts, that are
inserted in a KnowledgeStatefulSession
- A rule exists that states that when an object A is selected, the B object
is automatically selected
- An event occurs that causes selection of node A(1)
The expected result is, obviously, that only the B element that is
descendant of A(1) must be automatically selected
I'm trying a way to express the 'descendant' relationship in LHS construct.
The rule will look like:
rule "A requires B"
when
$fact1: NodeFact(id == "A", selected == true)
$fact2: NodeFact(id == "B", selected == false, this DESCENDANT-OF $fact1)
then
$fact2.setSelected(true);
end
What is, in your opinion, the best way to handle this situation? What should
replace the fake "DESCENDANT-OF" match?
Do i need to use a function that returns the list of descendant nodes of
$fact1 and then match $fact2 against that?
Will this be fast when dealing with large trees?
Any suggestion will be appreciated, thank you.
Giovanni
14 years, 6 months
Does not execute => builder.addPackageFromDrl(new InputStreamReader(this.getClass().getResourceAsStream(ruleFile)))
by mikexr
I am trying to execute a proof of concept. I have some code that runs a
rule. It works in Eclipse, but for some reason doesnt in Netbeans. I want
to get it working within a POJO Service Engine in Glassfish ESB and have is
execute as part of a BPEL orchestration. It does not throw an exception,
but it steps over that one piece of code
public void xmlImpl(String is) throws JAXBException,
FileNotFoundException, Exception {
try {
// unmarshal xml file
// JAXBElement<EnrollmentRequest> enrollment =
jaxbUnmarshalFromInputStream(is);
EnrollmentRequest enrollment = jaxbUnmarshalFromInputStream(is);
// setup rules engine
RuleRunner rule = new RuleRunner();
String[] rules = {"../rules/834rules.drl"};
// execute rules on xml file
try {
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
PackageBuilder builder = new PackageBuilder();
for (String ruleFile : rules) {
System.out.println("Loading file: " + ruleFile);
builder.addPackageFromDrl(new
InputStreamReader(this.getClass().getResourceAsStream(ruleFile)));
}
Package pkg = builder.getPackage();
ruleBase.addPackage(pkg);
WorkingMemory workingMemory = ruleBase.newStatefulSession();
Object fact = new Object();
fact.equals(enrollment);
System.out.println("Inserting fact: " + fact);
workingMemory.insert(fact);
System.out.println("Firing Rules");
workingMemory.fireAllRules();
} catch (Exception e) {
e.printStackTrace();
}
// marshall changes out to xml file
jaxbMarshalToOutputStream(enrollment, new
FileOutputStream("F:/data/workspaces/enrollmentPOC/data/xmlenrollment.xml"));
} catch (JAXBException je) {
je.printStackTrace();
} catch (IOException ioe) {
ioe.printStackTrace();
} finally {
try {
} catch (Exception ex) {
java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.SEVERE,
null, ex);
}
return;
}
}
If anyone has any suggestions I would appreciate them. At this point I'm
stuck
Thanks
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Does-not-execute-buil...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 6 months
Getting started with Drools Fusion
by Tina Vießmann
Hello everybody :)
I'm completely new to the Drools universe. I've discovered Drools, or more
specifically Drools Fusion, by looking for a powerful CEP engine.
I've read the DF user guide and came up with some issues about DF features.
It would be great, if anyone can give me some explanations and/or refer to
different information sources.
My questions:
1. Persistence of events:
I know that DF can store events explicitly and implicitly. But does it
store events in persistent (e.g., I can continue my computation after a
reboot)? If it does, how are the events stored?
2. Sliding windows:
It's written that a window contains the last X events/the event occurred
in the last X time units. Is it somehow possible to specify a window for
process only old events - which does not catch up to the latest event?
(Lets assume we have the times A, B and C with: A < B < C and C ==
current time. Is it possible to specify a window that process events
occurred between A and B?)
So are more complex windows like described in chapter 7 of the book 'Event
Processing in Action' (see http://www.manning.com/etzion/) possible?
Are there any (step-to-step) tutorials / how-tos about simple DF programs?
In case my questions are stupid because they can be answered when knowing
Drools, but I've got absolute now experience using Drools. At the moment I
kind of have the feeling, Drools is a little bit too complex for just
using to implement CEP applications...
Thanks for any help! :)
Tina
14 years, 6 months