On Wed, 2005-10-26 at 06:01 -0700, Cédric Beust ♔ wrote:
> If I'm not mistaken, this is thrown by the JVM when it is attempting
> to "hot swap" a class that has an incompatible change in it, such as
> an added method.
>
> How exactly is it happening, from the IDE?
No this is from a command line Ant build.
I have a library which gets compiled to a location, build/classes. I
then compile tests into build/tests with build/classes in the classpath.
Everything is hunky dory.
I also have some alternate versions of some of the classes from the
library which I compile to build_alt/classes with build/classes in the
classpath so as pick up the standard library versions of things no in
the set of alternates. No I compile the tests to build_alt/tests with
build_alt/classes and build/classes in the class path in that order.
This should mean picking up the alternates and not the versions in the
standard library -- they have the same API so this should work.
Everything compiles fine but when I execute the testng task from Ant I
now get:
[testng] ===============================================
[testng] Suite for Command line test
[testng] Total tests run: 114, Failures: 7, Skips: 79
[testng] ===============================================
The original problem was an error in my build.xml, I got the classpath
wrong. So now things execute but I get the same exception as I had
originally so I still have the problem it just exhibits itself
elsewhere. The HTML output is given below showing the reason for a
setup method failing is the exception, this causes 6 fails and all the
skips. The successful tests show that something works :-)
Given the compile works I'm assuming the problem is a classpath problem
of some sort but as the class paths are all correct I cannot see the
problem.
java.lang.IncompatibleClassChangeError: Implementing class
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
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:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
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:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at Array_Test.setUp(Array_Test.java:54)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:352)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:282)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:151)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:316)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:509)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:90)
at org.testng.TestRunner.privateRun(TestRunner.java:620)
at org.testng.TestRunner.run(TestRunner.java:503)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:200)
at org.testng.SuiteRunner.run(SuiteRunner.java:126)
at org.testng.TestNG.run(TestNG.java:285)
at org.testng.TestNG.privateMain(TestNG.java:372)