[rules-users] Run Drool Application From Command Prompt

Sumant Kumar amulboy at yahoo.com
Tue Jul 28 08:40:57 EDT 2009


try  including ANTLR.jar in your classpath.



________________________________
From: "Pankaj.Jain at lntinfotech.com" <Pankaj.Jain at lntinfotech.com>
To: rules-users at lists.jboss.org
Sent: Tuesday, July 28, 2009 12:50:29 AM
Subject: Re: [rules-users] Run Drool Application From Command Prompt


Hi 

I still have not got any solution
of my problem that I posted previously. I have included all required jar
files and set proper class path .. Please do help ? 

problem:  

I am trying to integrate Drool with
ofbiz and run application from command prompt. In one way I have integrated
it properly and I am able to run it successfully.

Code : Which I was using initially

KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); 

or

PackageBuilderConfiguration cfg = new PackageBuilderConfiguration();
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); 

Exception I got :

org.drools.RuntimeDroolsException: Unable to load dialect 'org.drools.rule.builder.dialect.java.JavaDialectConfiguration:java 
:org.drools.rule.builder.dialect.java.JavaDialectConfiguration'
at org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:274)
at org.drools.compiler.PackageBuilderConfiguration.buildDialectConfigurationMap(PackageBuilderConfiguration.java:259) 

at org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:176)
at org.drools.compiler.PackageBuilderConfiguration.<init>(PackageBuilderConfiguration.java:153)
at org.drools.compiler.PackageBuilder.<init>(PackageBuilder.java:242) 
.
.
.
Caused by: java.lang.NullPointerException
at org.drools.rule.builder.dialect.java.JavaDialectConfiguration.setCompiler(JavaDialectConfiguration.java:92)
at org.drools.rule.builder.dialect.java.JavaDialectConfiguration.init(JavaDialectConfiguration.java:55)
at org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:270

Problem I found : 
In the class JavaDialectConfiguration in jar file drools-compiler.jar there
is a method named "setCompliler",  in this method Null Pointer
Exception was coming.

Solution I provided :
In my application I created my custom class CustomJavaDialectConfiguration
by extending to class JavaDialectConfiguration, In this class I overrided
the method setCompiler. My method was exactly same as that of method setCompiler
in JavaDialectConfiguration . To call my dialect class I also overrided
the method "addDialect" of PackageBuilderConfiguration class
. For that I created class CustomPackageBuilderConfiguration by extending
to PackageBuilderConfiguration. 
after that I wrote the code:

PackageBuilderConfiguration cfg = new CustomPackageBuilderConfiguration();
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(cfg);


Now application is running perfectly fine from both eclipse and command
prompt without any exception.

I want to know as my overrided method "setCompiler" was exactly
same then why I had to override method, and In original code (ie in drools-compiler.jar
file) why it was giving exception  ???  Was that due to class
lader or something else ??  Please do help in this regard ....
 
  

Thanks & Regards:

Pankaj Jain | L&T infotech |Navi Mumbai
Mobile: +91 9920218945
Email : pankaj.jain at lntinfotech.com
www.Lntinfotech.com

"Whatever the mind of man can conceive & believe, it can achieve."

Larsen & Toubro Infotech Ltd.
www.Lntinfotech.com

This Document is classified as: 

L&T
Infotech Proprietary   L&T
Infotech Confidential   L&T
Infotech Internal Use Only   L&T
Infotech General Business   

This Email may contain confidential or privileged information for the intended
recipient (s) If you are not the intended recipient, please do not use
or disseminate the information, notify the sender and delete it from your
system.  
______________________________________________________________________



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090728/da8820f9/attachment.html 


More information about the rules-users mailing list