Great news :) Please do feedback... if you get it working I'll make a blog entry on your behalf as you are not the first (or last) to try Drools on Android.
With kind regards, Mike 2011/6/9 Abhay B. Chaware <[email protected]> > That’s exactly what I am trying out at the moment .. option – b. > Pre-compile, serialize and unserialize …I’ll share the results. > > Also rule file’s there at the location mentioned. So that’s not a problem. > > I’ve gone through the blog you mentioned … and as you indicated, it’s only > jbpm .. no rules … > > > > thanks > > abhay > ------------------------------ > > *From:* [email protected] [mailto: > [email protected]] *On Behalf Of *Michael Anstis > *Sent:* Thursday, June 09, 2011 4:07 PM > > *To:* Rules Users List > *Subject:* Re: [rules-users] Drools in non-eclipse environment > > > > Preparing to be shouted down, but isn't it impossible to compile DRL on > Android and the suggestion is to load pre-serialised KnowledgeBases? > > Also, as another observation, are you sure the DRL was indeed found and the > NPE is not caused by > "com.ts.DBconnector.readKnowledgeBase(DBconnector.java:143)" perhaps passing > a null to KnowledgeBuilder? > > Have you looked at > http://blog.athico.com/2011/03/jbpm5-lightweight-running-on-android.html, > which might give some pointers - although it is only jBPM and not rules > themselves. > > With kind regards, > > Mike > > On 9 June 2011 11:11, Abhay B. Chaware <[email protected]> > wrote: > > This is what I did. > > Properties properties = new Properties(); > properties.put("drools.dialect.java.compiler", "JANINO"); > KnowledgeBuilderConfiguration kbConfig = > KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration( properties, > (ClassLoader[]) null ); > KnowledgeBuilder kbuilder = > KnowledgeBuilderFactory.newKnowledgeBuilder(kbConfig); > > kbuilder.add(ResourceFactory.newInputStreamResource(is), > ResourceType.DRL); > > I am getting same error with KnowledgeBuilderConfiguration .. > > W/System.err(27303): java.lang.NullPointerException > W/System.err(27303): at > org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:47) > W/System.err(27303): at > org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:1161) > W/System.err(27303): at > org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:637) > W/System.err(27303): at > org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:267) > W/System.err(27303): at > org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:459) > W/System.err(27303): at > org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28) > W/System.err(27303): at > com.ts.DBconnector.readKnowledgeBase(DBconnector.java:143) > W/System.err(27303): at > com.first.FirstActivity.onCreate(FirstActivity.java:64) > W/System.err(27303): at > android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) > W/System.err(27303): at > android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627) > W/System.err(27303): at > android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) > W/System.err(27303): at > android.app.ActivityThread.access$2300(ActivityThread.java:125) > > > ________________________________________ > From: [email protected] [ > [email protected]] On Behalf Of Wolfgang Laun [ > [email protected]] > Sent: Thursday, June 09, 2011 2:46 PM > > To: Rules Users List > Subject: Re: [rules-users] Drools in non-eclipse environment > > You might try this: > > Properties props = new Properties(); > props.put( "drools.dialect.java.compiler", "JANINO" ); > > KnowledgeBuilderConfiguration kbConfig = > KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration( props, > (ClassLoader[]) null ); > > Requires the janino jar in your classpath, which I have as > ~/.m2/repository/janino/janino/2.5.15/janino-2.5.15.jar > > -W > > On 9 June 2011 10:29, Abhay B. Chaware <[email protected] > <mailto:[email protected]>> wrote: > I am using drools 5.1.0 > > 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 - > > antlr-runtime.jar > drools-api.jar > drools-compiler.jar > drools-core.jar > mvel2.jar > > Do I need any other jar files ? > > upon drilling down into the Null Pointer Exception, it appears that it is > throwing NPE at following line inside RuleBuilder.java > > > RuleConditionBuilder builder = > (RuleConditionBuilder)context.getDialect().getBuilder(ruleDescr.getLhs().getClass()); > > and on further drilling, I found that "context.getDialect()" is retuning > NULL. > > Then I put some debug inside PackageBuilder.java > > upon drilling down for the error, found out that it is not able to set the > context's dialect. > ctr.getDialect(pkgRegistry.getDialect()) gives "null" ... > > DialectCompiletimeRegistry ctr = > pkgRegistry.getDialectCompiletimeRegistry(); > RuleBuildContext context = new RuleBuildContext(this, ruleDescr, ctr, pkg, > ctr.getDialect(pkgRegistry.getDialect())); > > Is there any default setting /configuration that I am obviously missing ? > > what could be the problem ? > > -abhay > > > ________________________________________ > > From: [email protected]<mailto: > [email protected]> [[email protected] > <mailto:[email protected]>] On Behalf Of Swindells, > Thomas [[email protected]<mailto:[email protected]>] > > Sent: Thursday, June 09, 2011 1:40 PM > To: Rules Users List > Subject: Re: [rules-users] Drools in non-eclipse environment > > Which version of drools is this? > For drools 5.0.1 we just use maven to resolve the dependencies for us and > it works fine. I can't obviously see any eclipse compiler in the jars that > we distribute with our application. > > Thomas > > > -----Original Message----- > > > From: [email protected]<mailto: > [email protected]> [mailto:rules-users-<mailto: > rules-users-> > > [email protected]<mailto:[email protected]>] On Behalf Of > Abhay B. Chaware > > > Sent: 09 June 2011 08:06 > > > To: [email protected]<mailto:[email protected]> > > > Subject: [rules-users] Drools in non-eclipse environment > > > > Has anyone tried using drools in non-eclipse env ? meaning that > > org.eclipse.jdt.core_3.5.1.v_972_R35x.jar is not in the classpath ? > > > > Documentation says this : > > > > (http://docs.huihoo.com/drools/4.0.7/ch02s05.html) > > > > if you do not have Eclipse JDT Core in your classpath you must override > the > > compiler setting before you instantiate this PackageBuilder, you can > either > > do that with a packagebuilder properties file the ChainedProperties class > will > > find, or you can do it programmatically as shown below; note this time I > use > > properties to inject the value for startup. > > > > They also provide an example, but I am not able to figure out exactly how > to > > use this example/info. > > > > Here is my code : > > > > KnowledgeBuilder kbuilder = > > KnowledgeBuilderFactory.newKnowledgeBuilder(); > > kbuilder.add(ResourceFactory.newInputStreamResource(is), > > ResourceType.DRL); > > > > where "is" is input stream containing the rule file ( .drl) > > > > How do I override the compiler setting ? > > > > I am getting a null pointer exception ( see below ) and I suspect that > > overriding the packagebuilderconfiguration will fix it ? > > > > W/System.err(25511): java.lang.NullPointerException > > W/System.err(25511): at > > org.drools.rule.builder.RuleBuilder.build(RuleBuilder.java:47) > > W/System.err(25511): at > > org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:1161) > > W/System.err(25511): at > > org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:637) > > W/System.err(25511): at > > org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java > > :267) > > W/System.err(25511): at > > org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder > > .java:459) > > W/System.err(25511): at > > org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.ja > > va:28) > > W/System.err(25511): at > > com.ts.DBconnector.readKnowledgeBase(DBconnector.java:146) > > > > > > > > _______________________________________________ > > rules-users mailing list > > > [email protected]<mailto:[email protected]> > > > https://lists.jboss.org/mailman/listinfo/rules-users > > > > ************************************************************************************** > > This message is confidential and intended only for the addressee. If you > have received this message in error, please immediately notify the > [email protected]<mailto:[email protected]> 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. > > > 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 > > ************************************************************************************** > > _______________________________________________ > rules-users mailing list > > [email protected]<mailto:[email protected]> > > https://lists.jboss.org/mailman/listinfo/rules-users > > > > _______________________________________________ > rules-users mailing list > > [email protected]<mailto:[email protected]> > > https://lists.jboss.org/mailman/listinfo/rules-users > > > > _______________________________________________ > rules-users mailing list > [email protected] > https://lists.jboss.org/mailman/listinfo/rules-users > > > > 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. > > _______________________________________________ > rules-users mailing list > [email protected] > https://lists.jboss.org/mailman/listinfo/rules-users > >
_______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
