Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 902151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:40:14+00:00 2026-05-15T15:40:14+00:00

I am using Eclipse with the Drools plugin to create rules. I want to

  • 0

I am using Eclipse with the Drools plugin to create rules.
I want to create business rules and main aim is to try and provide the user a set of options which he can use to create rules.
For eg:If an Apple can have only 3 colors: I want to provide an option like a drop down so that the user can know before hand which are the options he can use in his rules.
Is it possible?
I am creating a dsl but unable to still provide the above functionality for a business rule.
I am having an error implementing a basic dsl also.
The code to add the dsl is as follows in my RuleRunner class()

InputStream ruleSource = RuleRunner.class.getClassLoader().getResourceAsStream(“/Rule1.dslr”);

InputStream dslSource = RuleRunner.class.getClassLoader().getResourceAsStream(“/sample-dsl.dsl”);

//Load the rules , using DSL

addRulesToThisPackage.addPackageFromDrl(
new InputStreamReader(ruleSource),new InputStreamReader(dslSource));

I have both the sample-dsl .dsl and Rule1.dslr in my working directory.

Error encountered at adding the dsl to the package (last line)

Error stack:

Exception in thread “main” java.lang.NullPointerException

  at java.io.Reader.<init>(Unknown Source)

  at java.io.InputStreamReader.<init>(Unknown Source)

  at com.org.RuleRunner.loadRuleFile(RuleRunner.java:96)

  at com.org.RuleRunner.loadRules(RuleRunner.java:48)

  at com.org.RuleRunner.runStatelessRules(RuleRunner.java:109)

  at com.org.RulesTest.main(RulesTest.java:41)

my dsl file has basic mapping as per the online documentations.

The dsl rule I created is:

expander sample-dsl.dsl

rule “A status changes B status”

  when

        There is an A

           -        has an address

         There is a B

             - has name

  then

        - print updated A and Aaddress

End

I have created DSL in eclipse.

Is the code I added for it to be loaded to my package correct?? Or am I missing something????

It seems like my program is unable to find the dsl?

Please help. Can you point me towards the right direction to create a user friendly business rule ??

Thanks.

J

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T15:40:14+00:00Added an answer on May 15, 2026 at 3:40 pm

    I am not quite familiar with the method you are trying to use to create a knowledge session, but I will show a example of what’s used in my applications.

    KnowledgeBase kBase = KnowledgeBaseFactory.newKnowledgeBase(<KnowledgeBaseConfiguration>);
    KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
    kbuilder.add( ResourceFactory.newClassPathResource( "rules/myRuleFile.drl", getClass() ),
                  ResourceType.DRL );
    kbuilder.add( ResourceFactory.newClassPathResource( "rules/myDslFile.dsl", getClass() ),
                  ResourceType.DSL );
    if ( kbuilder.hasErrors() ) {
        System.err.println( builder.getErrors().toString() );
    
    }
    kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
    

    Now as far as giving your users the ability to author rule files, with built in constraints, have you looked at Drools Guvnor?(http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-guvnor/html_single/index.html) I have not incorporated it into my project yet, but have researched it a bit. I think it may provide the functionality your seeking for allowing your users to create and edit rule files. Good luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using eclipse 3.5, when I create a new maven project, m2eclipse automatically adds J2SE1.4
Using Eclipse 3.5 and the plugin for mtj. Where can I find the Javadoc
I am using Eclipse Helios (3.6). I want to use Mercurial for version management
Using Eclipse Version: Helios Service Release 2 Build id: 20110218-0911 with Android plugin. I
Using Eclipse 3.6.1 Java 1.6.0_26 JMockit 0.999.10 UPDATE: I was able to create a
I am using Eclipse Indigo. When I try to contact http://download.jboss.org/jbosstools/updates/development/indigo/ Installing updates result
Im using Eclipse with ADT plugin and Sequoia, and Im trying to deploy my
I'm using eclipse to develo[p an Android app. the app sends the user name
I am using Eclipse (for RCP) to create a XML file, I notice that
I'm using Eclipse to automatically create a WebLogic web service (not client) from a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.