I followed the advice given here to try some unit tests with spring aop enabled methods. However, I suspect that the repackaged cglib classes under spring-core and the cglib-nodep-2.2.jar conflict with each other, causing my class being proxied to be loaded by the classloader twice. This results in the following error:
Caused by: java.lang.LinkageError: loader (instance of sun/misc/Launcher$AppClassLoader): attempted duplicate class definition for name:
Tools:
- easmock-3.0 (with cglib-nodep-2.2.jar transitive dependency)
- spring-x-4.0.0.RELEASE (with repackaged cglib of version ? classes)
- junit-4.8.1
Excluding the transitive cglib-nodep dependency didn't help obviously - all tests including non-sring-aop ones started failing too.
I tried the answer posted here too: cleaning up the target folder before running the tests again with no success.
Is this problem really because of the conflict of cglib versions like I thought it would be? If so, what is the right version I should use that would stop loading my class twice.