How do I prevent the package registry from being null in my package builder?
by retoy
I just installed Drools and wanted to build a simple RuleFlow.
But When I add any process containing constraints or rules to my
Knowledgebuilder, I'm always getting a NullPointerException, because the
"package registry" seems to be null.
.....
java.lang.NullPointerException
at org.drools.compiler.ProcessBuilder.buildProcess(ProcessBuilder.java:119)
at
org.drools.compiler.ProcessBuilder.addProcessFromFile(ProcessBuilder.java:223)
at
org.drools.compiler.PackageBuilder.addProcessFromXml(PackageBuilder.java:447)
at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:503)
at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)
.....
ProcessBuilder.java:118 PackageRegistry pkgRegistry =
this.packageBuilder.getPackageRegistry(process.getPackageName());
ProcessBuilder.java:119 org.drools.rule.Package p =
pkgRegistry.getPackage();
.....
The ruleflow is successfully validated though when i press that button in
eclipse... Can somebody give me a hint what's missing?
Thanks!
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/How-do-I-prevent-the-...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 10 months
Trying to get Eclipse Java code to call Guvnor
by John Peterson
I'm using the example code from the Red Hat Magazine -
http://magazine.redhat.com/2008/08/12/jboss-drools-how-to-tuning-guvnor-
part-1/ - to try to get the sample code to work, but I keep getting the
following error:
Exception in thread "main" java.lang.NullPointerException
at java.util.Properties$LineReader.readLine(Unknown Source)
at java.util.Properties.load0(Unknown Source)
at java.util.Properties.load(Unknown Source)
at
org.drools.agent.RuleAgent.loadFromProperties(RuleAgent.java:299)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:256)
at test.GuvnorTest.main(GuvnorTest.java:15)
It appears to be unable to find my 'Guvnor.properties' file, but I have
it in the classpath (I actually have it in several different places on
my C: drive as I tried to figure out why it couldn't find it). Does
anyone have any thoughts on what's wrong here?
I'd appreciate any guidance. It seems like this should be a simple
answer but I haven't been able to figure it out.
13 years, 10 months
About for and inheritance
by Chris Woodrow
Hi,
I recently find out a few issues using for, and I wanted to share it with
you. I made a simple exemple to illustrate my purpose.
My classes are (I did not represent accessors & constructors):
public class Cheese {
protected String name;
}
public class FrenchCheese extends Cheese{
private String smell;
}
public class Person {
private Cheese likes;
}
Here is my rule set :
package rules
rule "likes cheese"
when
$person : Person ()
Cheese( ) from $person.getLikes()
then
System.out.println("likes cheese");
end
rule "likes french cheese"
when
$person : Person ()
FrenchCheese( ) from $person.getLikes()
then
System.out.println("likes french cheese");
end
First test :
Cheese cheese = new FrenchCheese("good", "camembert");
Person person = new Person();
person.setLikes(cheese);
Output :
likes french cheese
likes cheese
Wich is expected...
Second test :
Cheese cheese = new Cheese();
Person person = new Person();
person.setLikes(cheese);
Output :
likes french cheese
likes cheese
That's the first strange thing. As far as I am concerned, rule "likes french
cheese" should not match (since a Cheese is not a FrenchCheese).
I made a change to the second rule :
rule "likes french cheese"
when
$person : Person ()
FrenchCheese( smell == "good" ) from $person.getLikes()
then
System.out.println("likes french cheese");
end
Third test :
Cheese cheese = new Cheese();
Person person = new Person();
person.setLikes(cheese);
output :
It throwed an exception : Exception in thread "main"
java.lang.ClassCastException: rules.Cheese
I am not saying the ClassCastException is not to expect in such a case but I
think I would simply expect it not to match (as far as a Cheese is not a
FrenchCheese).
Chris
13 years, 10 months
process-designer deserialization error
by AlfredoLatini
Hi,
i have a problem with oryx process-designer and drools guvnor. I have
created a process with process-designer and i saved it. Then i have opened
this file with eclipse and i uploaded this file in guvnor repository.
I have opened the process in drools guvnor and the following exception
occurred:
The server encountered an internal error () that prevented it from
fulfilling this request.</u></p><p>exception
<pre>javax.servlet.ServletException:
http://localhost:8080/designer/bpmn2_0deserialization
org.drools.guvnor.server.GuvnorAPIServlet.service(GuvnorAPIServlet.java:73)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.jboss.seam.web.ContextFilter$1.process(ContextFilter.java:42)
How can i fix this problem?
My jboss installation runs on port 8580 because 8080 is busy (oracleXE).
Thanks in advance
Alfredo.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/process-designer-dese...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 10 months
Integration of Drools with Hadoop
by Roger Smith
We are working on a project to integrate Drools with Apache Hadoop,
http://hadoop.apache.org/, and run into some road blocks. We would very much
appreciate any suggestions/help from this list.
We have an app where we call drools rule engine inside the reducer task of a
Hadoop map reduce job. It throws a NullPointerException when we the rule
package resource to the knowledge builder. The same code works fine when
run as part of a stand alone app.
Code:
private static Map<String, StatefulKnowledgeSession> sessions =
new HashMap<String, StatefulKnowledgeSession>();
private static final String RULE_PACK_DIR = "
file:///home/roger/Projects/gridx/ <file:///\\home\pranab\Projects\gridx\>";
private static final String RULE_PACK_EXT = ".drl";
public int process(String rulePackage, String dateTime, String type)
throws TException {
int rate = 0;
StatefulKnowledgeSession session = sessions.get(rulePackage);
if (null == session){
KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
String rulePackPath = RULE_PACK_DIR + rulePackage +
RULE_PACK_EXT;
kbuilder.add( ResourceFactory.newFileResource(rulePackPath ),
ResourceType.DRL);
if ( kbuilder.hasErrors() ) {
System.err.println( kbuilder.getErrors().toString() );
}
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
session = kbase.newStatefulKnowledgeSession();
sessions.put(rulePackage, session);
}
ContractRule contractRule = new ContractRule();
contractRule.prepare(dateTime, type);;
FactHandle ruleHandle = session.insert(contractRule);
session.fireAllRules();
System.out.println("" + contractRule);
rate = contractRule.getRate();
session.retract(ruleHandle);
return rate;
}
This line throws the exception:
kbuilder.add( ResourceFactory.newFileResource(rulePackPath ),
ResourceType.DRL);
It works fine as a stand alone app, outside hadoop
Roger Smith
13 years, 11 months
Re: [rules-users] Guvnor and oryx designer problems (melc)
by Mahler, Björn
>Can someone please tell me a version of the oryx designer that works
>correctly with guvnor version 5.1 or 5.2.0-snapshot?
>Did anyone else have problems when trying to view on guvnor oryx designer a
>bpmn diagram created in eclipse?? Any solution??
Hi there,
i've the same or similar problem. In guvnor I cannot access uploaded bpmn2 diagrams... if I upload a classic rule-flow diagram I'm able to see it in guvnor.. but the link to the oryx-editor with bpmn2 ones wouldn't work...
I also have no clue, whether to define rule-flow groups in the oryx-designer... any suggestions on that?
Ciao
Björn
Diese E-Mail kann vertrauliche und/oder rechtlich geschützte Informationen enthalten.
Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail.
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.
This e-mail may contain confidential and/or privileged information.
If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail.
Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
13 years, 11 months
Upload an existing .drl for the Guvnor dynamically
by Vandewilly
Is there any api available that allows me to load an existing file drl for
the Guvnor repository. In my case, I can not upload through the web
interface, only in a dynamic way through a java class.
--
Vandewilly Oliveira
13 years, 11 months
StatefulKnowledgeSession.startProcess not thread-safe ?
by OptimusPrime
Hello,
I wrote a micro benchmark in order to test the performance of Drools Flow
5.1.0 in single and multi-threaded environments.
And I noticed that, when 2 threads call startProcess() at the same time
(Intel Core 2 Duo CPU), the returned process instance IDs are the same.
I checked the code and it seems there is no locking mechanism in the
org.drools.process.instance.impl.DefaultProcessInstanceManager class for the
id creation.
Is this a bug or am I missing something ?
Thanks
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/StatefulKnowledgeSess...
Sent from the Drools - User mailing list archive at Nabble.com.
13 years, 11 months