wood burning stoves
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 Building Microservices this week in the Design 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: 10441

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="http://drools.org/rules rules.xsd
http://drools.org/semantics/java java.xsd">

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


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

package com.sample;
import java.net.URL;
import java.io.*;
import org.drools.RuleBase;
import org.drools.RuleBaseFactory;
import org.drools.WorkingMemory;
import org.drools.compiler.PackageBuilder;
import org.drools.io.RuleBaseLoader;
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(PackageBuilder.java:320)
at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:236)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:167)
at com.sample.TestDrules.main(TestDrules.java:27)

Can anyone please help me out.
Thanks in advance.
I agree. Here's the link: http://aspose.com/file-tools
subject: What is JBoss Drools?
It's not a secret anymore!