luontola / jumi

Test runner for the JVM. Natively supports running tests in parallel. Full stack from UI to class loading. Overcomes a bunch of limitations in JUnit's test runner, IDEs and build tools. [PRE-ALPHA]
https://jumi.fi
Apache License 2.0
72 stars 8 forks source link

ClassNotFoundException when using WicketTester #2

Closed luontola closed 11 years ago

luontola commented 11 years ago

Wicket seems to use the system class loader instead of its own class loader. It also checks the ContextClassLoader for the current thread, so this issue might be solvable by setting it.

 > Run #342 in xxx.WicketApplicationTest
 > + WicketApplicationTest
 >   + the_application_always_uses_Finnish_locale
14:29:42.681 [jumi-tests-4] WARN  o.a.wicket.util.lang.WicketObjects - Could not resolve class [org.apache.wicket.Initializer]
java.lang.ClassNotFoundException: org.apache.wicket.Initializer
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366) ~[na:1.7.0_09]
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355) ~[na:1.7.0_09]
    at java.security.AccessController.doPrivileged(Native Method) ~[na:1.7.0_09]
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354) ~[na:1.7.0_09]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423) ~[na:1.7.0_09]
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) ~[na:1.7.0_09]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356) ~[na:1.7.0_09]
    at java.lang.Class.forName0(Native Method) ~[na:1.7.0_09]
    at java.lang.Class.forName(Class.java:264) ~[na:1.7.0_09]
    at org.apache.wicket.application.AbstractClassResolver.resolveClass(AbstractClassResolver.java:110) ~[wicket-core-1.5.0.jar:1.5.0]
    at org.apache.wicket.util.lang.WicketObjects.resolveClass(WicketObjects.java:68) [wicket-core-1.5.0.jar:1.5.0]
    at org.apache.wicket.util.lang.WicketObjects.newInstance(WicketObjects.java:376) [wicket-core-1.5.0.jar:1.5.0]
    at org.apache.wicket.Application.addInitializer(Application.java:577) [wicket-core-1.5.0.jar:1.5.0]
    at org.apache.wicket.Application.load(Application.java:615) [wicket-core-1.5.0.jar:1.5.0]
    at org.apache.wicket.Application.initializeComponents(Application.java:501) [wicket-core-1.5.0.jar:1.5.0]
    at org.apache.wicket.Application.initApplication(Application.java:806) [wicket-core-1.5.0.jar:1.5.0]
    at org.apache.wicket.util.tester.BaseWicketTester.<init>(BaseWicketTester.java:297) [wicket-core-1.5.0.jar:1.5.0]
    at org.apache.wicket.util.tester.BaseWicketTester.<init>(BaseWicketTester.java:241) [wicket-core-1.5.0.jar:1.5.0]
    at org.apache.wicket.util.tester.WicketTester.<init>(WicketTester.java:192) [wicket-core-1.5.0.jar:1.5.0]
    at xxx.WicketApplicationTest.the_application_always_uses_Finnish_locale(WicketApplicationTest.java:34) [test-classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_09]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_09]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_09]
    at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_09]
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) [junit-dep-4.10.jar:na]
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) [junit-dep-4.10.jar:na]
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) [junit-dep-4.10.jar:na]
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) [junit-dep-4.10.jar:na]
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) [junit-dep-4.10.jar:na]
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30) [junit-dep-4.10.jar:na]
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) [junit-dep-4.10.jar:na]
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) [junit-dep-4.10.jar:na]
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) [junit-dep-4.10.jar:na]
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) [junit-dep-4.10.jar:na]
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) [junit-dep-4.10.jar:na]
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) [junit-dep-4.10.jar:na]
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) [junit-dep-4.10.jar:na]
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) [junit-dep-4.10.jar:na]
    at org.junit.runners.ParentRunner.run(ParentRunner.java:300) [junit-dep-4.10.jar:na]
    at org.junit.runner.JUnitCore.run(JUnitCore.java:157) [junit-dep-4.10.jar:na]
    at org.junit.runner.JUnitCore.run(JUnitCore.java:136) [junit-dep-4.10.jar:na]
    at fi.jumi.core.junit.JUnitCompatibilityDriver$JUnitRunner.run(JUnitCompatibilityDriver.java:37) [na:na]
    at fi.jumi.actors.workers.WorkerCounter$Worker.run(WorkerCounter.java:82) [jumi-daemon-0.4-SNAPSHOT.jar:na]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [na:1.7.0_09]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [na:1.7.0_09]
    at java.lang.Thread.run(Thread.java:722) [na:1.7.0_09]
org.apache.wicket.WicketRuntimeException: Unable to create org.apache.wicket.Initializer
    at org.apache.wicket.util.lang.WicketObjects.newInstance(WicketObjects.java:381)
    at org.apache.wicket.Application.addInitializer(Application.java:577)
    at org.apache.wicket.Application.load(Application.java:615)
    at org.apache.wicket.Application.initializeComponents(Application.java:501)
    at org.apache.wicket.Application.initApplication(Application.java:806)
    at org.apache.wicket.util.tester.BaseWicketTester.<init>(BaseWicketTester.java:297)
    at org.apache.wicket.util.tester.BaseWicketTester.<init>(BaseWicketTester.java:241)
    at org.apache.wicket.util.tester.WicketTester.<init>(WicketTester.java:192)
    at xxx.WicketApplicationTest.the_application_always_uses_Finnish_locale(WicketApplicationTest.java:34)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:136)
    at fi.jumi.core.junit.JUnitCompatibilityDriver$JUnitRunner.run(JUnitCompatibilityDriver.java:37)
    at fi.jumi.actors.workers.WorkerCounter$Worker.run(WorkerCounter.java:82)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.NullPointerException
    at org.apache.wicket.util.lang.WicketObjects.newInstance(WicketObjects.java:377)
    ... 34 more
 >   - the_application_always_uses_Finnish_locale
 > - WicketApplicationTest

Jumi version 0.4-SNAPSHOT 2013-01-17

luontola commented 11 years ago

After solving this, it should be checked whether the issue (in Dimdwarf project) with JMock failing to mock a method returning java.util.Set is also solved.