On 02/01/2012 13:46, Wolfgang Laun wrote:
On 2 January 2012 14:30, Matthew Versaggi <profversaggi(a)gmail.com
<mailto:profversaggi@gmail.com>> wrote:
Here's what I got working and when it failed .... it was just the
basic 'hello world' kind of stuff:
Worked:
final KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();
Died:
// this will parse and compile in one step
kbuilder.add(ResourceFactory.newClassPathResource("HelloWorld.drl",
DroolsTest.class),
ResourceType.DRL);
LogCat:
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
I've seen NPEs thrown up from down in the Drools gears when the DRL
resource could not be found. Make sure that
ResourceFactory.newClassPathResource("HelloWorld.drl",
DroolsTest.class)
is != null.
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:
"A small modification is needed in
org.drools.util.CompositeClassLoader. Apparently, the Android JVM
doesn't allow null as the parent classloader so I changed that to
super(CompositeClassLoader.class.getClassLoader()) in the
constructor, and that works fine."
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.)
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.
Mark
-W
_______________________________________________
rules-dev mailing list
rules-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev