When you run from command prompt, make sure the classloader can find the class definition of org.drools.rule.builder.dialect.java.JavaDialectConfiguration.
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
"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.
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
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 ....
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