Oh.. I see what is happening here.. the Default dialects and session
configurations are not being loaded by your OSGI environment :)
It took me a while to find that out so I hope this comment helps you
to save some valuable time.
Solution: you need to add inside your project that is loading the
rules the following file:
META-INF/drools.packagebuilder.conf
That contains the following content:
drools.dialect.default = java
drools.dialect.java =
org.drools.rule.builder.dialect.java.JavaDialectConfiguration
drools.dialect.java.compiler = ECLIPSE
drools.dialect.mvel =
org.drools.rule.builder.dialect.mvel.MVELDialectConfiguration
drools.dialect.mvel.strict = true
drools.dialect.mvel.langLevel = 4
drools.accumulate.function.average =
org.drools.base.accumulators.AverageAccumulateFunction
drools.accumulate.function.max =
org.drools.base.accumulators.MaxAccumulateFunction
drools.accumulate.function.min =
org.drools.base.accumulators.MinAccumulateFunction
drools.accumulate.function.count =
org.drools.base.accumulators.CountAccumulateFunction
drools.accumulate.function.sum =
org.drools.base.accumulators.SumAccumulateFunction
drools.accumulate.function.collectList =
org.drools.base.accumulators.CollectListAccumulateFunction
drools.accumulate.function.collectSet =
org.drools.base.accumulators.CollectSetAccumulateFunction
drools.evaluator.coincides =
org.drools.base.evaluators.CoincidesEvaluatorDefinition
drools.evaluator.before = org.drools.base.evaluators.BeforeEvaluatorDefinition
drools.evaluator.after = org.drools.base.evaluators.AfterEvaluatorDefinition
drools.evaluator.meets = org.drools.base.evaluators.MeetsEvaluatorDefinition
drools.evaluator.metby = org.drools.base.evaluators.MetByEvaluatorDefinition
drools.evaluator.overlaps =
org.drools.base.evaluators.OverlapsEvaluatorDefinition
drools.evaluator.overlappedby =
org.drools.base.evaluators.OverlappedByEvaluatorDefinition
drools.evaluator.during = org.drools.base.evaluators.DuringEvaluatorDefinition
drools.evaluator.includes =
org.drools.base.evaluators.IncludesEvaluatorDefinition
drools.evaluator.starts = org.drools.base.evaluators.StartsEvaluatorDefinition
drools.evaluator.startedby =
org.drools.base.evaluators.StartedByEvaluatorDefinition
drools.evaluator.finishes =
org.drools.base.evaluators.FinishesEvaluatorDefinition
drools.evaluator.finishedby =
org.drools.base.evaluators.FinishedByEvaluatorDefinition
drools.evaluator.equality =
org.drools.base.evaluators.EqualityEvaluatorsDefinition
drools.evaluator.comparable =
org.drools.base.evaluators.ComparableEvaluatorsDefinition
drools.evaluator.set = org.drools.base.evaluators.SetEvaluatorsDefinition
drools.evaluator.matches =
org.drools.base.evaluators.MatchesEvaluatorsDefinition
drools.evaluator.soundslike =
org.drools.base.evaluators.SoundslikeEvaluatorsDefinition
That is provided by drools-compiler.jar or drools-core.jar (I don't
have the code here) but it's not being picked up by the OSGI
container.
Cheers
2012/1/10 elMateo <soyelmateo(a)gmail.com>:
I'm using Drools 5.4.0 Beta 1 and my DRL is the Hello World of
Drools :)
(all my application is the Hello World of Drools, because I'm trying to do a
OSGi bundle with this application).
In my OSGi framework is running drools.core, drools.compiler and
knowledge-api, and others bundles.
Thanks for reply me.
On Tue, Jan 10, 2012 at 6:15 PM, Swindells, Thomas <TSwindells(a)nds.com>
wrote:
>
> Looking at the stack trace, if you are on the same version as drools as me
> it looks like it is this line
> this.rule.setDialect( getDialect().getId() );
>
> The most likely reason is your DRL isn't valid - perhaps where you are
> specifying the dialect, or it could be your
> Dependencies aren't right or something.
> Which version of drools are you using. Have you tried reducing your DRL
> file to the minimum that generates the error - then post that DRL if you
> need further help.
>
> Thomas
>
> > -----Original Message-----
> > From: rules-users-bounces(a)lists.jboss.org [mailto:rules-users-
> > bounces(a)lists.jboss.org] On Behalf Of jjmartinez
> > Sent: 10 January 2012 17:05
> > To: rules-users(a)lists.jboss.org
> > Subject: Re: [rules-users] NullPointerException when load file rules
> >
> > Anybody can help me? I don't know why my application show these errors.
> >
> > Thanks in advance!
> >
> > java.lang.NullPointerException
> at
> org.drools.rule.builder.RuleBuildContext.<init>(RuleBuildContext.java:88)
> at
> org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:1149)
> at
> org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:636)
> at
> org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:266)
> at
> org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:458)
> at
> org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
> at drools.ejemplos.DroolsTest.readKnowledgeBase(DroolsTest.java:85)
> at drools.ejemplos.DroolsTest.execute(DroolsTest.java:64)
> at drools.ejemplos.DroolsTest.<init>(DroolsTest.java:56)
> at drools.ejemplos.Activator.start(Activator.java:14)
> at
> org.knopflerfish.framework.BundleImpl.start0(BundleImpl.java:356)
> at
> org.knopflerfish.framework.BundleThread.run(BundleThread.java:107)
>
>
>
>
**************************************************************************************
> This message is confidential and intended only for the addressee. If you
> have received this message in error, please immediately notify the
> postmaster(a)nds.com 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
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users