[rules-users] JUnit Test failure when Eclipse library present on classpath

Bruno Freudensprung bruno.freudensprung at temis.com
Wed Feb 23 04:44:58 EST 2011


Hi,

Unfortunately I have no answer to your question.
However I actually run JUnit 4 tests calling drools 5.1.1 in Eclipse 3.5 
and it works with the following classpath. Please note that it contains 
jars that are not Drools-specific (my project-specific jars):

+- org.drools:drools-core:jar:5.1.1:compile
|  \- org.mvel:mvel2:jar:2.0.16:compile
+- org.drools:drools-api:jar:5.1.1:compile
+- org.drools:drools-compiler:jar:5.1.1:runtime
|  +- org.antlr:antlr-runtime:jar:3.1.3:runtime
|  \- org.eclipse.jdt.core.compiler:ecj:jar:3.5.1:runtime
+- org.eclipse.jdt:core:jar:3.4.2.v_883_R34x:compile
+- trove:trove:jar:2.1.0:compile
+- org.mockito:mockito-core:jar:1.8.5:test
|  +- org.hamcrest:hamcrest-core:jar:1.1:test
|  \- org.objenesis:objenesis:jar:1.0:test
+- commons-lang:commons-lang:jar:2.4:compile
+- commons-io:commons-io:jar:1.4:compile
+- org.drools:drools-ide-common:jar:5.1.1:runtime
+- org.apache.lucene:lucene-core:jar:2.3.1:runtime
+- com.thoughtworks.xstream:xstream:jar:1.3.1:runtime
|  \- xpp3:xpp3_min:jar:1.1.4c:runtime
+- log4j:log4j:jar:1.2.15:compile
|  \- javax.mail:mail:jar:1.4:compile
+- dom4j:dom4j:jar:1.6.1:compile
|  \- xml-apis:xml-apis:jar:1.0.b2:compile
+- jgrapht:jgrapht:jar:0.8.1:compile
+- org.drools:drools-bpmn2:jar:5.1.1:compile
+- jaxen:jaxen:jar:1.1-beta-4:compile
|  \- xerces:xercesImpl:jar:2.6.2:compile
\- junit:junit:jar:4.8.1:test

HTH,
Regards,

Bruno.



StormeHawke a écrit :
> I'm not really sure what to make of this, but when the Drools Runtime library
> is present on my project classpath, any of my junit tests that reference
> Drools fail, but if I remove the runtime library from that same classpath,
> everything runs as expected.  The output in the console:
>
> Build groovy files option has not been set one way or the other: use
> 'options.put(CompilerOptions.OPTIONG_BuildGroovyFiles,
> CompilerOptions.ENABLED);'
> (I'm not using groovy files of any kind)
>
> But then I also get a really long stack trace in the JUnit output pane
> (truncated once it reaches my code):
>
>
> java.lang.NoClassDefFoundError: org/eclipse/core/runtime/Plugin
> 	at java.lang.ClassLoader.defineClass1(Native Method)
> 	at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
> 	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
> 	at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
> 	at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
> 	at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
> 	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
> 	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
> 	at
> org.eclipse.jdt.internal.compiler.Compiler.initializeParser(Compiler.java:737)
> 	at org.eclipse.jdt.internal.compiler.Compiler.<init>(Compiler.java:294)
> 	at org.eclipse.jdt.internal.compiler.Compiler.<init>(Compiler.java:159)
> 	at
> org.drools.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJavaCompiler.java:349)
> 	at
> org.drools.commons.jci.compilers.AbstractJavaCompiler.compile(AbstractJavaCompiler.java:51)
> 	at
> org.drools.rule.builder.dialect.java.JavaDialect.compileAll(JavaDialect.java:389)
> 	at
> org.drools.compiler.DialectCompiletimeRegistry.compileAll(DialectCompiletimeRegistry.java:56)
> 	at org.drools.compiler.PackageRegistry.compileAll(PackageRegistry.java:74)
> 	at org.drools.compiler.PackageBuilder.compileAll(PackageBuilder.java:677)
> 	at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:640)
> 	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
> net.intellidata.pricing.PricingEngine.cacheKnowledgeBase(PricingEngine.java:136)
>
> To top it off, the same test runs fine on my boss's computer, but not on
> mine.  Neither of us is sure why.  What am I missing?
>   




More information about the rules-users mailing list