<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">I am having problems with testing Drools rules; the code is JUnit setup code that is shown below. However, I get a problem that the dialect cannot be opened (see after code). This problem persists whether I tell JUnit to use my core plugin, or if I add every piece of code in the Drools distribution. I added the several lines about Java configuration, and this has made no difference. The crash occurs on the first line invoking Drools routines. I know I am having so much trouble with this code that many readers are tiring of my stupidity, but I just don't get this. The core plugin that I am including in the classpath runs completely well in the standalone RCP. Thanks for any assistance.<div><br class="webkit-block-placeholder"></div><div>- Mike<br><div><br class="webkit-block-placeholder"></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(100, 100, 100); "><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">        </span></span>@BeforeClass</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">        </span><span style="color: #7f0055">public</span> <span style="color: #7f0055">static</span> <span style="color: #7f0055">void</span> setUp() <span style="color: #7f0055">throws</span> Exception {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>Reader source;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>PackageBuilderConfiguration pkgConfig = <span style="color: #7f0055">new</span> PackageBuilderConfiguration(); //CRASH OCCURS IN THIS LINE</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>JavaDialectConfiguration javaDialectConf = (JavaDialectConfiguration) pkgConfig.getDialectConfiguration(<span style="color: #2a00ff">"java"</span>);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>javaDialectConf.setCompiler(JavaDialectConfiguration.<span style="color: #0000c0">ECLIPSE</span>);</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; min-height: 15.0px"><span class="Apple-tab-span" style="white-space:pre">                </span><br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span><span style="color: #7f0055">final</span> PackageBuilder builder = <span style="color: #7f0055">new</span> <span style="text-decoration: underline ; color: #0000ff">PackageBuilder</span>(pkgConfig); //IF PREVIOUS THREE LINES DELETED SAME CRASH OCCURS HERE</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span><span style="color: #7f0055">boolean</span> exists = (<span style="color: #7f0055">new</span> File(<span style="color: #2a00ff">"rules/GlucoseDroolRules00.drl"</span>)).exists();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span><span style="color: #7f0055">if</span> (exists) {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                        </span>builder.addPackageFromDrl(<span style="color: #7f0055">new</span> FileReader(</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(42, 0, 255); "><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">                                </span></span>"rules/GlucoseDroolRules00.drl"<span style="color: #000000">));</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                        </span>System.<span style="color: #0000c0">out</span>.println(<span style="color: #2a00ff">"Found the file!"</span>);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>} <span style="color: #7f0055">else</span> {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(42, 0, 255); "><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">                        </span>System.</span><span style="color: #0000c0">out</span><span style="color: #000000">.println(</span>"Cannot locate the file - will try as resource"<span style="color: #000000">);</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                        </span>source = <span style="color: #7f0055">new</span> InputStreamReader(AllDroolsRulesTests.<span style="color: #7f0055">class</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(42, 0, 255); "><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">                                        </span>.getResourceAsStream(</span>"rules/GlucoseDroolRules00.drl"<span style="color: #000000">));</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                        </span>builder.addPackageFromDrl(source);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span><span style="color: #7f0055">if</span> (builder.hasErrors()) {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                        </span>System.<span style="color: #0000c0">out</span>.println(builder.getErrors().toString());</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>Package pkg = builder.getPackage();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span><span style="color: #0000c0">ruleBase</span> = RuleBaseFactory.newRuleBase();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span><span style="color: #0000c0">ruleBase</span>.addPackage(pkg);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><br class="webkit-block-placeholder"></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><div>org.drools.RuntimeDroolsException: Unable to load dialect 'org.drools.rule.builder.dialect.java.JavaDialectConfiguration:java'</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>at org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:152)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>at org.drools.compiler.PackageBuilderConfiguration.buildDialectConfigurationMap(PackageBuilderConfiguration.java:140)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>at org.drools.compiler.PackageBuilderConfiguration.init(PackageBuilderConfiguration.java:117)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>at org.drools.compiler.PackageBuilderConfiguration.<init>(PackageBuilderConfiguration.java:94)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>at droolsRules.tests.AllDroolsRulesTests.setUp(AllDroolsRulesTests.java:39)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>at java.lang.reflect.Method.invoke(Method.java:585)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>at org.junit.internal.runners.BeforeAndAfterRunner.invokeMethod(BeforeAndAfterRunner.java:74)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>at org.junit.internal.runners.BeforeAndAfterRunner.runBefores(BeforeAndAfterRunner.java:50)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:33)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)</div><div>Caused by: java.lang.NullPointerException</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>at org.drools.compiler.PackageBuilderConfiguration.addDialect(PackageBuilderConfiguration.java:146)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>... 18 more</div><div><br class="webkit-block-placeholder"></div></div></div></div></body></html>