When you run from command prompt, make sure the classloader can find the class definition of org.drools.rule.builder.dialect.java.JavaDialectConfiguration.

FYI:
RuleBaseConfiguration.java
        if ( classLoader != null ) {
            this.classLoader = classLoader;
        } else if ( Thread.currentThread().getContextClassLoader() != null ) {
            this.classLoader = Thread.currentThread().getContextClassLoader();
        } else {
            this.classLoader = this.getClass().getClassLoader();
        }


在2009-07-21,Pankaj.Jain@lntinfotech.com 写道:

Hi

I Have put all the required jar files including eclipse's core-3.4.2.v_883_R34x.jar.  Without overriding the "setCompiler" method code runs perfectly from eclipse but gives exception when try to run from command prompt

Thanks & Regards:

Pankaj Jain | L&T infotech |Navi Mumbai
Mobile: +91 9920218945
Email : pankaj.jain@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.



"nesta.fdb" <nesta.fdb@163.com>
Sent by: rules-users-bounces@lists.jboss.org

07/21/2009 09:42 AM

Please respond to
Rules Users List <rules-users@lists.jboss.org>

To
"Rules Users List" <rules-users@lists.jboss.org>
cc
Subject
Re: [rules-users] Problem : Run Drool Application From Command Prompt





I think that you need to put java compiler to your classpath.
try eclipse's core-3.4.2.v_883_R34x.jar.



在2009-07-21,Pankaj.Jain@lntinfotech.com 写道:


Hi


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@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.

______________________________________________________________________



网易YEAH.NET免费邮箱:您的终身免费邮箱
______________________________________________________________________
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


______________________________________________________________________



网易YEAH.NET免费邮箱:您的终身免费邮箱