Drools Error Unable To Resolve Object Type
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings drools rule compilation error cannot be resolved and policies of this site About Us Learn more about Stack Overflow rule compilation error cannot be resolved to a variable the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation drools cannot be resolved to a variable Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only a type can be imported. resolves to a package drools only takes a minute: Sign up cannot load drools rule, getting error: unable to resolve object type up vote 0 down vote favorite i'm new to drools, i'm trying to run the hello world but it keeps giving me this error Some errors exists in packageBuilder Unable to resolve ObjectType 'Messagee' : [Rule name='Hello World'] Exception in thread "main" java.lang.IllegalArgumentException:
Drools Syntax
Could not parse knowledge. at hellodrools.HelloWorldRuleTest.initialiseDrools(HelloWorldRuleTest.java:55) at hellodrools.HelloWorldRuleTest.main(HelloWorldRuleTest.java:26) Rule Compilation error : [Rule name='Hello World'] hellodrools/Message/Rule_Hello_World720710180.java (1:8) : The package hellodrools.Message collides with a type my drl file: package hellodrools.Message rule 'Hello World' when message:Message (type == 'Hello') then message.printMessage(); end Message.java package hellodrools; public class Message{ private String type; public String getType() { return type; } public void setType(String type) { this.type = type; } public void printMessage() { System.out.println("Type: " + type); } } HelloWorldTestRule.java package hellodrools; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; import java.util.logging.Level; import java.util.logging.Logger; import org.drools.core.RuleBase; import org.drools.core.RuleBaseFactory; import org.drools.core.StatefulSession; import org.drools.compiler.compiler.DroolsParserException; import org.drools.compiler.compiler.PackageBuilder; import org.drools.compiler.compiler.PackageBuilderErrors; import hellodrools.Message; public class HelloWorldRuleTest { private static RuleBase rbase = RuleBaseFactory.newRuleBase();; private static PackageBuilder pbuilder = new PackageBuilder(); private static StatefulSession sessionObject; private static String DRL_FILE = "/helloWorld.drl"; public static void main(String[] args) { initialiseDrools(); initiliseMessageObject(); runRules(); } // Method to initialise the package builder and add package to the rule // base. private static void initialiseDrools() { // 1. Read the DRL File and add to package builder try { Reader reader = new InputStreamRead
Container Development KitCloudOpenShift Enterprise by Red HatMobileRed Hat Mobile Application PlatformAccelerated Development and ManagementRed Hat JBoss Data GridRed Hat JBoss Developer StudioRed Hat JBoss Enterprise Application PlatformRed Hat JBoss Web ServerIntegration and
Drools Example
AutomationRed Hat JBoss A-MQRed Hat JBoss BRMSRed Hat JBoss BPM drools tutorial SuiteRed Hat JBoss Data VirtualizationRed Hat JBoss FuseCommunityDevelopers BlogInsights & news on Red Hat developer tools, platforms and moreEventsFind the latest conferences, meetups, and virtual seminarsOpen Source CommunitiesCommunity Projects that Red Hat participates inContent ContributorsShare your knowledge. Contribute content http://stackoverflow.com/questions/21131880/cannot-load-drools-rule-getting-error-unable-to-resolve-object-type to Red Hat Developers.HelpResourcesImportant technical resources for you in all shapes and sizes: blogs, books, code, videos and more.ForumsWe've extended our popular JBoss.org forums to cover our entire Red Hat portfolio for you.Stack Overflow Q&AYou already use Stack Overflow, so we'll help you use it to find your best answers.DownloadsHomeNewsContentPlacesPeopleSearchSearchCancelError: https://developer.jboss.org/thread/252115 You don't have JavaScript enabled. This tool uses JavaScript and much of it will not work correctly without it enabled. Please turn JavaScript back on and reload this page. Please enter a title. You can not post a blank message. Please type your message and try again. More discussions in Red Hat JBoss Fuse All PlacesProductsRed Hat JBoss Fuse Interested in participating? Red Hat Developer Product Discussions are open to the public and can be viewed by everyone, but you need to log in to post and participate. Login now! 2 Replies Latest reply on Feb 10, 2015 5:49 AM by Nitesh jain Not able to load Drools through knowledgeBase/ksession Nitesh jain Feb 5, 2015 12:26 AM does anyone know why sample drools project is working when run via main() Method ,and when invoked via camel processor, i'm getting the following error wile trying to create the kno
Reply | Threaded Open this post in threaded view ♦ ♦ | Report Content as Inappropriate ♦ ♦ Import of declared type in other drools resources Hi, I'm using eclipse drools builder to develop my rules, and when http://drools-moved.46999.n3.nabble.com/Import-of-declared-type-in-other-drools-resources-td2078644.html I define one drools declared type in one resource and use it in a different drools resource, the declared type is not resolved. Even if the resources are in the same package. Also, when I include the files in the correct order in the knowledgeBase, everything starts working in my application. 1)Is there a way to make my eclipse drools builder find the declared type in the other resources? It shows the following cannot be error: Unable to resolve ObjectType 2)Is there a way to make the files work in any order? Now, my application works only if the declared types are with resource name alphabetically preceeding the name of the resource where the types are used. Please tell me if you need additional information. Michael Neale Reply | Threaded Open this post in threaded view ♦ ♦ | Report Content as Inappropriate ♦ ♦ Re: Import of cannot be resolved declared type in other drools resources I think you should put them in a drools.package file in the same directory as the rule files - I think that is how it was designed to work. On Tue, Dec 14, 2010 at 12:45 AM, stanka <[hidden email]> wrote: Hi, I'm using eclipse drools builder to develop my rules, and when I define one drools declared type in one resource and use it in a different drools resource, the declared type is not resolved. Even if the resources are in the same package. Also, when I include the files in the correct order in the knowledgeBase, everything starts working in my application. 1)Is there a way to make my eclipse drools builder find the declared type in the other resources? It shows the following error: Unable to resolve ObjectType 2)Is there a way to make the files work in any order? Now, my application works only if the declared types are with resource name alphabetically preceeding the name of the resource where the types are used. Please tell me if you need additional information. -- View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Import-of-declared-type-in-other-drools-resources-tp2078644p2078644.html Sent from the Drools - Dev mailing list archive at Nabble.com. _______________________________________________ rules-dev mailing list [hidden email] https://lists.jboss.org/mailman/listinfo/rules-dev -- Michael D Nealehome: www.michaelneale.netblog: michaelneale.blogspot.com _______________________________________________ rules-dev mailing list [hidden email] https:/