Hi list,
I'm reviving this thread because I happen to have the same problem.
On Sun, Mar 23, 2008 at 7:34 PM, Mike Dean <mdean77(a)comcast.net> wrote:
Thanks (months later!). I have cut down my code example below to show this
issue more clearly:
John J. Franey wrote:
>
> NullPointerException on line 146 means classLoader is null. That is odd.
> I have no idea why the code that gets classLoader won't work in eclipse's
> junit runtime, but does when run in your eclipse plugin.
It seems indeed like during JUnit tests, the context classloader of
the thread gets not set (null).
The code leading up to the problem is as follows:
PackageBuilderConfiguration conf = new PackageBuilderConfiguration();
JavaDialectConfiguration javaConf = (JavaDialectConfiguration)
conf.getDialectConfiguration("java");
javaConf.setCompiler(JavaDialectConfiguration.ECLIPSE);
javaConf.setJavaLanguageLevel("1.5");
RuleBase ruleBase = RuleBaseFactory.newRuleBase();
The resulting stacktrace is:
java.lang.NullPointerException
at org.drools.RuleBaseConfiguration.instantiateClass(RuleBaseConfiguration.java:569)
at
org.drools.RuleBaseConfiguration.determineConsequenceExceptionHandler(RuleBaseConfiguration.java:561)
at org.drools.RuleBaseConfiguration.init(RuleBaseConfiguration.java:220)
at org.drools.RuleBaseConfiguration.<init>(RuleBaseConfiguration.java:133)
at org.drools.common.AbstractRuleBase.<init>(AbstractRuleBase.java:147)
at org.drools.reteoo.ReteooRuleBase.<init>(ReteooRuleBase.java:124)
at org.drools.reteoo.ReteooRuleBase.<init>(ReteooRuleBase.java:101)
at org.drools.RuleBaseFactory.newRuleBase(RuleBaseFactory.java:57)
at org.drools.RuleBaseFactory.newRuleBase(RuleBaseFactory.java:38)
Has anyone set up Drools and JUnit successfully? Maybe we forgot to
set up the environment properly?
Best regards
Marcus