[rules-dev] Drools on android -reply

Matthew Versaggi profversaggi at gmail.com
Mon Jan 2 08:30:32 EST 2012


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

That's about as far as I could get.

I think this DOC will probably help out ....
https://github.com/cgreenhalgh/droolstest/blob/8ea1a06d9b1b38a40b1add7f988ebbf9f4ff3e88/docs/drools-on-android.html..
..

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."

However I think that his other modifications aren't completely integrated
into the drools-compiler-5.1.0.M2.jar or the drools-core jar files he
provides just yet.

*********************************


On Mon, Jan 2, 2012 at 2:11 PM, Wolfgang Laun <wolfgang.laun at gmail.com>wrote:

>
>
> On 2 January 2012 13:58, profversaggi <profversaggi at gmail.com> wrote:
>
>> I've run across the work of a very bright man in the UK who did it as
>> part of
>> an integrated systems he was working on ... and I got his code working up
>> to
>> the point where it died loading the DRL rules.
>>
>
> His rules? Your rules? Did you try the simple "Hello World" rule?
>
> rule HW
> when
> then
>     System.out.println( "Hello world" );
> end
>
> -W
>
>
>> I think this might shed some light on things but it's fast getting into
>> true
>> software engineering and I'm just not there yet ....
>>
>> Here is his codebase:
>> https://github.com/cgreenhalgh/droolstest
>>
>>
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/Drools-on-android-tp723184p3626516.html
>> Sent from the Drools: Developer (committer) mailing list mailing list
>> archive at Nabble.com.
>> _______________________________________________
>> rules-dev mailing list
>> rules-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-dev
>>
>
>
> _______________________________________________
> rules-dev mailing list
> rules-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-dev/attachments/20120102/bbfd6263/attachment.html 


More information about the rules-dev mailing list