<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 02/01/2012 13:46, Wolfgang Laun wrote:
<blockquote
cite="mid:CANaj1LdV9YPJHtLP59mn-k6Uec-KL-U9mvCc=e7fOu2ydU1JxQ@mail.gmail.com"
type="cite">On 2 January 2012 14:30, Matthew Versaggi <span
dir="ltr"><<a moz-do-not-send="true"
href="mailto:profversaggi@gmail.com" target="_blank">profversaggi@gmail.com</a>></span>
wrote:<br>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="border-left:1px solid
rgb(204,204,204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
Here's what I got working and when it failed .... it was just
the basic 'hello world' kind of stuff:<br>
<br>
Worked:<br>
final KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();<br>
<br>
Died: <br>
// this will parse and compile in one step<br>
kbuilder.add(ResourceFactory.newClassPathResource("HelloWorld.drl",
DroolsTest.class), ResourceType.DRL);<br>
<br>
LogCat:<br>
01-02 13:13:17.684: E/AndroidRuntime(537):
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.versaggi.android.droolsandroidtest/com.versaggi.android.droolsandroidtest.DroolsAndroidTestActivity}:
java.lang.NullPointerException<br>
<br>
</blockquote>
<div><br>
I've seen NPEs thrown up from down in the Drools gears when
the DRL resource could not be found. Make sure that<br>
ResourceFactory.newClassPathResource("HelloWorld.drl",
DroolsTest.class) <br>
<br>
is != null.<br>
<br>
</div>
<blockquote class="gmail_quote" style="border-left:1px solid
rgb(204,204,204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">I
had to re-compile the CompositeClassLoader.java file and then
reinsert it into the drools-api-5.1.0.M2.jar file to get past
this issue:<br>
<br>
"A small modification is needed in <span
style="font-style:italic">org.drools.util.CompositeClassLoader</span>.
Apparently, the Android JVM doesn't allow <span
style="font-style:italic">null</span> as the parent
classloader so I changed that to <span
style="font-style:italic">super(CompositeClassLoader.class.getClassLoader())</span>
in the constructor, and that works fine."<br>
</blockquote>
<div><br>
Yes, that's come up in other Java environments as well, and
IIRC been fixed on the way towards 5.2.0. )There ought to be a
closed JIRA, if s.o. cares to look it up.)<br>
</div>
</div>
</blockquote>
I'll check. It wasn't something I wanted committed to the main
branch, as it has search ramifications. But it would be good to
detect the environment and do it if it's android.<br>
<br>
Mark<br>
<blockquote
cite="mid:CANaj1LdV9YPJHtLP59mn-k6Uec-KL-U9mvCc=e7fOu2ydU1JxQ@mail.gmail.com"
type="cite">
<div class="gmail_quote">
<div><br>
-W<br>
<br>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
rules-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-dev">https://lists.jboss.org/mailman/listinfo/rules-dev</a>
</pre>
</blockquote>
<br>
</body>
</html>