[rules-users] Drools in non-eclipse environment

classic Classic list List threaded Threaded
24 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[rules-users] Drools in non-eclipse environment

abhay_bc
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.java:28)
W/System.err(25511):    at com.ts.DBconnector.readKnowledgeBase(DBconnector.java:146)



_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Drools in non-eclipse environment

Swindells, Thomas
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: [hidden email] [mailto:rules-users-
> [hidden email]] On Behalf Of Abhay B. Chaware
> Sent: 09 June 2011 08:06
> To: [hidden email]
> 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
> [hidden email]
> 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 [hidden email] 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
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Drools in non-eclipse environment

abhay_bc
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: [hidden email] [[hidden email]] On Behalf Of Swindells, Thomas [[hidden email]]
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: [hidden email] [mailto:rules-users-
> [hidden email]] On Behalf Of Abhay B. Chaware
> Sent: 09 June 2011 08:06
> To: [hidden email]
> 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
> [hidden email]
> 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 [hidden email] 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
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users



_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Drools in non-eclipse environment

ge0ffrey
Administrator


Op 09-06-11 10:29, Abhay B. Chaware schreef:
> 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 ?

If you precompile (using the maven-plugin of angkar out there), you only
need required the dependencies of drools-core as defined by the maven
pom.xml:
   
http://search.maven.org/#artifactdetails|org.drools|drools-core|5.2.0.CR1|jar
   (ignore all dependencies with scope=test, scope=provided or
optional=true)
So no need for jdt, no need for drools-compiler, ...

But if you don't precompile, you need all required dependencies (which
includes jdt, but IIRC you exclude jdt and include janino instead) as
defined by the maven pom.xml:
   
http://search.maven.org/#artifactdetails|org.drools|drools-compiler|5.2.0.CR1|jar
   (ignore all dependencies with scope=test, scope=provided or
optional=true)

Much is cleaned up for 5.2, I 'd recommend using 5.2.0.CR1 at this point
(final will be released soon).

PS: Consider declaring your dependencies with maven 3, buildr, ivy or
gradle: just adding jars to the classpath until it works is asking for
trouble.

_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Drools in non-eclipse environment

Swindells, Thomas
> If you precompile (using the maven-plugin of angkar out there),
Are any details on this plugin available? - is it this one? http://passion.forco.de/content/maven-drools-plugin_overview
What are peoples experiences of using it?

Thanks,

Thomas


**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the [hidden email] 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
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Drools in non-eclipse environment

ge0ffrey
Administrator
that's the one.
If angskar is cool with it, we should pull it inside droolsjbpm-tools as
maven-drools-plugin really.

Op 09-06-11 10:59, Swindells, Thomas schreef:

>> If you precompile (using the maven-plugin of angkar out there),
> Are any details on this plugin available? - is it this one? http://passion.forco.de/content/maven-drools-plugin_overview
> What are peoples experiences of using it?
>
> Thanks,
>
> Thomas
>
>
> **************************************************************************************
> This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the [hidden email] 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
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/rules-users
>

--
With kind regards,
Geoffrey De Smet


_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Drools in non-eclipse environment

laune
In reply to this post by abhay_bc
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 <[hidden email]> 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: [hidden email] [[hidden email]] On Behalf Of Swindells, Thomas [[hidden email]]
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: [hidden email] [mailto:[hidden email]
> [hidden email]] On Behalf Of Abhay B. Chaware
> Sent: 09 June 2011 08:06
> To: [hidden email]
> 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
> [hidden email]
> 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 [hidden email] 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
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users



_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users


_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Drools in non-eclipse environment

abhay_bc
How do I use this kbConfig instance of KnowledgeBuilderConfiguration  ?

________________________________________
From: [hidden email] [[hidden email]] On Behalf Of Wolfgang Laun [[hidden email]]
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 <[hidden email]<mailto:[hidden email]>> 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: [hidden email]<mailto:[hidden email]> [[hidden email]<mailto:[hidden email]>] On Behalf Of Swindells, Thomas [[hidden email]<mailto:[hidden email]>]
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: [hidden email]<mailto:[hidden email]> [mailto:rules-users-<mailto:rules-users->
> [hidden email]<mailto:[hidden email]>] On Behalf Of Abhay B. Chaware
> Sent: 09 June 2011 08:06
> To: [hidden email]<mailto:[hidden email]>
> 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
> [hidden email]<mailto:[hidden email]>
> 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 [hidden email]<mailto:[hidden email]> 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
[hidden email]<mailto:[hidden email]>
https://lists.jboss.org/mailman/listinfo/rules-users



_______________________________________________
rules-users mailing list
[hidden email]<mailto:[hidden email]>
https://lists.jboss.org/mailman/listinfo/rules-users



_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Drools in non-eclipse environment

abhay_bc
In reply to this post by laune
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: [hidden email] [[hidden email]] On Behalf Of Wolfgang Laun [[hidden email]]
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 <[hidden email]<mailto:[hidden email]>> 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: [hidden email]<mailto:[hidden email]> [[hidden email]<mailto:[hidden email]>] On Behalf Of Swindells, Thomas [[hidden email]<mailto:[hidden email]>]
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: [hidden email]<mailto:[hidden email]> [mailto:rules-users-<mailto:rules-users->
> [hidden email]<mailto:[hidden email]>] On Behalf Of Abhay B. Chaware
> Sent: 09 June 2011 08:06
> To: [hidden email]<mailto:[hidden email]>
> 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
> [hidden email]<mailto:[hidden email]>
> 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 [hidden email]<mailto:[hidden email]> 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
[hidden email]<mailto:[hidden email]>
https://lists.jboss.org/mailman/listinfo/rules-users



_______________________________________________
rules-users mailing list
[hidden email]<mailto:[hidden email]>
https://lists.jboss.org/mailman/listinfo/rules-users



_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Drools in non-eclipse environment

manstis
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 <[hidden email]> 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: [hidden email] [[hidden email]] On Behalf Of Wolfgang Laun [[hidden email]]
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 <[hidden email]<mailto:[hidden email]>> 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: [hidden email]<mailto:[hidden email]> [[hidden email]<mailto:[hidden email]>] On Behalf Of Swindells, Thomas [[hidden email]<mailto:[hidden email]>]
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: [hidden email]<mailto:[hidden email]> [mailto:[hidden email]<mailto:[hidden email]>
> [hidden email]<mailto:[hidden email]>] On Behalf Of Abhay B. Chaware
> Sent: 09 June 2011 08:06
> To: [hidden email]<mailto:[hidden email]>
> 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
> [hidden email]<mailto:[hidden email]>
> 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 [hidden email]<mailto:[hidden email]> 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
[hidden email]<mailto:[hidden email]>
https://lists.jboss.org/mailman/listinfo/rules-users



_______________________________________________
rules-users mailing list
[hidden email]<mailto:[hidden email]>


_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Drools in non-eclipse environment

abhay_bc

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: [hidden email] [mailto:[hidden email]] 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 <[hidden email]> 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: [hidden email] [[hidden email]] On Behalf Of Wolfgang Laun [[hidden email]]
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 <[hidden email]<mailto:[hidden email]>> 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: [hidden email]<mailto:[hidden email]> [[hidden email]<mailto:[hidden email]>] On Behalf Of Swindells, Thomas [[hidden email]<mailto:[hidden email]>]

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: [hidden email]<mailto:[hidden email]> [mailto:[hidden email]<mailto:[hidden email]>
> [hidden email]<mailto:[hidden email]>] On Behalf Of Abhay B. Chaware

> Sent: 09 June 2011 08:06

> To: [hidden email]<mailto:[hidden email]>

> 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

> [hidden email]<mailto:[hidden email]>

> 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 [hidden email]<mailto:[hidden email]> 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

[hidden email]<mailto:[hidden email]>

https://lists.jboss.org/mailman/listinfo/rules-users



_______________________________________________
rules-users mailing list

[hidden email]<mailto:[hidden email]>

 


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
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Drools in non-eclipse environment

manstis
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 <[hidden email]>

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: [hidden email] [mailto:[hidden email]] 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 <[hidden email]> 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: [hidden email] [[hidden email]] On Behalf Of Wolfgang Laun [[hidden email]]
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 <[hidden email]<mailto:[hidden email]>> 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: [hidden email]<mailto:[hidden email]> [[hidden email]<mailto:[hidden email]>] On Behalf Of Swindells, Thomas [[hidden email]<mailto:[hidden email]>]

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: [hidden email]<mailto:[hidden email]> [mailto:[hidden email]<mailto:[hidden email]>
> [hidden email]<mailto:[hidden email]>] On Behalf Of Abhay B. Chaware

> Sent: 09 June 2011 08:06

> To: [hidden email]<mailto:[hidden email]>

> 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

> [hidden email]<mailto:[hidden email]>

> 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 [hidden email]<mailto:[hidden email]> 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

[hidden email]<mailto:[hidden email]>

https://lists.jboss.org/mailman/listinfo/rules-users



_______________________________________________
rules-users mailing list

[hidden email]<mailto:[hidden email]>

 


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
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users



_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Drools in non-eclipse environment

abhay_bc

woo hooo ! I got past that problem J  But a new one’s here now.

 

Looks like MVEL is not liking something J 

 

 

 

W/dalvikvm(29977): VFY: unable to resolve static method 164: Ljava/beans/Introspector;.decapitalize (Ljava/lang/String;)Ljava/lang

/String;

W/dalvikvm(29977): threadid=1: thread exiting with uncaught exception (group=0x40020ac0)

E/AndroidRuntime(29977): FATAL EXCEPTION: main

E/AndroidRuntime(29977): java.lang.NoClassDefFoundError: java.beans.Introspector

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.calcFieldName(ClassFieldInspector.java:298)

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.addToMapping(ClassFieldInspector.java:216)

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.processClassWithoutByteCode(ClassFieldInspector.ja

va:148)

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.<init>(ClassFieldInspector.java:83)

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.<init>(ClassFieldInspector.java:64)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorFactory.getClassFieldReader(ClassFieldAccessorFactory.java:11

8)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorCache$CacheEntry.getReadAccessor(ClassFieldAccessorCache.java

:168)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorCache.getReadAcessor(ClassFieldAccessorCache.java:101)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorStore.wire(ClassFieldAccessorStore.java:404)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorStore.wire(ClassFieldAccessorStore.java:374)

E/AndroidRuntime(29977):        at org.drools.common.AbstractRuleBase.readExternal(AbstractRuleBase.java:295)

E/AndroidRuntime(29977):        at org.drools.reteoo.ReteooRuleBase.readExternal(ReteooRuleBase.java:236)

E/AndroidRuntime(29977):        at org.drools.impl.KnowledgeBaseImpl.readExternal(KnowledgeBaseImpl.java:108)

E/AndroidRuntime(29977):        at java.io.ObjectInputStream.readNewObject(ObjectInputStream.java:2127)

E/AndroidRuntime(29977):        at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:929)

E/AndroidRuntime(29977):        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2285)

E/AndroidRuntime(29977):        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2240)

E/AndroidRuntime(29977):        at com.ts.DBconnector.execPackageByPath(DBconnector.java:219)

E/AndroidRuntime(29977):        at com.first.FirstActivity.onCreate(FirstActivity.java:77)

E/AndroidRuntime(29977):        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)

E/AndroidRuntime(29977):        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)

E/AndroidRuntime(29977):        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)

E/AndroidRuntime(29977):        at android.app.ActivityThread.access$2300(ActivityThread.java:125)

E/AndroidRuntime(29977):        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)

E/AndroidRuntime(29977):        at android.os.Handler.dispatchMessage(Handler.java:99)

E/AndroidRuntime(29977):        at android.os.Looper.loop(Looper.java:123)

E/AndroidRuntime(29977):        at android.app.ActivityThread.main(ActivityThread.java:4627)

E/AndroidRuntime(29977):        at java.lang.reflect.Method.invokeNative(Native Method)

E/AndroidRuntime(29977):        at java.lang.reflect.Method.invoke(Method.java:521)

E/AndroidRuntime(29977):        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)

E/AndroidRuntime(29977):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)

E/AndroidRuntime(29977):        at dalvik.system.NativeStart.main(Native Method)

 

 

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Michael Anstis
Sent: Thursday, June 09, 2011 4:51 PM
To: Rules Users List
Subject: Re: [rules-users] Drools in non-eclipse environment

 

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 <[hidden email]>

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: [hidden email] [mailto:[hidden email]] 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 <[hidden email]> 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: [hidden email] [[hidden email]] On Behalf Of Wolfgang Laun [[hidden email]]
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 <[hidden email]<mailto:[hidden email]>> 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: [hidden email]<mailto:[hidden email]> [[hidden email]<mailto:[hidden email]>] On Behalf Of Swindells, Thomas [[hidden email]<mailto:[hidden email]>]

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: [hidden email]<mailto:[hidden email]> [mailto:[hidden email]<mailto:[hidden email]>
> [hidden email]<mailto:[hidden email]>] On Behalf Of Abhay B. Chaware

> Sent: 09 June 2011 08:06

> To: [hidden email]<mailto:[hidden email]>

> 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

> [hidden email]<mailto:[hidden email]>

> 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 [hidden email]<mailto:[hidden email]> 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

[hidden email]<mailto:[hidden email]>

https://lists.jboss.org/mailman/listinfo/rules-users



_______________________________________________
rules-users mailing list

[hidden email]<mailto:[hidden email]>

 


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
[hidden email]
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
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Drools in non-eclipse environment

manstis
http://meteatamel.wordpress.com/2010/08/25/android-api-and-java-beans-package/

http://meteatamel.wordpress.com/2010/09/28/android-api-and-java-beans-package-2/

Enjoy the ride ;)

2011/6/9 Abhay B. Chaware <[hidden email]>

woo hooo ! I got past that problem J  But a new one’s here now.

 

Looks like MVEL is not liking something J 

 

 

 

W/dalvikvm(29977): VFY: unable to resolve static method 164: Ljava/beans/Introspector;.decapitalize (Ljava/lang/String;)Ljava/lang

/String;

W/dalvikvm(29977): threadid=1: thread exiting with uncaught exception (group=0x40020ac0)

E/AndroidRuntime(29977): FATAL EXCEPTION: main

E/AndroidRuntime(29977): java.lang.NoClassDefFoundError: java.beans.Introspector

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.calcFieldName(ClassFieldInspector.java:298)

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.addToMapping(ClassFieldInspector.java:216)

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.processClassWithoutByteCode(ClassFieldInspector.ja

va:148)

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.<init>(ClassFieldInspector.java:83)

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.<init>(ClassFieldInspector.java:64)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorFactory.getClassFieldReader(ClassFieldAccessorFactory.java:11

8)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorCache$CacheEntry.getReadAccessor(ClassFieldAccessorCache.java

:168)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorCache.getReadAcessor(ClassFieldAccessorCache.java:101)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorStore.wire(ClassFieldAccessorStore.java:404)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorStore.wire(ClassFieldAccessorStore.java:374)

E/AndroidRuntime(29977):        at org.drools.common.AbstractRuleBase.readExternal(AbstractRuleBase.java:295)

E/AndroidRuntime(29977):        at org.drools.reteoo.ReteooRuleBase.readExternal(ReteooRuleBase.java:236)

E/AndroidRuntime(29977):        at org.drools.impl.KnowledgeBaseImpl.readExternal(KnowledgeBaseImpl.java:108)

E/AndroidRuntime(29977):        at java.io.ObjectInputStream.readNewObject(ObjectInputStream.java:2127)

E/AndroidRuntime(29977):        at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:929)

E/AndroidRuntime(29977):        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2285)

E/AndroidRuntime(29977):        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2240)

E/AndroidRuntime(29977):        at com.ts.DBconnector.execPackageByPath(DBconnector.java:219)

E/AndroidRuntime(29977):        at com.first.FirstActivity.onCreate(FirstActivity.java:77)

E/AndroidRuntime(29977):        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)

E/AndroidRuntime(29977):        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)

E/AndroidRuntime(29977):        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)

E/AndroidRuntime(29977):        at android.app.ActivityThread.access$2300(ActivityThread.java:125)

E/AndroidRuntime(29977):        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)

E/AndroidRuntime(29977):        at android.os.Handler.dispatchMessage(Handler.java:99)

E/AndroidRuntime(29977):        at android.os.Looper.loop(Looper.java:123)

E/AndroidRuntime(29977):        at android.app.ActivityThread.main(ActivityThread.java:4627)

E/AndroidRuntime(29977):        at java.lang.reflect.Method.invokeNative(Native Method)

E/AndroidRuntime(29977):        at java.lang.reflect.Method.invoke(Method.java:521)

E/AndroidRuntime(29977):        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)

E/AndroidRuntime(29977):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)

E/AndroidRuntime(29977):        at dalvik.system.NativeStart.main(Native Method)

 

 

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Michael Anstis
Sent: Thursday, June 09, 2011 4:51 PM


To: Rules Users List
Subject: Re: [rules-users] Drools in non-eclipse environment

 

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 <[hidden email]>

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: [hidden email] [mailto:[hidden email]] 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 <[hidden email]> 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: [hidden email] [[hidden email]] On Behalf Of Wolfgang Laun [[hidden email]]
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 <[hidden email]<mailto:[hidden email]>> 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: [hidden email]<mailto:[hidden email]> [[hidden email]<mailto:[hidden email]>] On Behalf Of Swindells, Thomas [[hidden email]<mailto:[hidden email]>]

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: [hidden email]<mailto:[hidden email]> [mailto:[hidden email]<mailto:[hidden email]>
> [hidden email]<mailto:[hidden email]>] On Behalf Of Abhay B. Chaware

> Sent: 09 June 2011 08:06

> To: [hidden email]<mailto:[hidden email]>

> 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

> [hidden email]<mailto:[hidden email]>

> 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 [hidden email]<mailto:[hidden email]> 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

[hidden email]<mailto:[hidden email]>

https://lists.jboss.org/mailman/listinfo/rules-users



_______________________________________________
rules-users mailing list

[hidden email]<mailto:[hidden email]>

 


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
[hidden email]
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
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users



_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] Drools in non-eclipse environment

abhay_bc

The ride’s real fun J

 

Got apache harmony’s beans.jar to work .. now , when I am reading the serialized knowledgebase object on android, quite obvious, it is throwing this error –

 

java.lang.UnsupportedOperationException: can't load this type of class file

 

since my serialized knowledgebase object is in java format .. and not dex. Can this serialized version be converted into .dex format using the “dx” utility – pre or post serialization ? I tried the “dx” tool on the serialized object, but it doesn’t seem to understand the format.

 

-abhay

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Michael Anstis
Sent: Thursday, June 09, 2011 6:37 PM
To: Rules Users List
Subject: Re: [rules-users] Drools in non-eclipse environment

 

http://meteatamel.wordpress.com/2010/08/25/android-api-and-java-beans-package/

http://meteatamel.wordpress.com/2010/09/28/android-api-and-java-beans-package-2/

Enjoy the ride ;)

2011/6/9 Abhay B. Chaware <[hidden email]>

woo hooo ! I got past that problem J  But a new one’s here now.

 

Looks like MVEL is not liking something J 

 

 

 

W/dalvikvm(29977): VFY: unable to resolve static method 164: Ljava/beans/Introspector;.decapitalize (Ljava/lang/String;)Ljava/lang

/String;

W/dalvikvm(29977): threadid=1: thread exiting with uncaught exception (group=0x40020ac0)

E/AndroidRuntime(29977): FATAL EXCEPTION: main

E/AndroidRuntime(29977): java.lang.NoClassDefFoundError: java.beans.Introspector

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.calcFieldName(ClassFieldInspector.java:298)

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.addToMapping(ClassFieldInspector.java:216)

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.processClassWithoutByteCode(ClassFieldInspector.ja

va:148)

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.<init>(ClassFieldInspector.java:83)

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.<init>(ClassFieldInspector.java:64)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorFactory.getClassFieldReader(ClassFieldAccessorFactory.java:11

8)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorCache$CacheEntry.getReadAccessor(ClassFieldAccessorCache.java

:168)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorCache.getReadAcessor(ClassFieldAccessorCache.java:101)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorStore.wire(ClassFieldAccessorStore.java:404)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorStore.wire(ClassFieldAccessorStore.java:374)

E/AndroidRuntime(29977):        at org.drools.common.AbstractRuleBase.readExternal(AbstractRuleBase.java:295)

E/AndroidRuntime(29977):        at org.drools.reteoo.ReteooRuleBase.readExternal(ReteooRuleBase.java:236)

E/AndroidRuntime(29977):        at org.drools.impl.KnowledgeBaseImpl.readExternal(KnowledgeBaseImpl.java:108)

E/AndroidRuntime(29977):        at java.io.ObjectInputStream.readNewObject(ObjectInputStream.java:2127)

E/AndroidRuntime(29977):        at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:929)

E/AndroidRuntime(29977):        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2285)

E/AndroidRuntime(29977):        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2240)

E/AndroidRuntime(29977):        at com.ts.DBconnector.execPackageByPath(DBconnector.java:219)

E/AndroidRuntime(29977):        at com.first.FirstActivity.onCreate(FirstActivity.java:77)

E/AndroidRuntime(29977):        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)

E/AndroidRuntime(29977):        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)

E/AndroidRuntime(29977):        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)

E/AndroidRuntime(29977):        at android.app.ActivityThread.access$2300(ActivityThread.java:125)

E/AndroidRuntime(29977):        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)

E/AndroidRuntime(29977):        at android.os.Handler.dispatchMessage(Handler.java:99)

E/AndroidRuntime(29977):        at android.os.Looper.loop(Looper.java:123)

E/AndroidRuntime(29977):        at android.app.ActivityThread.main(ActivityThread.java:4627)

E/AndroidRuntime(29977):        at java.lang.reflect.Method.invokeNative(Native Method)

E/AndroidRuntime(29977):        at java.lang.reflect.Method.invoke(Method.java:521)

E/AndroidRuntime(29977):        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)

E/AndroidRuntime(29977):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)

E/AndroidRuntime(29977):        at dalvik.system.NativeStart.main(Native Method)

 

 

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Michael Anstis
Sent: Thursday, June 09, 2011 4:51 PM


To: Rules Users List
Subject: Re: [rules-users] Drools in non-eclipse environment

 

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 <[hidden email]>

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: [hidden email] [mailto:[hidden email]] 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 <[hidden email]> 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: [hidden email] [[hidden email]] On Behalf Of Wolfgang Laun [[hidden email]]
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 <[hidden email]<mailto:[hidden email]>> 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: [hidden email]<mailto:[hidden email]> [[hidden email]<mailto:[hidden email]>] On Behalf Of Swindells, Thomas [[hidden email]<mailto:[hidden email]>]

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: [hidden email]<mailto:[hidden email]> [mailto:[hidden email]<mailto:[hidden email]>
> [hidden email]<mailto:[hidden email]>] On Behalf Of Abhay B. Chaware

> Sent: 09 June 2011 08:06

> To: [hidden email]<mailto:[hidden email]>

> 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

> [hidden email]<mailto:[hidden email]>

> 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 [hidden email]<mailto:[hidden email]> 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

[hidden email]<mailto:[hidden email]>

https://lists.jboss.org/mailman/listinfo/rules-users



_______________________________________________
rules-users mailing list

[hidden email]<mailto:[hidden email]>

 


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
[hidden email]
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
[hidden email]
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
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|

[rules-users] FW: Drools in non-eclipse environment

abhay_bc
In reply to this post by abhay_bc

Any ideas folks ?


From: Abhay B. Chaware
Sent: Friday, June 10, 2011 12:54 PM
To: 'Rules Users List'
Subject: RE: [rules-users] Drools in non-eclipse environment

 

The ride’s real fun J

 

Got apache harmony’s beans.jar to work .. now , when I am reading the serialized knowledgebase object on android, quite obvious, it is throwing this error –

 

java.lang.UnsupportedOperationException: can't load this type of class file

 

since my serialized knowledgebase object is in java format .. and not dex. Can this serialized version be converted into .dex format using the “dx” utility – pre or post serialization ? I tried the “dx” tool on the serialized object, but it doesn’t seem to understand the format.

 

-abhay

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Michael Anstis
Sent: Thursday, June 09, 2011 6:37 PM
To: Rules Users List
Subject: Re: [rules-users] Drools in non-eclipse environment

 

http://meteatamel.wordpress.com/2010/08/25/android-api-and-java-beans-package/

http://meteatamel.wordpress.com/2010/09/28/android-api-and-java-beans-package-2/

Enjoy the ride ;)

2011/6/9 Abhay B. Chaware <[hidden email]>

woo hooo ! I got past that problem J  But a new one’s here now.

 

Looks like MVEL is not liking something J 

 

 

 

W/dalvikvm(29977): VFY: unable to resolve static method 164: Ljava/beans/Introspector;.decapitalize (Ljava/lang/String;)Ljava/lang

/String;

W/dalvikvm(29977): threadid=1: thread exiting with uncaught exception (group=0x40020ac0)

E/AndroidRuntime(29977): FATAL EXCEPTION: main

E/AndroidRuntime(29977): java.lang.NoClassDefFoundError: java.beans.Introspector

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.calcFieldName(ClassFieldInspector.java:298)

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.addToMapping(ClassFieldInspector.java:216)

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.processClassWithoutByteCode(ClassFieldInspector.ja

va:148)

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.<init>(ClassFieldInspector.java:83)

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.<init>(ClassFieldInspector.java:64)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorFactory.getClassFieldReader(ClassFieldAccessorFactory.java:11

8)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorCache$CacheEntry.getReadAccessor(ClassFieldAccessorCache.java

:168)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorCache.getReadAcessor(ClassFieldAccessorCache.java:101)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorStore.wire(ClassFieldAccessorStore.java:404)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorStore.wire(ClassFieldAccessorStore.java:374)

E/AndroidRuntime(29977):        at org.drools.common.AbstractRuleBase.readExternal(AbstractRuleBase.java:295)

E/AndroidRuntime(29977):        at org.drools.reteoo.ReteooRuleBase.readExternal(ReteooRuleBase.java:236)

E/AndroidRuntime(29977):        at org.drools.impl.KnowledgeBaseImpl.readExternal(KnowledgeBaseImpl.java:108)

E/AndroidRuntime(29977):        at java.io.ObjectInputStream.readNewObject(ObjectInputStream.java:2127)

E/AndroidRuntime(29977):        at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:929)

E/AndroidRuntime(29977):        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2285)

E/AndroidRuntime(29977):        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2240)

E/AndroidRuntime(29977):        at com.ts.DBconnector.execPackageByPath(DBconnector.java:219)

E/AndroidRuntime(29977):        at com.first.FirstActivity.onCreate(FirstActivity.java:77)

E/AndroidRuntime(29977):        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)

E/AndroidRuntime(29977):        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)

E/AndroidRuntime(29977):        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)

E/AndroidRuntime(29977):        at android.app.ActivityThread.access$2300(ActivityThread.java:125)

E/AndroidRuntime(29977):        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)

E/AndroidRuntime(29977):        at android.os.Handler.dispatchMessage(Handler.java:99)

E/AndroidRuntime(29977):        at android.os.Looper.loop(Looper.java:123)

E/AndroidRuntime(29977):        at android.app.ActivityThread.main(ActivityThread.java:4627)

E/AndroidRuntime(29977):        at java.lang.reflect.Method.invokeNative(Native Method)

E/AndroidRuntime(29977):        at java.lang.reflect.Method.invoke(Method.java:521)

E/AndroidRuntime(29977):        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)

E/AndroidRuntime(29977):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)

E/AndroidRuntime(29977):        at dalvik.system.NativeStart.main(Native Method)

 

 

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Michael Anstis
Sent: Thursday, June 09, 2011 4:51 PM


To: Rules Users List
Subject: Re: [rules-users] Drools in non-eclipse environment

 

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 <[hidden email]>

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: [hidden email] [mailto:[hidden email]] 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 <[hidden email]> 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: [hidden email] [[hidden email]] On Behalf Of Wolfgang Laun [[hidden email]]
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 <[hidden email]<mailto:[hidden email]>> 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: [hidden email]<mailto:[hidden email]> [[hidden email]<mailto:[hidden email]>] On Behalf Of Swindells, Thomas [[hidden email]<mailto:[hidden email]>]

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: [hidden email]<mailto:[hidden email]> [mailto:[hidden email]<mailto:[hidden email]>
> [hidden email]<mailto:[hidden email]>] On Behalf Of Abhay B. Chaware

> Sent: 09 June 2011 08:06

> To: [hidden email]<mailto:[hidden email]>

> 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

> [hidden email]<mailto:[hidden email]>

> 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 [hidden email]<mailto:[hidden email]> 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

[hidden email]<mailto:[hidden email]>

https://lists.jboss.org/mailman/listinfo/rules-users



_______________________________________________
rules-users mailing list

[hidden email]<mailto:[hidden email]>

 


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
[hidden email]
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
[hidden email]
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
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|

[rules-users] FW: Drools in non-eclipse environment

abhay_bc
In reply to this post by abhay_bc

I am have now managed to get past all the compiler errors for Drools on android .. ( I think ) J .

 

My app is failing ( crashing ) when run on android device. Looking at the log, appears to be a heap memory problem, can anyone see anything suspicious here in the android log, that may point to the drools code as suspect ?

 

 

I/DEBUG ( 1280): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG ( 1280): Build fingerprint: 'samsung/GT-I9003/GT-I9003/GT-I9003:2.2.1/FROYO/XXKB3:user/release-keys'
I/DEBUG ( 1280): pid: 11341, tid: 11341 >>> com.first <<<
I/DEBUG ( 1280): signal 11 (SIGSEGV), fault addr 0000004c
I/DEBUG ( 1280): r0 00000000 r1 4831de40 r2 00000000 r3 00000000
I/DEBUG ( 1280): r4 809a2400 r5 00240d00 r6 00000000 r7 0000cd28
I/DEBUG ( 1280): r8 80917040 r9 0000cd28 10 430cb970 fp bea15728
I/DEBUG ( 1280): ip 00000000 sp bea153a8 lr 809681f7 pc 8096809c cpsr 80000070
I/DEBUG ( 1280): d0 65643a64696f7262 d1 0065006400610075
I/DEBUG ( 1280): d2 4ba11af200000567 d3 000000004b815b67
I/DEBUG ( 1280): d4 0065007400730079 d5 00610050002e006d
I/DEBUG ( 1280): d6 006c004300680074 d7 3eaaaaab3f800000
I/DEBUG ( 1280): d8 0000000000000000 d9 0000000000000000
I/DEBUG ( 1280): d10 0000000000000000 d11 0000000000000000
I/DEBUG ( 1280): d12 0000000000000000 d13 0000000000000000
I/DEBUG ( 1280): d14 0000000000000000 d15 0000000000000000
I/DEBUG ( 1280): d16 ade4622100000000 d17 0064002f005b0072
I/DEBUG ( 1280): d18 002f006100740061 d19 002f007000700061
I/DEBUG ( 1280): d20 0073002e006b0069 d21 0065007400730079
I/DEBUG ( 1280): d22 00610050002e006d d23 006c004300680074
I/DEBUG ( 1280): d24 3ff0000000000000 d25 0000000000000000
I/DEBUG ( 1280): d26 0000000000000000 d27 0000000000000000
I/DEBUG ( 1280): d28 0000000000000000 d29 0000000000000000
I/DEBUG ( 1280): d30 0000000000000000 d31 0000000000000000
I/DEBUG ( 1280): scr 80000012
I/DEBUG ( 1280):
I/DEBUG ( 1280): #00 pc 0006809c /system/lib/libdvm.so
I/DEBUG ( 1280): #01 pc 000681f2 /system/lib/libdvm.so
I/DEBUG ( 1280): #02 pc 00068238 /system/lib/libdvm.so
I/DEBUG ( 1280): #03 pc 000690a6 /system/lib/libdvm.so
I/DEBUG ( 1280): #04 pc 00061a0c /system/lib/libdvm.so
I/DEBUG ( 1280): #05 pc 00063f1a /system/lib/libdvm.so
I/DEBUG ( 1280): #06 pc 0001bdd8 /system/lib/libdvm.so
I/DEBUG ( 1280): #07 pc 000227d4 /system/lib/libdvm.so
I/DEBUG ( 1280): #08 pc 00021674 /system/lib/libdvm.so
I/DEBUG ( 1280): #09 pc 0005c7d6 /system/lib/libdvm.so
I/DEBUG ( 1280): #10 pc 00064ef8 /system/lib/libdvm.so
I/DEBUG ( 1280): #11 pc 0001bdd8 /system/lib/libdvm.so
I/DEBUG ( 1280): #12 pc 000227d4 /system/lib/libdvm.so
I/DEBUG ( 1280): #13 pc 00021674 /system/lib/libdvm.so
I/DEBUG ( 1280): #14 pc 0005c614 /system/lib/libdvm.so
I/DEBUG ( 1280): #15 pc 00047cd6 /system/lib/libdvm.so
I/DEBUG ( 1280): #16 pc 000364b4 /system/lib/libandroid_runtime.so
I/DEBUG ( 1280): #17 pc 0003808c /system/lib/libandroid_runtime.so
I/DEBUG ( 1280): #18 pc 00008ca8 /system/bin/app_process
I/DEBUG ( 1280): #19 pc 0000d404 /system/lib/libc.so
I/DEBUG ( 1280):
I/DEBUG ( 1280): code around pc:
I/DEBUG ( 1280): 8096807c 0f02f1be 2500bfd8 b0054628 bf00bdf0
I/DEBUG ( 1280): 8096808c 0003a3c8 000003a0 fffc3f91 41f0e92d
I/DEBUG ( 1280): 8096809c 4d216cc3 4606a200 18ad460f d0384299
I/DEBUG ( 1280): 809680ac e078f8df 400ef855 208cf8d4 0014f112
I/DEBUG ( 1280): 809680bc eb0cf7ae c094f8d4 f1bc6a73 bf180100
I/DEBUG ( 1280):
I/DEBUG ( 1280): code around lr:
I/DEBUG ( 1280): 809681d4 461a9905 633e1820 fb12f7d9 46089902
I/DEBUG ( 1280): 809681e4 f7e84639 e004faa7 99044610 f7ff4616
I/DEBUG ( 1280): 809681f4 9803ff51 f7e82100 4628fa9d ed6af7ae
I/DEBUG ( 1280): 80968204 b0094630 bf00bdf0 0003a2c8 fffe46a4
I/DEBUG ( 1280): 80968214 ffff026e ffff1926 fffe2288 ffff194c
I/DEBUG ( 1280):
I/DEBUG ( 1280): stack:
I/DEBUG ( 1280): bea15368 430faf80 /dev/ashmem/dalvik-LinearAlloc (deleted)
I/DEBUG ( 1280): bea1536c 0000cd28 [heap]
I/DEBUG ( 1280): bea15370 bea153c4 [stack]
I/DEBUG ( 1280): bea15374 8095c61d /system/lib/libdvm.so
I/DEBUG ( 1280): bea15378 8099266e /system/lib/libdvm.so
I/DEBUG ( 1280): bea1537c 4831de40 /dev/ashmem/mspace/dalvik-heap/2 (deleted)
I/DEBUG ( 1280): bea15380 439121ed /system/framework/core.odex
I/DEBUG ( 1280): bea15384 00000000
I/DEBUG ( 1280): bea15388 bea15340 [stack]
I/DEBUG ( 1280): bea1538c 0000001f
I/DEBUG ( 1280): bea15390 80993d3a /system/lib/libdvm.so
I/DEBUG ( 1280): bea15394 809a2400 /system/lib/libdvm.so
I/DEBUG ( 1280): bea15398 00240d00 [heap]
I/DEBUG ( 1280): bea1539c 00000000
I/DEBUG ( 1280): bea153a0 df002777
I/DEBUG ( 1280): bea153a4 e3a070ad
I/DEBUG ( 1280): #00 bea153a8 809a2400 /system/lib/libdvm.so
I/DEBUG ( 1280): bea153ac 00240d00 [heap]
I/DEBUG ( 1280): bea153b0 00000000
I/DEBUG ( 1280): bea153b4 0000cd28 [heap]
I/DEBUG ( 1280): bea153b8 80917040 /system/lib/libdvm.so
I/DEBUG ( 1280): bea153bc 809681f7 /system/lib/libdvm.so
I/DEBUG ( 1280): #01 bea153c0 4867acc0 /dev/ashmem/mspace/dalvik-heap/2 (deleted)
I/DEBUG ( 1280): bea153c4 400092d0 /dev/ashmem/mspace/dalvik-heap/zygote/0 (deleted)
I/DEBUG ( 1280): bea153c8 00000000
I/DEBUG ( 1280): bea153cc 4867acc0 /dev/ashmem/mspace/dalvik-heap/2 (deleted)
I/DEBUG ( 1280): bea153d0 4831de40 /dev/ashmem/mspace/dalvik-heap/2 (deleted)
I/DEBUG ( 1280): bea153d4 00240ce8 [heap]
I/DEBUG ( 1280): bea153d8 00000000
I/DEBUG ( 1280): bea153dc ade46221 /system/lib/libicuuc.so
I/DEBUG ( 1280): bea153e0 00000001
I/DEBUG ( 1280): bea153e4 00240ce8 [heap]
I/DEBUG ( 1280): bea153e8 4831de40 /dev/ashmem/mspace/dalvik-heap/2 (deleted)
I/DEBUG ( 1280): bea153ec 809a2400 /system/lib/libdvm.so
I/DEBUG ( 1280): bea153f0 00240cd0 [heap]
I/DEBUG ( 1280): bea153f4 8096823d /system/lib/libdvm.so

 

 

-abhay

 


From: Abhay B. Chaware
Sent: Monday, June 13, 2011 9:43 AM
To: 'Rules Users List'
Subject: FW: [rules-users] Drools in non-eclipse environment

 

Any ideas folks ?


From: Abhay B. Chaware
Sent: Friday, June 10, 2011 12:54 PM
To: 'Rules Users List'
Subject: RE: [rules-users] Drools in non-eclipse environment

 

The ride’s real fun J

 

Got apache harmony’s beans.jar to work .. now , when I am reading the serialized knowledgebase object on android, quite obvious, it is throwing this error –

 

java.lang.UnsupportedOperationException: can't load this type of class file

 

since my serialized knowledgebase object is in java format .. and not dex. Can this serialized version be converted into .dex format using the “dx” utility – pre or post serialization ? I tried the “dx” tool on the serialized object, but it doesn’t seem to understand the format.

 

-abhay

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Michael Anstis
Sent: Thursday, June 09, 2011 6:37 PM
To: Rules Users List
Subject: Re: [rules-users] Drools in non-eclipse environment

 

http://meteatamel.wordpress.com/2010/08/25/android-api-and-java-beans-package/

http://meteatamel.wordpress.com/2010/09/28/android-api-and-java-beans-package-2/

Enjoy the ride ;)

2011/6/9 Abhay B. Chaware <[hidden email]>

woo hooo ! I got past that problem J  But a new one’s here now.

 

Looks like MVEL is not liking something J 

 

 

 

W/dalvikvm(29977): VFY: unable to resolve static method 164: Ljava/beans/Introspector;.decapitalize (Ljava/lang/String;)Ljava/lang

/String;

W/dalvikvm(29977): threadid=1: thread exiting with uncaught exception (group=0x40020ac0)

E/AndroidRuntime(29977): FATAL EXCEPTION: main

E/AndroidRuntime(29977): java.lang.NoClassDefFoundError: java.beans.Introspector

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.calcFieldName(ClassFieldInspector.java:298)

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.addToMapping(ClassFieldInspector.java:216)

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.processClassWithoutByteCode(ClassFieldInspector.ja

va:148)

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.<init>(ClassFieldInspector.java:83)

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.<init>(ClassFieldInspector.java:64)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorFactory.getClassFieldReader(ClassFieldAccessorFactory.java:11

8)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorCache$CacheEntry.getReadAccessor(ClassFieldAccessorCache.java

:168)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorCache.getReadAcessor(ClassFieldAccessorCache.java:101)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorStore.wire(ClassFieldAccessorStore.java:404)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorStore.wire(ClassFieldAccessorStore.java:374)

E/AndroidRuntime(29977):        at org.drools.common.AbstractRuleBase.readExternal(AbstractRuleBase.java:295)

E/AndroidRuntime(29977):        at org.drools.reteoo.ReteooRuleBase.readExternal(ReteooRuleBase.java:236)

E/AndroidRuntime(29977):        at org.drools.impl.KnowledgeBaseImpl.readExternal(KnowledgeBaseImpl.java:108)

E/AndroidRuntime(29977):        at java.io.ObjectInputStream.readNewObject(ObjectInputStream.java:2127)

E/AndroidRuntime(29977):        at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:929)

E/AndroidRuntime(29977):        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2285)

E/AndroidRuntime(29977):        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2240)

E/AndroidRuntime(29977):        at com.ts.DBconnector.execPackageByPath(DBconnector.java:219)

E/AndroidRuntime(29977):        at com.first.FirstActivity.onCreate(FirstActivity.java:77)

E/AndroidRuntime(29977):        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)

E/AndroidRuntime(29977):        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)

E/AndroidRuntime(29977):        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)

E/AndroidRuntime(29977):        at android.app.ActivityThread.access$2300(ActivityThread.java:125)

E/AndroidRuntime(29977):        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)

E/AndroidRuntime(29977):        at android.os.Handler.dispatchMessage(Handler.java:99)

E/AndroidRuntime(29977):        at android.os.Looper.loop(Looper.java:123)

E/AndroidRuntime(29977):        at android.app.ActivityThread.main(ActivityThread.java:4627)

E/AndroidRuntime(29977):        at java.lang.reflect.Method.invokeNative(Native Method)

E/AndroidRuntime(29977):        at java.lang.reflect.Method.invoke(Method.java:521)

E/AndroidRuntime(29977):        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)

E/AndroidRuntime(29977):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)

E/AndroidRuntime(29977):        at dalvik.system.NativeStart.main(Native Method)

 

 

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Michael Anstis
Sent: Thursday, June 09, 2011 4:51 PM


To: Rules Users List
Subject: Re: [rules-users] Drools in non-eclipse environment

 

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 <[hidden email]>

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: [hidden email] [mailto:[hidden email]] 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 <[hidden email]> 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: [hidden email] [[hidden email]] On Behalf Of Wolfgang Laun [[hidden email]]
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 <[hidden email]<mailto:[hidden email]>> 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: [hidden email]<mailto:[hidden email]> [[hidden email]<mailto:[hidden email]>] On Behalf Of Swindells, Thomas [[hidden email]<mailto:[hidden email]>]

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: [hidden email]<mailto:[hidden email]> [mailto:[hidden email]<mailto:[hidden email]>
> [hidden email]<mailto:[hidden email]>] On Behalf Of Abhay B. Chaware

> Sent: 09 June 2011 08:06

> To: [hidden email]<mailto:[hidden email]>

> 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

> [hidden email]<mailto:[hidden email]>

> 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 [hidden email]<mailto:[hidden email]> 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

[hidden email]<mailto:[hidden email]>

https://lists.jboss.org/mailman/listinfo/rules-users



_______________________________________________
rules-users mailing list

[hidden email]<mailto:[hidden email]>

 


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
[hidden email]
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
[hidden email]
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
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] FW: Drools in non-eclipse environment

manstis
Congratulations Abhay!

When does your application crash? e.g. building package, inserting facts, firing all rules?


I'm not sure how much help I can be, but your advice might help others.

Unfortunately I'm not able to analyse the Android log :(

Cheers,

Mike

2011/6/16 Abhay B. Chaware <[hidden email]>

I am have now managed to get past all the compiler errors for Drools on android .. ( I think ) J .

 

My app is failing ( crashing ) when run on android device. Looking at the log, appears to be a heap memory problem, can anyone see anything suspicious here in the android log, that may point to the drools code as suspect ?

 

 

I/DEBUG ( 1280): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG ( 1280): Build fingerprint: 'samsung/GT-I9003/GT-I9003/GT-I9003:2.2.1/FROYO/XXKB3:user/release-keys'
I/DEBUG ( 1280): pid: 11341, tid: 11341 >>> com.first <<<
I/DEBUG ( 1280): signal 11 (SIGSEGV), fault addr 0000004c
I/DEBUG ( 1280): r0 00000000 r1 4831de40 r2 00000000 r3 00000000
I/DEBUG ( 1280): r4 809a2400 r5 00240d00 r6 00000000 r7 0000cd28
I/DEBUG ( 1280): r8 80917040 r9 0000cd28 10 430cb970 fp bea15728
I/DEBUG ( 1280): ip 00000000 sp bea153a8 lr 809681f7 pc 8096809c cpsr 80000070
I/DEBUG ( 1280): d0 65643a64696f7262 d1 0065006400610075
I/DEBUG ( 1280): d2 4ba11af200000567 d3 000000004b815b67
I/DEBUG ( 1280): d4 0065007400730079 d5 00610050002e006d
I/DEBUG ( 1280): d6 006c004300680074 d7 3eaaaaab3f800000
I/DEBUG ( 1280): d8 0000000000000000 d9 0000000000000000
I/DEBUG ( 1280): d10 0000000000000000 d11 0000000000000000
I/DEBUG ( 1280): d12 0000000000000000 d13 0000000000000000
I/DEBUG ( 1280): d14 0000000000000000 d15 0000000000000000
I/DEBUG ( 1280): d16 ade4622100000000 d17 0064002f005b0072
I/DEBUG ( 1280): d18 002f006100740061 d19 002f007000700061
I/DEBUG ( 1280): d20 0073002e006b0069 d21 0065007400730079
I/DEBUG ( 1280): d22 00610050002e006d d23 006c004300680074
I/DEBUG ( 1280): d24 3ff0000000000000 d25 0000000000000000
I/DEBUG ( 1280): d26 0000000000000000 d27 0000000000000000
I/DEBUG ( 1280): d28 0000000000000000 d29 0000000000000000
I/DEBUG ( 1280): d30 0000000000000000 d31 0000000000000000
I/DEBUG ( 1280): scr 80000012
I/DEBUG ( 1280):
I/DEBUG ( 1280): #00 pc 0006809c /system/lib/libdvm.so
I/DEBUG ( 1280): #01 pc 000681f2 /system/lib/libdvm.so
I/DEBUG ( 1280): #02 pc 00068238 /system/lib/libdvm.so
I/DEBUG ( 1280): #03 pc 000690a6 /system/lib/libdvm.so
I/DEBUG ( 1280): #04 pc 00061a0c /system/lib/libdvm.so
I/DEBUG ( 1280): #05 pc 00063f1a /system/lib/libdvm.so
I/DEBUG ( 1280): #06 pc 0001bdd8 /system/lib/libdvm.so
I/DEBUG ( 1280): #07 pc 000227d4 /system/lib/libdvm.so
I/DEBUG ( 1280): #08 pc 00021674 /system/lib/libdvm.so
I/DEBUG ( 1280): #09 pc 0005c7d6 /system/lib/libdvm.so
I/DEBUG ( 1280): #10 pc 00064ef8 /system/lib/libdvm.so
I/DEBUG ( 1280): #11 pc 0001bdd8 /system/lib/libdvm.so
I/DEBUG ( 1280): #12 pc 000227d4 /system/lib/libdvm.so
I/DEBUG ( 1280): #13 pc 00021674 /system/lib/libdvm.so
I/DEBUG ( 1280): #14 pc 0005c614 /system/lib/libdvm.so
I/DEBUG ( 1280): #15 pc 00047cd6 /system/lib/libdvm.so
I/DEBUG ( 1280): #16 pc 000364b4 /system/lib/libandroid_runtime.so
I/DEBUG ( 1280): #17 pc 0003808c /system/lib/libandroid_runtime.so
I/DEBUG ( 1280): #18 pc 00008ca8 /system/bin/app_process
I/DEBUG ( 1280): #19 pc 0000d404 /system/lib/libc.so
I/DEBUG ( 1280):
I/DEBUG ( 1280): code around pc:
I/DEBUG ( 1280): 8096807c 0f02f1be 2500bfd8 b0054628 bf00bdf0
I/DEBUG ( 1280): 8096808c 0003a3c8 000003a0 fffc3f91 41f0e92d
I/DEBUG ( 1280): 8096809c 4d216cc3 4606a200 18ad460f d0384299
I/DEBUG ( 1280): 809680ac e078f8df 400ef855 208cf8d4 0014f112
I/DEBUG ( 1280): 809680bc eb0cf7ae c094f8d4 f1bc6a73 bf180100
I/DEBUG ( 1280):
I/DEBUG ( 1280): code around lr:
I/DEBUG ( 1280): 809681d4 461a9905 633e1820 fb12f7d9 46089902
I/DEBUG ( 1280): 809681e4 f7e84639 e004faa7 99044610 f7ff4616
I/DEBUG ( 1280): 809681f4 9803ff51 f7e82100 4628fa9d ed6af7ae
I/DEBUG ( 1280): 80968204 b0094630 bf00bdf0 0003a2c8 fffe46a4
I/DEBUG ( 1280): 80968214 ffff026e ffff1926 fffe2288 ffff194c
I/DEBUG ( 1280):
I/DEBUG ( 1280): stack:
I/DEBUG ( 1280): bea15368 430faf80 /dev/ashmem/dalvik-LinearAlloc (deleted)
I/DEBUG ( 1280): bea1536c 0000cd28 [heap]
I/DEBUG ( 1280): bea15370 bea153c4 [stack]
I/DEBUG ( 1280): bea15374 8095c61d /system/lib/libdvm.so
I/DEBUG ( 1280): bea15378 8099266e /system/lib/libdvm.so
I/DEBUG ( 1280): bea1537c 4831de40 /dev/ashmem/mspace/dalvik-heap/2 (deleted)
I/DEBUG ( 1280): bea15380 439121ed /system/framework/core.odex
I/DEBUG ( 1280): bea15384 00000000
I/DEBUG ( 1280): bea15388 bea15340 [stack]
I/DEBUG ( 1280): bea1538c 0000001f
I/DEBUG ( 1280): bea15390 80993d3a /system/lib/libdvm.so
I/DEBUG ( 1280): bea15394 809a2400 /system/lib/libdvm.so
I/DEBUG ( 1280): bea15398 00240d00 [heap]
I/DEBUG ( 1280): bea1539c 00000000
I/DEBUG ( 1280): bea153a0 df002777
I/DEBUG ( 1280): bea153a4 e3a070ad
I/DEBUG ( 1280): #00 bea153a8 809a2400 /system/lib/libdvm.so
I/DEBUG ( 1280): bea153ac 00240d00 [heap]
I/DEBUG ( 1280): bea153b0 00000000
I/DEBUG ( 1280): bea153b4 0000cd28 [heap]
I/DEBUG ( 1280): bea153b8 80917040 /system/lib/libdvm.so
I/DEBUG ( 1280): bea153bc 809681f7 /system/lib/libdvm.so
I/DEBUG ( 1280): #01 bea153c0 4867acc0 /dev/ashmem/mspace/dalvik-heap/2 (deleted)
I/DEBUG ( 1280): bea153c4 400092d0 /dev/ashmem/mspace/dalvik-heap/zygote/0 (deleted)
I/DEBUG ( 1280): bea153c8 00000000
I/DEBUG ( 1280): bea153cc 4867acc0 /dev/ashmem/mspace/dalvik-heap/2 (deleted)
I/DEBUG ( 1280): bea153d0 4831de40 /dev/ashmem/mspace/dalvik-heap/2 (deleted)
I/DEBUG ( 1280): bea153d4 00240ce8 [heap]
I/DEBUG ( 1280): bea153d8 00000000
I/DEBUG ( 1280): bea153dc ade46221 /system/lib/libicuuc.so
I/DEBUG ( 1280): bea153e0 00000001
I/DEBUG ( 1280): bea153e4 00240ce8 [heap]
I/DEBUG ( 1280): bea153e8 4831de40 /dev/ashmem/mspace/dalvik-heap/2 (deleted)
I/DEBUG ( 1280): bea153ec 809a2400 /system/lib/libdvm.so
I/DEBUG ( 1280): bea153f0 00240cd0 [heap]
I/DEBUG ( 1280): bea153f4 8096823d /system/lib/libdvm.so

 

 

-abhay

 


From: Abhay B. Chaware
Sent: Monday, June 13, 2011 9:43 AM
To: 'Rules Users List'
Subject: FW: [rules-users] Drools in non-eclipse environment

 

Any ideas folks ?


From: Abhay B. Chaware
Sent: Friday, June 10, 2011 12:54 PM
To: 'Rules Users List'
Subject: RE: [rules-users] Drools in non-eclipse environment

 

The ride’s real fun J

 

Got apache harmony’s beans.jar to work .. now , when I am reading the serialized knowledgebase object on android, quite obvious, it is throwing this error –

 

java.lang.UnsupportedOperationException: can't load this type of class file

 

since my serialized knowledgebase object is in java format .. and not dex. Can this serialized version be converted into .dex format using the “dx” utility – pre or post serialization ? I tried the “dx” tool on the serialized object, but it doesn’t seem to understand the format.

 

-abhay

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Michael Anstis
Sent: Thursday, June 09, 2011 6:37 PM
To: Rules Users List
Subject: Re: [rules-users] Drools in non-eclipse environment

 

http://meteatamel.wordpress.com/2010/08/25/android-api-and-java-beans-package/

http://meteatamel.wordpress.com/2010/09/28/android-api-and-java-beans-package-2/

Enjoy the ride ;)

2011/6/9 Abhay B. Chaware <[hidden email]>

woo hooo ! I got past that problem J  But a new one’s here now.

 

Looks like MVEL is not liking something J 

 

 

 

W/dalvikvm(29977): VFY: unable to resolve static method 164: Ljava/beans/Introspector;.decapitalize (Ljava/lang/String;)Ljava/lang

/String;

W/dalvikvm(29977): threadid=1: thread exiting with uncaught exception (group=0x40020ac0)

E/AndroidRuntime(29977): FATAL EXCEPTION: main

E/AndroidRuntime(29977): java.lang.NoClassDefFoundError: java.beans.Introspector

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.calcFieldName(ClassFieldInspector.java:298)

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.addToMapping(ClassFieldInspector.java:216)

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.processClassWithoutByteCode(ClassFieldInspector.ja

va:148)

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.<init>(ClassFieldInspector.java:83)

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.<init>(ClassFieldInspector.java:64)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorFactory.getClassFieldReader(ClassFieldAccessorFactory.java:11

8)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorCache$CacheEntry.getReadAccessor(ClassFieldAccessorCache.java

:168)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorCache.getReadAcessor(ClassFieldAccessorCache.java:101)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorStore.wire(ClassFieldAccessorStore.java:404)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorStore.wire(ClassFieldAccessorStore.java:374)

E/AndroidRuntime(29977):        at org.drools.common.AbstractRuleBase.readExternal(AbstractRuleBase.java:295)

E/AndroidRuntime(29977):        at org.drools.reteoo.ReteooRuleBase.readExternal(ReteooRuleBase.java:236)

E/AndroidRuntime(29977):        at org.drools.impl.KnowledgeBaseImpl.readExternal(KnowledgeBaseImpl.java:108)

E/AndroidRuntime(29977):        at java.io.ObjectInputStream.readNewObject(ObjectInputStream.java:2127)

E/AndroidRuntime(29977):        at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:929)

E/AndroidRuntime(29977):        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2285)

E/AndroidRuntime(29977):        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2240)

E/AndroidRuntime(29977):        at com.ts.DBconnector.execPackageByPath(DBconnector.java:219)

E/AndroidRuntime(29977):        at com.first.FirstActivity.onCreate(FirstActivity.java:77)

E/AndroidRuntime(29977):        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)

E/AndroidRuntime(29977):        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)

E/AndroidRuntime(29977):        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)

E/AndroidRuntime(29977):        at android.app.ActivityThread.access$2300(ActivityThread.java:125)

E/AndroidRuntime(29977):        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)

E/AndroidRuntime(29977):        at android.os.Handler.dispatchMessage(Handler.java:99)

E/AndroidRuntime(29977):        at android.os.Looper.loop(Looper.java:123)

E/AndroidRuntime(29977):        at android.app.ActivityThread.main(ActivityThread.java:4627)

E/AndroidRuntime(29977):        at java.lang.reflect.Method.invokeNative(Native Method)

E/AndroidRuntime(29977):        at java.lang.reflect.Method.invoke(Method.java:521)

E/AndroidRuntime(29977):        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)

E/AndroidRuntime(29977):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)

E/AndroidRuntime(29977):        at dalvik.system.NativeStart.main(Native Method)

 

 

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Michael Anstis
Sent: Thursday, June 09, 2011 4:51 PM


To: Rules Users List
Subject: Re: [rules-users] Drools in non-eclipse environment

 

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 <[hidden email]>

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: [hidden email] [mailto:[hidden email]] 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 <[hidden email]> 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: [hidden email] [[hidden email]] On Behalf Of Wolfgang Laun [[hidden email]]
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 <[hidden email]<mailto:[hidden email]>> 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: [hidden email]<mailto:[hidden email]> [[hidden email]<mailto:[hidden email]>] On Behalf Of Swindells, Thomas [[hidden email]<mailto:[hidden email]>]

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: [hidden email]<mailto:[hidden email]> [mailto:[hidden email]<mailto:[hidden email]>
> [hidden email]<mailto:[hidden email]>] On Behalf Of Abhay B. Chaware

> Sent: 09 June 2011 08:06

> To: [hidden email]<mailto:[hidden email]>

> 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

> [hidden email]<mailto:[hidden email]>

> 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 [hidden email]<mailto:[hidden email]> 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

[hidden email]<mailto:[hidden email]>

https://lists.jboss.org/mailman/listinfo/rules-users



_______________________________________________
rules-users mailing list

[hidden email]<mailto:[hidden email]>

 


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
[hidden email]
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
[hidden email]
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
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users



_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] FW: Drools in non-eclipse environment

abhay_bc

Thanks Mike !

It is failing after few seconds ( about 30-35 secs ) after I get the “Creating Package Builder ..” line on the console …I am not getting the next debug statement, but getting the exception instead. I am seeing a lot of garbage collection calls right after “Creating Package Builder …” line in the console before crashing, which tells me that the issue is probably related to heap/memory.

Here’s the snippet from my code.

                        System.out.println (“Creating Package Builder .. ”);

                        PackageBuilder builder = new PackageBuilder( cfg0 );

                        builder.addPackageFromDrl(new InputStreamReader(is)); // “is” is input stream for drl file

                        RuleBase ruleBase  = RuleBaseFactory.newRuleBase();

                        ruleBase.addPackage( builder.getPackage() ); 

                        System.out.println (“Package added to rule base.. ”);

-abhay


From: [hidden email] [mailto:[hidden email]] On Behalf Of Michael Anstis
Sent: Thursday, June 16, 2011 6:17 PM
To: Rules Users List
Subject: Re: [rules-users] FW: Drools in non-eclipse environment

 

Congratulations Abhay!

When does your application crash? e.g. building package, inserting facts, firing all rules?


I'm not sure how much help I can be, but your advice might help others.

Unfortunately I'm not able to analyse the Android log :(

Cheers,

Mike

2011/6/16 Abhay B. Chaware <[hidden email]>

I am have now managed to get past all the compiler errors for Drools on android .. ( I think ) J .

 

My app is failing ( crashing ) when run on android device. Looking at the log, appears to be a heap memory problem, can anyone see anything suspicious here in the android log, that may point to the drools code as suspect ?

 

 

I/DEBUG ( 1280): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG ( 1280): Build fingerprint: 'samsung/GT-I9003/GT-I9003/GT-I9003:2.2.1/FROYO/XXKB3:user/release-keys'
I/DEBUG ( 1280): pid: 11341, tid: 11341 >>> com.first <<<
I/DEBUG ( 1280): signal 11 (SIGSEGV), fault addr 0000004c
I/DEBUG ( 1280): r0 00000000 r1 4831de40 r2 00000000 r3 00000000
I/DEBUG ( 1280): r4 809a2400 r5 00240d00 r6 00000000 r7 0000cd28
I/DEBUG ( 1280): r8 80917040 r9 0000cd28 10 430cb970 fp bea15728
I/DEBUG ( 1280): ip 00000000 sp bea153a8 lr 809681f7 pc 8096809c cpsr 80000070
I/DEBUG ( 1280): d0 65643a64696f7262 d1 0065006400610075
I/DEBUG ( 1280): d2 4ba11af200000567 d3 000000004b815b67
I/DEBUG ( 1280): d4 0065007400730079 d5 00610050002e006d
I/DEBUG ( 1280): d6 006c004300680074 d7 3eaaaaab3f800000
I/DEBUG ( 1280): d8 0000000000000000 d9 0000000000000000
I/DEBUG ( 1280): d10 0000000000000000 d11 0000000000000000
I/DEBUG ( 1280): d12 0000000000000000 d13 0000000000000000
I/DEBUG ( 1280): d14 0000000000000000 d15 0000000000000000
I/DEBUG ( 1280): d16 ade4622100000000 d17 0064002f005b0072
I/DEBUG ( 1280): d18 002f006100740061 d19 002f007000700061
I/DEBUG ( 1280): d20 0073002e006b0069 d21 0065007400730079
I/DEBUG ( 1280): d22 00610050002e006d d23 006c004300680074
I/DEBUG ( 1280): d24 3ff0000000000000 d25 0000000000000000
I/DEBUG ( 1280): d26 0000000000000000 d27 0000000000000000
I/DEBUG ( 1280): d28 0000000000000000 d29 0000000000000000
I/DEBUG ( 1280): d30 0000000000000000 d31 0000000000000000
I/DEBUG ( 1280): scr 80000012
I/DEBUG ( 1280):
I/DEBUG ( 1280): #00 pc 0006809c /system/lib/libdvm.so
I/DEBUG ( 1280): #01 pc 000681f2 /system/lib/libdvm.so
I/DEBUG ( 1280): #02 pc 00068238 /system/lib/libdvm.so
I/DEBUG ( 1280): #03 pc 000690a6 /system/lib/libdvm.so
I/DEBUG ( 1280): #04 pc 00061a0c /system/lib/libdvm.so
I/DEBUG ( 1280): #05 pc 00063f1a /system/lib/libdvm.so
I/DEBUG ( 1280): #06 pc 0001bdd8 /system/lib/libdvm.so
I/DEBUG ( 1280): #07 pc 000227d4 /system/lib/libdvm.so
I/DEBUG ( 1280): #08 pc 00021674 /system/lib/libdvm.so
I/DEBUG ( 1280): #09 pc 0005c7d6 /system/lib/libdvm.so
I/DEBUG ( 1280): #10 pc 00064ef8 /system/lib/libdvm.so
I/DEBUG ( 1280): #11 pc 0001bdd8 /system/lib/libdvm.so
I/DEBUG ( 1280): #12 pc 000227d4 /system/lib/libdvm.so
I/DEBUG ( 1280): #13 pc 00021674 /system/lib/libdvm.so
I/DEBUG ( 1280): #14 pc 0005c614 /system/lib/libdvm.so
I/DEBUG ( 1280): #15 pc 00047cd6 /system/lib/libdvm.so
I/DEBUG ( 1280): #16 pc 000364b4 /system/lib/libandroid_runtime.so
I/DEBUG ( 1280): #17 pc 0003808c /system/lib/libandroid_runtime.so
I/DEBUG ( 1280): #18 pc 00008ca8 /system/bin/app_process
I/DEBUG ( 1280): #19 pc 0000d404 /system/lib/libc.so
I/DEBUG ( 1280):
I/DEBUG ( 1280): code around pc:
I/DEBUG ( 1280): 8096807c 0f02f1be 2500bfd8 b0054628 bf00bdf0
I/DEBUG ( 1280): 8096808c 0003a3c8 000003a0 fffc3f91 41f0e92d
I/DEBUG ( 1280): 8096809c 4d216cc3 4606a200 18ad460f d0384299
I/DEBUG ( 1280): 809680ac e078f8df 400ef855 208cf8d4 0014f112
I/DEBUG ( 1280): 809680bc eb0cf7ae c094f8d4 f1bc6a73 bf180100
I/DEBUG ( 1280):
I/DEBUG ( 1280): code around lr:
I/DEBUG ( 1280): 809681d4 461a9905 633e1820 fb12f7d9 46089902
I/DEBUG ( 1280): 809681e4 f7e84639 e004faa7 99044610 f7ff4616
I/DEBUG ( 1280): 809681f4 9803ff51 f7e82100 4628fa9d ed6af7ae
I/DEBUG ( 1280): 80968204 b0094630 bf00bdf0 0003a2c8 fffe46a4
I/DEBUG ( 1280): 80968214 ffff026e ffff1926 fffe2288 ffff194c
I/DEBUG ( 1280):
I/DEBUG ( 1280): stack:
I/DEBUG ( 1280): bea15368 430faf80 /dev/ashmem/dalvik-LinearAlloc (deleted)
I/DEBUG ( 1280): bea1536c 0000cd28 [heap]
I/DEBUG ( 1280): bea15370 bea153c4 [stack]
I/DEBUG ( 1280): bea15374 8095c61d /system/lib/libdvm.so
I/DEBUG ( 1280): bea15378 8099266e /system/lib/libdvm.so
I/DEBUG ( 1280): bea1537c 4831de40 /dev/ashmem/mspace/dalvik-heap/2 (deleted)
I/DEBUG ( 1280): bea15380 439121ed /system/framework/core.odex
I/DEBUG ( 1280): bea15384 00000000
I/DEBUG ( 1280): bea15388 bea15340 [stack]
I/DEBUG ( 1280): bea1538c 0000001f
I/DEBUG ( 1280): bea15390 80993d3a /system/lib/libdvm.so
I/DEBUG ( 1280): bea15394 809a2400 /system/lib/libdvm.so
I/DEBUG ( 1280): bea15398 00240d00 [heap]
I/DEBUG ( 1280): bea1539c 00000000
I/DEBUG ( 1280): bea153a0 df002777
I/DEBUG ( 1280): bea153a4 e3a070ad
I/DEBUG ( 1280): #00 bea153a8 809a2400 /system/lib/libdvm.so
I/DEBUG ( 1280): bea153ac 00240d00 [heap]
I/DEBUG ( 1280): bea153b0 00000000
I/DEBUG ( 1280): bea153b4 0000cd28 [heap]
I/DEBUG ( 1280): bea153b8 80917040 /system/lib/libdvm.so
I/DEBUG ( 1280): bea153bc 809681f7 /system/lib/libdvm.so
I/DEBUG ( 1280): #01 bea153c0 4867acc0 /dev/ashmem/mspace/dalvik-heap/2 (deleted)
I/DEBUG ( 1280): bea153c4 400092d0 /dev/ashmem/mspace/dalvik-heap/zygote/0 (deleted)
I/DEBUG ( 1280): bea153c8 00000000
I/DEBUG ( 1280): bea153cc 4867acc0 /dev/ashmem/mspace/dalvik-heap/2 (deleted)
I/DEBUG ( 1280): bea153d0 4831de40 /dev/ashmem/mspace/dalvik-heap/2 (deleted)
I/DEBUG ( 1280): bea153d4 00240ce8 [heap]
I/DEBUG ( 1280): bea153d8 00000000
I/DEBUG ( 1280): bea153dc ade46221 /system/lib/libicuuc.so
I/DEBUG ( 1280): bea153e0 00000001
I/DEBUG ( 1280): bea153e4 00240ce8 [heap]
I/DEBUG ( 1280): bea153e8 4831de40 /dev/ashmem/mspace/dalvik-heap/2 (deleted)
I/DEBUG ( 1280): bea153ec 809a2400 /system/lib/libdvm.so
I/DEBUG ( 1280): bea153f0 00240cd0 [heap]
I/DEBUG ( 1280): bea153f4 8096823d /system/lib/libdvm.so

 

 

-abhay

 


From: Abhay B. Chaware
Sent: Monday, June 13, 2011 9:43 AM
To: 'Rules Users List'
Subject: FW: [rules-users] Drools in non-eclipse environment

 

Any ideas folks ?


From: Abhay B. Chaware
Sent: Friday, June 10, 2011 12:54 PM
To: 'Rules Users List'
Subject: RE: [rules-users] Drools in non-eclipse environment

 

The ride’s real fun J

 

Got apache harmony’s beans.jar to work .. now , when I am reading the serialized knowledgebase object on android, quite obvious, it is throwing this error –

 

java.lang.UnsupportedOperationException: can't load this type of class file

 

since my serialized knowledgebase object is in java format .. and not dex. Can this serialized version be converted into .dex format using the “dx” utility – pre or post serialization ? I tried the “dx” tool on the serialized object, but it doesn’t seem to understand the format.

 

-abhay

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Michael Anstis
Sent: Thursday, June 09, 2011 6:37 PM
To: Rules Users List
Subject: Re: [rules-users] Drools in non-eclipse environment

 

http://meteatamel.wordpress.com/2010/08/25/android-api-and-java-beans-package/

http://meteatamel.wordpress.com/2010/09/28/android-api-and-java-beans-package-2/

Enjoy the ride ;)

2011/6/9 Abhay B. Chaware <[hidden email]>

woo hooo ! I got past that problem J  But a new one’s here now.

 

Looks like MVEL is not liking something J 

 

 

 

W/dalvikvm(29977): VFY: unable to resolve static method 164: Ljava/beans/Introspector;.decapitalize (Ljava/lang/String;)Ljava/lang

/String;

W/dalvikvm(29977): threadid=1: thread exiting with uncaught exception (group=0x40020ac0)

E/AndroidRuntime(29977): FATAL EXCEPTION: main

E/AndroidRuntime(29977): java.lang.NoClassDefFoundError: java.beans.Introspector

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.calcFieldName(ClassFieldInspector.java:298)

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.addToMapping(ClassFieldInspector.java:216)

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.processClassWithoutByteCode(ClassFieldInspector.ja

va:148)

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.<init>(ClassFieldInspector.java:83)

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.<init>(ClassFieldInspector.java:64)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorFactory.getClassFieldReader(ClassFieldAccessorFactory.java:11

8)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorCache$CacheEntry.getReadAccessor(ClassFieldAccessorCache.java

:168)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorCache.getReadAcessor(ClassFieldAccessorCache.java:101)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorStore.wire(ClassFieldAccessorStore.java:404)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorStore.wire(ClassFieldAccessorStore.java:374)

E/AndroidRuntime(29977):        at org.drools.common.AbstractRuleBase.readExternal(AbstractRuleBase.java:295)

E/AndroidRuntime(29977):        at org.drools.reteoo.ReteooRuleBase.readExternal(ReteooRuleBase.java:236)

E/AndroidRuntime(29977):        at org.drools.impl.KnowledgeBaseImpl.readExternal(KnowledgeBaseImpl.java:108)

E/AndroidRuntime(29977):        at java.io.ObjectInputStream.readNewObject(ObjectInputStream.java:2127)

E/AndroidRuntime(29977):        at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:929)

E/AndroidRuntime(29977):        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2285)

E/AndroidRuntime(29977):        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2240)

E/AndroidRuntime(29977):        at com.ts.DBconnector.execPackageByPath(DBconnector.java:219)

E/AndroidRuntime(29977):        at com.first.FirstActivity.onCreate(FirstActivity.java:77)

E/AndroidRuntime(29977):        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)

E/AndroidRuntime(29977):        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)

E/AndroidRuntime(29977):        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)

E/AndroidRuntime(29977):        at android.app.ActivityThread.access$2300(ActivityThread.java:125)

E/AndroidRuntime(29977):        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)

E/AndroidRuntime(29977):        at android.os.Handler.dispatchMessage(Handler.java:99)

E/AndroidRuntime(29977):        at android.os.Looper.loop(Looper.java:123)

E/AndroidRuntime(29977):        at android.app.ActivityThread.main(ActivityThread.java:4627)

E/AndroidRuntime(29977):        at java.lang.reflect.Method.invokeNative(Native Method)

E/AndroidRuntime(29977):        at java.lang.reflect.Method.invoke(Method.java:521)

E/AndroidRuntime(29977):        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)

E/AndroidRuntime(29977):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)

E/AndroidRuntime(29977):        at dalvik.system.NativeStart.main(Native Method)

 

 

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Michael Anstis
Sent: Thursday, June 09, 2011 4:51 PM


To: Rules Users List
Subject: Re: [rules-users] Drools in non-eclipse environment

 

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 <[hidden email]>

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: [hidden email] [mailto:[hidden email]] 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 <[hidden email]> 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: [hidden email] [[hidden email]] On Behalf Of Wolfgang Laun [[hidden email]]
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 <[hidden email]<mailto:[hidden email]>> 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: [hidden email]<mailto:[hidden email]> [[hidden email]<mailto:[hidden email]>] On Behalf Of Swindells, Thomas [[hidden email]<mailto:[hidden email]>]

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: [hidden email]<mailto:[hidden email]> [mailto:[hidden email]<mailto:[hidden email]>
> [hidden email]<mailto:[hidden email]>] On Behalf Of Abhay B. Chaware

> Sent: 09 June 2011 08:06

> To: [hidden email]<mailto:[hidden email]>

> 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

> [hidden email]<mailto:[hidden email]>

> 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 [hidden email]<mailto:[hidden email]> 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

[hidden email]<mailto:[hidden email]>

https://lists.jboss.org/mailman/listinfo/rules-users



_______________________________________________
rules-users mailing list

[hidden email]<mailto:[hidden email]>

 


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
[hidden email]
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
[hidden email]
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
[hidden email]
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
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] FW: Drools in non-eclipse environment

manstis
In a meeting right now, but you could try Googling for ways to increase the heap size on Android?

I did a very quick search and it looked possible....

2011/6/16 Abhay B. Chaware <[hidden email]>

Thanks Mike !

It is failing after few seconds ( about 30-35 secs ) after I get the “Creating Package Builder ..” line on the console …I am not getting the next debug statement, but getting the exception instead. I am seeing a lot of garbage collection calls right after “Creating Package Builder …” line in the console before crashing, which tells me that the issue is probably related to heap/memory.

Here’s the snippet from my code.

                        System.out.println (“Creating Package Builder .. ”);

                        PackageBuilder builder = new PackageBuilder( cfg0 );

                        builder.addPackageFromDrl(new InputStreamReader(is)); // “is” is input stream for drl file

                        RuleBase ruleBase  = RuleBaseFactory.newRuleBase();

                        ruleBase.addPackage( builder.getPackage() ); 

                        System.out.println (“Package added to rule base.. ”);

-abhay


From: [hidden email] [mailto:[hidden email]] On Behalf Of Michael Anstis
Sent: Thursday, June 16, 2011 6:17 PM
To: Rules Users List
Subject: Re: [rules-users] FW: Drools in non-eclipse environment

 

Congratulations Abhay!

When does your application crash? e.g. building package, inserting facts, firing all rules?


I'm not sure how much help I can be, but your advice might help others.

Unfortunately I'm not able to analyse the Android log :(

Cheers,

Mike

2011/6/16 Abhay B. Chaware <[hidden email]>

I am have now managed to get past all the compiler errors for Drools on android .. ( I think ) J .

 

My app is failing ( crashing ) when run on android device. Looking at the log, appears to be a heap memory problem, can anyone see anything suspicious here in the android log, that may point to the drools code as suspect ?

 

 

I/DEBUG ( 1280): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG ( 1280): Build fingerprint: 'samsung/GT-I9003/GT-I9003/GT-I9003:2.2.1/FROYO/XXKB3:user/release-keys'
I/DEBUG ( 1280): pid: 11341, tid: 11341 >>> com.first <<<
I/DEBUG ( 1280): signal 11 (SIGSEGV), fault addr 0000004c
I/DEBUG ( 1280): r0 00000000 r1 4831de40 r2 00000000 r3 00000000
I/DEBUG ( 1280): r4 809a2400 r5 00240d00 r6 00000000 r7 0000cd28
I/DEBUG ( 1280): r8 80917040 r9 0000cd28 10 430cb970 fp bea15728
I/DEBUG ( 1280): ip 00000000 sp bea153a8 lr 809681f7 pc 8096809c cpsr 80000070
I/DEBUG ( 1280): d0 65643a64696f7262 d1 0065006400610075
I/DEBUG ( 1280): d2 4ba11af200000567 d3 000000004b815b67
I/DEBUG ( 1280): d4 0065007400730079 d5 00610050002e006d
I/DEBUG ( 1280): d6 006c004300680074 d7 3eaaaaab3f800000
I/DEBUG ( 1280): d8 0000000000000000 d9 0000000000000000
I/DEBUG ( 1280): d10 0000000000000000 d11 0000000000000000
I/DEBUG ( 1280): d12 0000000000000000 d13 0000000000000000
I/DEBUG ( 1280): d14 0000000000000000 d15 0000000000000000
I/DEBUG ( 1280): d16 ade4622100000000 d17 0064002f005b0072
I/DEBUG ( 1280): d18 002f006100740061 d19 002f007000700061
I/DEBUG ( 1280): d20 0073002e006b0069 d21 0065007400730079
I/DEBUG ( 1280): d22 00610050002e006d d23 006c004300680074
I/DEBUG ( 1280): d24 3ff0000000000000 d25 0000000000000000
I/DEBUG ( 1280): d26 0000000000000000 d27 0000000000000000
I/DEBUG ( 1280): d28 0000000000000000 d29 0000000000000000
I/DEBUG ( 1280): d30 0000000000000000 d31 0000000000000000
I/DEBUG ( 1280): scr 80000012
I/DEBUG ( 1280):
I/DEBUG ( 1280): #00 pc 0006809c /system/lib/libdvm.so
I/DEBUG ( 1280): #01 pc 000681f2 /system/lib/libdvm.so
I/DEBUG ( 1280): #02 pc 00068238 /system/lib/libdvm.so
I/DEBUG ( 1280): #03 pc 000690a6 /system/lib/libdvm.so
I/DEBUG ( 1280): #04 pc 00061a0c /system/lib/libdvm.so
I/DEBUG ( 1280): #05 pc 00063f1a /system/lib/libdvm.so
I/DEBUG ( 1280): #06 pc 0001bdd8 /system/lib/libdvm.so
I/DEBUG ( 1280): #07 pc 000227d4 /system/lib/libdvm.so
I/DEBUG ( 1280): #08 pc 00021674 /system/lib/libdvm.so
I/DEBUG ( 1280): #09 pc 0005c7d6 /system/lib/libdvm.so
I/DEBUG ( 1280): #10 pc 00064ef8 /system/lib/libdvm.so
I/DEBUG ( 1280): #11 pc 0001bdd8 /system/lib/libdvm.so
I/DEBUG ( 1280): #12 pc 000227d4 /system/lib/libdvm.so
I/DEBUG ( 1280): #13 pc 00021674 /system/lib/libdvm.so
I/DEBUG ( 1280): #14 pc 0005c614 /system/lib/libdvm.so
I/DEBUG ( 1280): #15 pc 00047cd6 /system/lib/libdvm.so
I/DEBUG ( 1280): #16 pc 000364b4 /system/lib/libandroid_runtime.so
I/DEBUG ( 1280): #17 pc 0003808c /system/lib/libandroid_runtime.so
I/DEBUG ( 1280): #18 pc 00008ca8 /system/bin/app_process
I/DEBUG ( 1280): #19 pc 0000d404 /system/lib/libc.so
I/DEBUG ( 1280):
I/DEBUG ( 1280): code around pc:
I/DEBUG ( 1280): 8096807c 0f02f1be 2500bfd8 b0054628 bf00bdf0
I/DEBUG ( 1280): 8096808c 0003a3c8 000003a0 fffc3f91 41f0e92d
I/DEBUG ( 1280): 8096809c 4d216cc3 4606a200 18ad460f d0384299
I/DEBUG ( 1280): 809680ac e078f8df 400ef855 208cf8d4 0014f112
I/DEBUG ( 1280): 809680bc eb0cf7ae c094f8d4 f1bc6a73 bf180100
I/DEBUG ( 1280):
I/DEBUG ( 1280): code around lr:
I/DEBUG ( 1280): 809681d4 461a9905 633e1820 fb12f7d9 46089902
I/DEBUG ( 1280): 809681e4 f7e84639 e004faa7 99044610 f7ff4616
I/DEBUG ( 1280): 809681f4 9803ff51 f7e82100 4628fa9d ed6af7ae
I/DEBUG ( 1280): 80968204 b0094630 bf00bdf0 0003a2c8 fffe46a4
I/DEBUG ( 1280): 80968214 ffff026e ffff1926 fffe2288 ffff194c
I/DEBUG ( 1280):
I/DEBUG ( 1280): stack:
I/DEBUG ( 1280): bea15368 430faf80 /dev/ashmem/dalvik-LinearAlloc (deleted)
I/DEBUG ( 1280): bea1536c 0000cd28 [heap]
I/DEBUG ( 1280): bea15370 bea153c4 [stack]
I/DEBUG ( 1280): bea15374 8095c61d /system/lib/libdvm.so
I/DEBUG ( 1280): bea15378 8099266e /system/lib/libdvm.so
I/DEBUG ( 1280): bea1537c 4831de40 /dev/ashmem/mspace/dalvik-heap/2 (deleted)
I/DEBUG ( 1280): bea15380 439121ed /system/framework/core.odex
I/DEBUG ( 1280): bea15384 00000000
I/DEBUG ( 1280): bea15388 bea15340 [stack]
I/DEBUG ( 1280): bea1538c 0000001f
I/DEBUG ( 1280): bea15390 80993d3a /system/lib/libdvm.so
I/DEBUG ( 1280): bea15394 809a2400 /system/lib/libdvm.so
I/DEBUG ( 1280): bea15398 00240d00 [heap]
I/DEBUG ( 1280): bea1539c 00000000
I/DEBUG ( 1280): bea153a0 df002777
I/DEBUG ( 1280): bea153a4 e3a070ad
I/DEBUG ( 1280): #00 bea153a8 809a2400 /system/lib/libdvm.so
I/DEBUG ( 1280): bea153ac 00240d00 [heap]
I/DEBUG ( 1280): bea153b0 00000000
I/DEBUG ( 1280): bea153b4 0000cd28 [heap]
I/DEBUG ( 1280): bea153b8 80917040 /system/lib/libdvm.so
I/DEBUG ( 1280): bea153bc 809681f7 /system/lib/libdvm.so
I/DEBUG ( 1280): #01 bea153c0 4867acc0 /dev/ashmem/mspace/dalvik-heap/2 (deleted)
I/DEBUG ( 1280): bea153c4 400092d0 /dev/ashmem/mspace/dalvik-heap/zygote/0 (deleted)
I/DEBUG ( 1280): bea153c8 00000000
I/DEBUG ( 1280): bea153cc 4867acc0 /dev/ashmem/mspace/dalvik-heap/2 (deleted)
I/DEBUG ( 1280): bea153d0 4831de40 /dev/ashmem/mspace/dalvik-heap/2 (deleted)
I/DEBUG ( 1280): bea153d4 00240ce8 [heap]
I/DEBUG ( 1280): bea153d8 00000000
I/DEBUG ( 1280): bea153dc ade46221 /system/lib/libicuuc.so
I/DEBUG ( 1280): bea153e0 00000001
I/DEBUG ( 1280): bea153e4 00240ce8 [heap]
I/DEBUG ( 1280): bea153e8 4831de40 /dev/ashmem/mspace/dalvik-heap/2 (deleted)
I/DEBUG ( 1280): bea153ec 809a2400 /system/lib/libdvm.so
I/DEBUG ( 1280): bea153f0 00240cd0 [heap]
I/DEBUG ( 1280): bea153f4 8096823d /system/lib/libdvm.so

 

 

-abhay

 


From: Abhay B. Chaware
Sent: Monday, June 13, 2011 9:43 AM
To: 'Rules Users List'
Subject: FW: [rules-users] Drools in non-eclipse environment

 

Any ideas folks ?


From: Abhay B. Chaware
Sent: Friday, June 10, 2011 12:54 PM
To: 'Rules Users List'
Subject: RE: [rules-users] Drools in non-eclipse environment

 

The ride’s real fun J

 

Got apache harmony’s beans.jar to work .. now , when I am reading the serialized knowledgebase object on android, quite obvious, it is throwing this error –

 

java.lang.UnsupportedOperationException: can't load this type of class file

 

since my serialized knowledgebase object is in java format .. and not dex. Can this serialized version be converted into .dex format using the “dx” utility – pre or post serialization ? I tried the “dx” tool on the serialized object, but it doesn’t seem to understand the format.

 

-abhay

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Michael Anstis
Sent: Thursday, June 09, 2011 6:37 PM
To: Rules Users List
Subject: Re: [rules-users] Drools in non-eclipse environment

 

http://meteatamel.wordpress.com/2010/08/25/android-api-and-java-beans-package/

http://meteatamel.wordpress.com/2010/09/28/android-api-and-java-beans-package-2/

Enjoy the ride ;)

2011/6/9 Abhay B. Chaware <[hidden email]>

woo hooo ! I got past that problem J  But a new one’s here now.

 

Looks like MVEL is not liking something J 

 

 

 

W/dalvikvm(29977): VFY: unable to resolve static method 164: Ljava/beans/Introspector;.decapitalize (Ljava/lang/String;)Ljava/lang

/String;

W/dalvikvm(29977): threadid=1: thread exiting with uncaught exception (group=0x40020ac0)

E/AndroidRuntime(29977): FATAL EXCEPTION: main

E/AndroidRuntime(29977): java.lang.NoClassDefFoundError: java.beans.Introspector

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.calcFieldName(ClassFieldInspector.java:298)

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.addToMapping(ClassFieldInspector.java:216)

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.processClassWithoutByteCode(ClassFieldInspector.ja

va:148)

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.<init>(ClassFieldInspector.java:83)

E/AndroidRuntime(29977):        at org.drools.core.util.asm.ClassFieldInspector.<init>(ClassFieldInspector.java:64)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorFactory.getClassFieldReader(ClassFieldAccessorFactory.java:11

8)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorCache$CacheEntry.getReadAccessor(ClassFieldAccessorCache.java

:168)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorCache.getReadAcessor(ClassFieldAccessorCache.java:101)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorStore.wire(ClassFieldAccessorStore.java:404)

E/AndroidRuntime(29977):        at org.drools.base.ClassFieldAccessorStore.wire(ClassFieldAccessorStore.java:374)

E/AndroidRuntime(29977):        at org.drools.common.AbstractRuleBase.readExternal(AbstractRuleBase.java:295)

E/AndroidRuntime(29977):        at org.drools.reteoo.ReteooRuleBase.readExternal(ReteooRuleBase.java:236)

E/AndroidRuntime(29977):        at org.drools.impl.KnowledgeBaseImpl.readExternal(KnowledgeBaseImpl.java:108)

E/AndroidRuntime(29977):        at java.io.ObjectInputStream.readNewObject(ObjectInputStream.java:2127)

E/AndroidRuntime(29977):        at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:929)

E/AndroidRuntime(29977):        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2285)

E/AndroidRuntime(29977):        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2240)

E/AndroidRuntime(29977):        at com.ts.DBconnector.execPackageByPath(DBconnector.java:219)

E/AndroidRuntime(29977):        at com.first.FirstActivity.onCreate(FirstActivity.java:77)

E/AndroidRuntime(29977):        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)

E/AndroidRuntime(29977):        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)

E/AndroidRuntime(29977):        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)

E/AndroidRuntime(29977):        at android.app.ActivityThread.access$2300(ActivityThread.java:125)

E/AndroidRuntime(29977):        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)

E/AndroidRuntime(29977):        at android.os.Handler.dispatchMessage(Handler.java:99)

E/AndroidRuntime(29977):        at android.os.Looper.loop(Looper.java:123)

E/AndroidRuntime(29977):        at android.app.ActivityThread.main(ActivityThread.java:4627)

E/AndroidRuntime(29977):        at java.lang.reflect.Method.invokeNative(Native Method)

E/AndroidRuntime(29977):        at java.lang.reflect.Method.invoke(Method.java:521)

E/AndroidRuntime(29977):        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)

E/AndroidRuntime(29977):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)

E/AndroidRuntime(29977):        at dalvik.system.NativeStart.main(Native Method)

 

 

 


From: [hidden email] [mailto:[hidden email]] On Behalf Of Michael Anstis
Sent: Thursday, June 09, 2011 4:51 PM


To: Rules Users List
Subject: Re: [rules-users] Drools in non-eclipse environment

 

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 <[hidden email]>

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: [hidden email] [mailto:[hidden email]] 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 <[hidden email]> 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: [hidden email] [[hidden email]] On Behalf Of Wolfgang Laun [[hidden email]]
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 <[hidden email]<mailto:[hidden email]>> 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: [hidden email]<mailto:[hidden email]> [[hidden email]<mailto:[hidden email]>] On Behalf Of Swindells, Thomas [[hidden email]<mailto:[hidden email]>]

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: [hidden email]<mailto:[hidden email]> [mailto:[hidden email]<mailto:[hidden email]>
> [hidden email]<mailto:[hidden email]>] On Behalf Of Abhay B. Chaware

> Sent: 09 June 2011 08:06

> To: [hidden email]<mailto:[hidden email]>

> 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

> [hidden email]<mailto:[hidden email]>

> 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 [hidden email]<mailto:[hidden email]> 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

[hidden email]<mailto:[hidden email]>

https://lists.jboss.org/mailman/listinfo/rules-users



_______________________________________________
rules-users mailing list

[hidden email]<mailto:[hidden email]>

 


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
[hidden email]
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
[hidden email]
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
[hidden email]
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
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users



_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
12