Great news :)<br><br>Please do feedback... if you get it working I&#39;ll make a blog entry on your behalf as you are not the first (or last) to try Drools on Android.<br><br>With kind regards,<br><br>Mike<br><br><div class="gmail_quote">
2011/6/9 Abhay B. Chaware <span dir="ltr">&lt;<a href="mailto:Abhay.Chaware@kpitcummins.com">Abhay.Chaware@kpitcummins.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

















<div link="blue" vlink="blue" lang="EN-US">

<div>

<div>

<p class="MsoNormal"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">That’s exactly what I am trying out at the moment .. option –
b.  Pre-compile, serialize and unserialize …I’ll share the results.</span></font></p>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">Also rule file’s
there at the location mentioned. So that’s not a problem.</span></font></p>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">I’ve gone
through the blog you mentioned … and as you indicated, it’s only
jbpm .. no rules …</span></font></p>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;"> </span></font></p>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">thanks</span></font></p>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">abhay</span></font></p>

</div>

<div>

<div class="MsoNormal" style="text-align: center;" align="center"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">

<hr size="2" width="100%" align="center">

</span></font></div>

<p class="MsoNormal"><b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;">From:</span></font></b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma;">
<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a>
[mailto:<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a>] <b><span style="font-weight: bold;">On
Behalf Of </span></b>Michael Anstis<br>
<b><span style="font-weight: bold;">Sent:</span></b> Thursday, June 09, 2011 4:07
PM<div><div></div><div class="h5"><br>
<b><span style="font-weight: bold;">To:</span></b> Rules
 Users List<br>
<b><span style="font-weight: bold;">Subject:</span></b> Re: [rules-users] Drools
in non-eclipse environment</div></div></span></font></p>

</div><div><div></div><div class="h5">

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;"> </span></font></p>

<p class="MsoNormal" style="margin-bottom: 12pt;"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">Preparing to be shouted
down, but isn&#39;t it impossible to compile DRL on Android and the suggestion is
to load pre-serialised KnowledgeBases?<br>
<br>
Also, as another observation, are you sure the DRL was indeed found and the NPE
is not caused by &quot;com.ts.DBconnector.readKnowledgeBase(DBconnector.java:143)&quot;
perhaps passing a null to KnowledgeBuilder?<br>
<br>
Have you looked at <a href="http://blog.athico.com/2011/03/jbpm5-lightweight-running-on-android.html" target="_blank">http://blog.athico.com/2011/03/jbpm5-lightweight-running-on-android.html</a>,
which might give some pointers - although it is only jBPM and not rules
themselves.<br>
<br>
With kind regards,<br>
<br>
Mike</span></font></p>

<div>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">On 9 June 2011 11:11, Abhay B. Chaware &lt;<a href="mailto:Abhay.Chaware@kpitcummins.com" target="_blank">Abhay.Chaware@kpitcummins.com</a>&gt;
wrote:</span></font></p>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">This is what I did.<br>
<br>
               Properties properties =
new Properties();<br>
             
 properties.put(&quot;drools.dialect.java.compiler&quot;,
&quot;JANINO&quot;);<br>
             
 KnowledgeBuilderConfiguration kbConfig =
KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration( properties,
(ClassLoader[]) null );<br>
               KnowledgeBuilder
kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(kbConfig);</span></font></p>

<div>

<p class="MsoNormal" style="margin-bottom: 12pt;"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">     
         kbuilder.add(ResourceFactory.newInputStreamResource(is),
ResourceType.DRL);<br>
<br>
</span></font></p>

</div>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">I am getting same error with KnowledgeBuilderConfiguration ..<br>
<br>
W/System.err(27303): java.lang.NullPointerException<br>
W/System.err(27303):    at org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:47)<br>
W/System.err(27303):    at
org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:1161)<br>
W/System.err(27303):    at
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:637)<br>
W/System.err(27303):    at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:267)<br>
W/System.err(27303):    at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:459)<br>
W/System.err(27303):    at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)<br>
W/System.err(27303):    at
com.ts.DBconnector.readKnowledgeBase(DBconnector.java:143)<br>
W/System.err(27303):    at
com.first.FirstActivity.onCreate(FirstActivity.java:64)<br>
W/System.err(27303):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)<br>
W/System.err(27303):    at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)<br>
W/System.err(27303):    at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)<br>
W/System.err(27303):    at
android.app.ActivityThread.access$2300(ActivityThread.java:125)<br>
<br>
<br>
________________________________________<br>
From: <a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a>
[<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a>]
On Behalf Of Wolfgang Laun [<a href="mailto:wolfgang.laun@gmail.com" target="_blank">wolfgang.laun@gmail.com</a>]<br>
Sent: Thursday, June 09, 2011 2:46 PM</span></font></p>

<div>

<p class="MsoNormal" style="margin-bottom: 12pt;"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">To: Rules Users List<br>
Subject: Re: [rules-users] Drools in non-eclipse environment</span></font></p>

</div>

<div>

<p class="MsoNormal" style="margin-bottom: 12pt;"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">You might try this:<br>
<br>
    Properties props = new Properties();<br>
    props.put( &quot;drools.dialect.java.compiler&quot;,
&quot;JANINO&quot; );<br>
<br>
   KnowledgeBuilderConfiguration kbConfig =<br>
     
 KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration( props,
(ClassLoader[]) null );<br>
<br>
Requires the janino jar in your classpath, which I have as<br>
  ~/.m2/repository/janino/janino/2.5.15/janino-2.5.15.jar<br>
<br>
-W</span></font></p>

</div>

<div>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">On 9 June 2011 10:29, Abhay B. Chaware &lt;<a href="mailto:Abhay.Chaware@kpitcummins.com" target="_blank">Abhay.Chaware@kpitcummins.com</a>&lt;mailto:<a href="mailto:Abhay.Chaware@kpitcummins.com" target="_blank">Abhay.Chaware@kpitcummins.com</a>&gt;&gt;
wrote:<br>
I am using drools 5.1.0<br>
<br>
Let me explain what I am trying to do.  I am trying to write a drools app
on to android platform.  In my app, I have added following jars in the
application classpath -<br>
<br>
antlr-runtime.jar<br>
drools-api.jar<br>
drools-compiler.jar<br>
drools-core.jar<br>
mvel2.jar<br>
<br>
Do I need any other jar files ?<br>
<br>
upon drilling down into the Null Pointer Exception, it appears that it is throwing
NPE at following line inside RuleBuilder.java<br>
<br>
<br>
  RuleConditionBuilder builder =
(RuleConditionBuilder)context.getDialect().getBuilder(ruleDescr.getLhs().getClass());<br>
<br>
and on further drilling, I found that &quot;context.getDialect()&quot; is
retuning NULL.<br>
<br>
Then I put some debug inside PackageBuilder.java<br>
<br>
upon drilling down for the error, found out that it is not able to set the
context&#39;s dialect.<br>
ctr.getDialect(pkgRegistry.getDialect()) gives &quot;null&quot; ...<br>
<br>
DialectCompiletimeRegistry ctr = pkgRegistry.getDialectCompiletimeRegistry();<br>
RuleBuildContext context = new RuleBuildContext(this, ruleDescr, ctr, pkg,
ctr.getDialect(pkgRegistry.getDialect()));<br>
<br>
Is there any default setting /configuration that I am obviously missing ?<br>
<br>
what could be the problem ?<br>
<br>
-abhay<br>
<br>
<br>
________________________________________</span></font></p>

</div>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">From: <a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a>&lt;mailto:<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a>&gt;
[<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a>&lt;mailto:<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a>&gt;]
On Behalf Of Swindells, Thomas [<a href="mailto:TSwindells@nds.com" target="_blank">TSwindells@nds.com</a>&lt;mailto:<a href="mailto:TSwindells@nds.com" target="_blank">TSwindells@nds.com</a>&gt;]</span></font></p>

<div>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">Sent: Thursday, June 09, 2011 1:40 PM<br>
To: Rules Users List<br>
Subject: Re: [rules-users] Drools in non-eclipse environment<br>
<br>
Which version of drools is this?<br>
For drools 5.0.1 we just use maven to resolve the dependencies for us and it
works fine. I can&#39;t obviously see any eclipse compiler in the jars that we
distribute with our application.<br>
<br>
Thomas<br>
<br>
&gt; -----Original Message-----</span></font></p>

</div>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">&gt; From: <a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a>&lt;mailto:<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a>&gt;
[mailto:<a href="mailto:rules-users-" target="_blank">rules-users-</a>&lt;mailto:<a href="mailto:rules-users-" target="_blank">rules-users-</a>&gt;<br>
&gt; <a href="mailto:bounces@lists.jboss.org" target="_blank">bounces@lists.jboss.org</a>&lt;mailto:<a href="mailto:bounces@lists.jboss.org" target="_blank">bounces@lists.jboss.org</a>&gt;] On
Behalf Of Abhay B. Chaware</span></font></p>

<div>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">&gt; Sent: 09 June 2011 08:06</span></font></p>

</div>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">&gt; To: <a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>&lt;mailto:<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>&gt;</span></font></p>


<div>

<div>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">&gt; Subject: [rules-users] Drools in non-eclipse environment<br>
&gt;<br>
&gt; Has anyone tried using drools in non-eclipse env ? meaning that<br>
&gt; org.eclipse.jdt.core_3.5.1.v_972_R35x.jar is not in the classpath ?<br>
&gt;<br>
&gt; Documentation says this :<br>
&gt;<br>
&gt; (<a href="http://docs.huihoo.com/drools/4.0.7/ch02s05.html" target="_blank">http://docs.huihoo.com/drools/4.0.7/ch02s05.html</a>)<br>
&gt;<br>
&gt; if you do not have Eclipse JDT Core in your classpath you must override
the<br>
&gt; compiler setting before you instantiate this PackageBuilder, you can
either<br>
&gt; do that with a packagebuilder properties file the ChainedProperties class
will<br>
&gt; find, or you can do it programmatically as shown below; note this time I
use<br>
&gt; properties to inject the value for startup.<br>
&gt;<br>
&gt; They also provide an example, but I am not able to figure out exactly how
to<br>
&gt; use this example/info.<br>
&gt;<br>
&gt; Here is my code :<br>
&gt;<br>
&gt;               KnowledgeBuilder kbuilder
=<br>
&gt; KnowledgeBuilderFactory.newKnowledgeBuilder();<br>
&gt;              
kbuilder.add(ResourceFactory.newInputStreamResource(is),<br>
&gt; ResourceType.DRL);<br>
&gt;<br>
&gt; where &quot;is&quot; is input stream containing the rule file ( .drl)<br>
&gt;<br>
&gt; How do I override the compiler setting ?<br>
&gt;<br>
&gt; I am getting a null pointer exception ( see below ) and I suspect that<br>
&gt; overriding the packagebuilderconfiguration will fix it ?<br>
&gt;<br>
&gt; W/System.err(25511): java.lang.NullPointerException<br>
&gt; W/System.err(25511):    at<br>
&gt; org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:47)<br>
&gt; W/System.err(25511):    at<br>
&gt; org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:1161)<br>
&gt; W/System.err(25511):    at<br>
&gt; org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:637)<br>
&gt; W/System.err(25511):    at<br>
&gt; org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java<br>
&gt; :267)<br>
&gt; W/System.err(25511):    at<br>
&gt; org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder<br>
&gt; .java:459)<br>
&gt; W/System.err(25511):    at<br>
&gt; org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.ja<br>
&gt; va:28)<br>
&gt; W/System.err(25511):    at<br>
&gt; com.ts.DBconnector.readKnowledgeBase(DBconnector.java:146)<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; rules-users mailing list</span></font></p>

</div>

</div>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">&gt; <a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>&lt;mailto:<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>&gt;</span></font></p>


<div>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>

<br>
<br>
**************************************************************************************</span></font></p>

</div>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">This message is confidential and intended only for the addressee. If
you have received this message in error, please immediately notify the <a href="mailto:postmaster@nds.com" target="_blank">postmaster@nds.com</a>&lt;mailto:<a href="mailto:postmaster@nds.com" target="_blank">postmaster@nds.com</a>&gt; and delete it from
your system as well as any copies. The content of e-mails as well as traffic
data may be monitored by NDS for employment and security purposes. To protect
the environment please do not print this e-mail unless necessary.</span></font></p>

<div>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;"><br>
NDS Limited. Registered Office: One
  London Road, Staines, Middlesex, TW18 4EX,
 United Kingdom.
A company registered in England
and Wales.
Registered no. 3080780. VAT no. GB 603 8808 40-00<br>
**************************************************************************************<br>
<br>
_______________________________________________<br>
rules-users mailing list</span></font></p>

</div>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;"><a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>&lt;mailto:<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>&gt;</span></font></p>


<div>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;"><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>

<br>
<br>
<br>
_______________________________________________<br>
rules-users mailing list</span></font></p>

</div>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;"><a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>&lt;mailto:<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>&gt;</span></font></p>


<div>

<div>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;"><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>

<br>
<br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a></span></font></p>

</div>

</div>

</div>

<p class="MsoNormal"><font face="Times New Roman" size="3"><span style="font-size: 12pt;"> </span></font></p>

</div></div></div>

<br clear="all"> This message contains information that may be privileged or confidential and is the property of the KPIT Cummins Infosystems Ltd. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. KPIT Cummins Infosystems Ltd. does not accept any liability for virus infected mails.
</div>



<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br>