This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JBoss/WildFly and the fly likes What is JBoss Drools? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "What is JBoss Drools?" Watch "What is JBoss Drools?" New topic

What is JBoss Drools?

paresh doshi
Ranch Hand

Joined: Nov 20, 2006
Posts: 81

I have got a project on jboss Drools. Can anyone provide some details or some sample examples how it works. I am totally new to this.

Thanks in advance.

Thanks.<br />Paresh Doshi<br />SCJP 1.4
Jaikiran Pai

Joined: Jul 20, 2005
Posts: 10067

Drools (also known as JBoss Rules) is an open source Rules Engine. You can find more information including documentation here

[My Blog] [JavaRanch Journal]
paresh doshi
Ranch Hand

Joined: Nov 20, 2006
Posts: 81
Hi I made the sample code with the sample drl file. Test.xml as belows

<?xml version="1.0"?>
<rule-set name="Bottles song"
xs:schemaLocation=" rules.xsd java.xsd">

<rule name="FlagAsUndervalued">
<parameter identifier="person">


I have written the following code to fire the jboss rules.

package com.sample;
import org.drools.RuleBase;
import org.drools.RuleBaseFactory;
import org.drools.WorkingMemory;
import org.drools.compiler.PackageBuilder;
import org.xml.sax.*;
public class TestDrules {
private static RuleBase rules;
public static URL ruleSource = TestDrules.class.getResource("Test.xml");
public static void main(String[] args) throws Exception{

PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl(new InputStreamReader(TestDrules.class.getResourceAsStream("Test.xml")));
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
WorkingMemory workingMemory = ruleBase.newStatefulSession();
Person p = new Person();



When i run the code I get the following error.

org.drools.compiler.PackageBuilder$MissingPackageNameException: Missing package name for rule package.
at org.drools.compiler.PackageBuilder.validatePackageName(
at org.drools.compiler.PackageBuilder.addPackage(
at org.drools.compiler.PackageBuilder.addPackageFromDrl(
at com.sample.TestDrules.main(

Can anyone please help me out.
Thanks in advance.
I agree. Here's the link:
subject: What is JBoss Drools?