<div>When you run from command prompt, make sure the classloader can find the class definition of <font size="2" face="Trebuchet MS">org.drools.rule.builder.dialect.java.JavaDialectConfiguration.<br><br>FYI:<br>RuleBaseConfiguration.java<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( classLoader != null ) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.classLoader = classLoader;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else if ( Thread.currentThread().getContextClassLoader() != null ) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.classLoader = Thread.currentThread().getContextClassLoader();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.classLoader = this.getClass().getClassLoader();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br></font><br></div><div></div><br>在2009-07-21,Pankaj.Jain@lntinfotech.com 写道:<br> <blockquote id="isReplyContent" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;"><br><font size="2" face="Trebuchet MS">Hi</font>
<br>
<br><font size="2" face="Trebuchet MS">I Have put all the required jar files
including </font><font size="3" face="sans-serif">eclipse's core-3.4.2.v_883_R34x.jar.</font><font size="2" face="Trebuchet MS">
&nbsp;Without overriding the "setCompiler" method code runs perfectly
from eclipse but gives exception when try to run from command prompt</font>
<br>
<br><font size="2" face="Trebuchet MS">Thanks &amp; Regards:<br>
<br>
Pankaj Jain | L&amp;T infotech |Navi Mumbai<br>
Mobile: +91 9920218945<br>
Email : <a href="mailto:pankaj.jain@lntinfotech.com">pankaj.jain@lntinfotech.com</a><br>
www.Lntinfotech.com<br>
<br>
"Whatever the mind of man can conceive &amp; believe, it can achieve."<br>
<b><br>
Larsen &amp; Toubro Infotech Ltd.</b></font><font color="blue" size="2" face="Trebuchet MS"><u><br>
</u></font><a href="http://www.lntinfotech.com"><font color="blue" size="2" face="Trebuchet MS"><u>www.Lntinfotech.com</u></font></a><font size="2" face="Trebuchet MS"><br>
<br>
This Document is classified as: <br>
<br>
</font><input name="F1_chkbox" checked value="on" type="checkbox"><font size="2" face="Trebuchet MS">L&amp;T
Infotech Proprietary &nbsp; </font><input name="F1_chkbox" value="on" type="checkbox"><font size="2" face="Trebuchet MS">L&amp;T
Infotech Confidential &nbsp; </font><input name="F1_chkbox" value="on" type="checkbox"><font size="2" face="Trebuchet MS">L&amp;T
Infotech Internal Use Only &nbsp; </font><input name="F1_chkbox" value="on" type="checkbox"><font size="2" face="Trebuchet MS">L&amp;T
Infotech General Business &nbsp; <br>
<br>
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. </font>
<br>
<br>
<br>
<table width="100%">
<tbody><tr valign="top">
<td width="40%"><font size="1" face="Trebuchet MS"><b>"nesta.fdb"
&lt;<a href="mailto:nesta.fdb@163.com">nesta.fdb@163.com</a>&gt;</b> </font>
<br><font size="1" face="Trebuchet MS">Sent by: <a href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a></font>
<p><font size="1" face="Trebuchet MS">07/21/2009 09:42 AM</font>
</p><table border="1">
<tbody><tr valign="top">
<td bgcolor="white">
<div align="center"><font size="1" face="Trebuchet MS">Please respond to<br>
Rules Users List &lt;<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>&gt;</font></div></td></tr></tbody></table>
<br>
</td><td width="59%">
<table width="100%">
<tbody><tr valign="top">
<td>
<div align="right"><font size="1" face="Trebuchet MS">To</font></div>
</td><td><font size="1" face="Trebuchet MS">"Rules Users List" &lt;<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>&gt;</font>
</td></tr><tr valign="top">
<td>
<div align="right"><font size="1" face="Trebuchet MS">cc</font></div>
</td><td>
</td></tr><tr valign="top">
<td>
<div align="right"><font size="1" face="Trebuchet MS">Subject</font></div>
</td><td><font size="1" face="Trebuchet MS">Re: [rules-users] Problem : Run Drool
Application From Command Prompt</font></td></tr></tbody></table>
<br>
<table>
<tbody><tr valign="top">
<td>
</td><td></td></tr></tbody></table>
<br></td></tr></tbody></table>
<br>
<br>
<br><font size="3" face="sans-serif">I think that you need to put java compiler
to your classpath.<br>
try eclipse's core-3.4.2.v_883_R34x.jar.</font>
<br>
<br><font size="3" face="sans-serif"><br>
在2009-07-21,<a href="mailto:Pankaj.Jain@lntinfotech.com">Pankaj.Jain@lntinfotech.com</a> 写道:</font>
<br><font size="2" face="Trebuchet MS"><br>
Hi</font><font size="3" face="sans-serif"> <br>
</font><font size="2" face="Trebuchet MS"><br>
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
<b>successfully.</b></font><font size="3" face="sans-serif"> <br>
</font><font size="2" face="Trebuchet MS"><b><br>
Code :</b> Which I was using initially</font><font size="3" face="sans-serif">
<br>
</font><font size="2" face="Trebuchet MS"><br>
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
</font><font size="3" face="sans-serif"><br>
</font><font size="2" face="Trebuchet MS"><br>
or</font><font size="3" face="sans-serif"> <br>
</font><font size="2" face="Trebuchet MS"><br>
PackageBuilderConfiguration cfg = new PackageBuilderConfiguration();</font><font size="3" face="sans-serif">
</font><font size="2" face="Trebuchet MS"><br>
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
</font><font size="3" face="sans-serif"><br>
</font><font size="2" face="Trebuchet MS"><b><br>
Exception I got :</b></font><font size="3" face="sans-serif"> <br>
</font><font size="2" face="Trebuchet MS"><br>
org.drools.RuntimeDroolsException: Unable to load dialect 'org.drools.rule.builder.dialect.java.JavaDialectConfiguration:java
<br>
:org.drools.rule.builder.dialect.java.JavaDialectConfiguration'</font><font size="3" face="sans-serif">
</font><font size="2" face="Trebuchet MS"><br>
at org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:274)
at org.drools.compiler.PackageBuilderConfiguration.buildDialectConfigurationMap(PackageBuilderConfiguration.java:259)
</font><font size="3" face="sans-serif"><br>
</font><font size="2" face="Trebuchet MS"><br>
at org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:176)
at org.drools.compiler.PackageBuilderConfiguration.&lt;init&gt;(PackageBuilderConfiguration.java:153)
at org.drools.compiler.PackageBuilder.&lt;init&gt;(PackageBuilder.java:242)
<br>
.</font><font size="3" face="sans-serif"> </font><font size="2" face="Trebuchet MS"><br>
.</font><font size="3" face="sans-serif"> </font><font size="2" face="Trebuchet MS"><br>
.</font><font size="3" face="sans-serif"> </font><font size="2" face="Trebuchet MS"><br>
Caused by: java.lang.NullPointerException</font><font size="3" face="sans-serif">
</font><font size="2" face="Trebuchet MS"><br>
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</font><font size="3" face="sans-serif">
<br>
</font><font size="2" face="Trebuchet MS"><b><br>
Problem I found : </b><br>
In the class JavaDialectConfiguration in jar file drools-compiler.jar there
is a method named "setCompliler", &nbsp;in this method Null Pointer
Exception was coming.</font><font size="3" face="sans-serif"> <br>
</font><font size="2" face="Trebuchet MS"><b><br>
Solution I provided :</b></font><font size="3" face="sans-serif"> </font><font size="2" face="Trebuchet MS"><br>
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. <br>
after that I wrote the code:</font><font size="3" face="sans-serif"> <br>
</font><font size="2" face="Trebuchet MS"><br>
PackageBuilderConfiguration cfg = new CustomPackageBuilderConfiguration();</font><font size="3" face="sans-serif">
</font><font size="2" face="Trebuchet MS"><br>
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(cfg);</font><font size="3" face="sans-serif">
<br>
<br>
</font><font size="2" face="Trebuchet MS"><br>
Now application is running perfectly fine from both eclipse and command
prompt without any exception.</font><font size="3" face="sans-serif"> <br>
</font><font size="2" face="Trebuchet MS"><b><br>
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 &nbsp;??? &nbsp;Was that due to class
lader or something else ?? &nbsp;Please do help in this regard ....</b></font><font size="3" face="sans-serif">
<br>
</font><font size="2" face="Trebuchet MS"><br>
Thanks &amp; Regards:<br>
<br>
Pankaj Jain | L&amp;T infotech |Navi Mumbai<br>
Mobile: +91 9920218945<br>
Email : </font><a href="mailto:pankaj.jain@lntinfotech.com"><font color="blue" size="2" face="Trebuchet MS"><u>pankaj.jain@lntinfotech.com</u></font></a><font size="2" face="Trebuchet MS"><br>
www.Lntinfotech.com<br>
<br>
"Whatever the mind of man can conceive &amp; believe, it can achieve."<b><br>
<br>
Larsen &amp; Toubro Infotech Ltd.</b></font><font color="blue" size="3" face="sans-serif"><u><br>
</u></font><a href="http://www.lntinfotech.com"><font color="blue" size="2" face="Trebuchet MS"><u>www.Lntinfotech.com</u></font></a><font size="2" face="Trebuchet MS"><br>
<br>
This Document is classified as: <br>
</font><font size="3" face="sans-serif"><br>
</font><input name="F1_chkbox" checked value="on" type="checkbox"><font size="2" face="Trebuchet MS">L&amp;T
Infotech Proprietary &nbsp; </font><input name="F1_chkbox" value="on" type="checkbox"><font size="2" face="Trebuchet MS">L&amp;T
Infotech Confidential &nbsp; </font><input name="F1_chkbox" value="on" type="checkbox"><font size="2" face="Trebuchet MS">L&amp;T
Infotech Internal Use Only &nbsp; </font><input name="F1_chkbox" value="on" type="checkbox"><font size="2" face="Trebuchet MS">L&amp;T
Infotech General Business &nbsp; <br>
<br>
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. </font><font size="3" face="sans-serif"><br>
______________________________________________________________________</font>
<br><font size="3" face="sans-serif"><br>
</font><font color="blue" size="3" face="sans-serif"><u><br>
</u></font><a href="http://www.yeah.net/?from=footer"><font color="blue" size="3" face="sans-serif"><u>网易YEAH.NET免费邮箱:您的终身免费邮箱</u></font></a><font size="3" face="sans-serif">
<br>
______________________________________________________________________</font><tt><font size="2">_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
https://lists.jboss.org/mailman/listinfo/rules-users<br>
</font></tt>
<br>

<br>
______________________________________________________________________<br>

</blockquote><br><!-- footer --><br><span title="neteasefooter"/><hr/>
<a href="http://www.yeah.net/?from=footer">网易YEAH.NET免费邮箱:您的终身免费邮箱</a>
</span>