In Java 7, JUnit 4.11 reports an "initializationError" when I try to run a test through CallbackParamsRunner with CallbackParams 1.0-beta-6. The stack trace is as follows:
java.lang.NoSuchMethodError: org.apache.bcel.generic.Type.getType(Ljava/lang/Class;)Lorg/apache/bcel/generic/Type;
at org.callbackparams.internal.CallbackMethodProxyingRebyter.<clinit>(CallbackMethodProxyingRebyter.java:59)
at org.callbackparams.internal.CallbackTestClassReloader.newInstance(CallbackTestClassReloader.java:98)
at org.callbackparams.junit4.Junit4RunWrapper.<init>(Junit4RunWrapper.java:36)
...
The Dependency Analyzer of the Maven Helper plugin for IntelliJ IDEA shows no BCEL conflicts, the only version of BCEL being the one that's included by CallbackParams: version 5.2. I can see that org.apache.bcel.generic.Type.getType(String) exists, but getType(Class) certainly does not exist in that class. Why is CallbackMethodProxyingRebyter depending on a method that doesn't exist?
I discovered the problem. Another library, by the name of Xalan, is used by my project. Inside that library is embedded another version of BCEL. I had to edit my pom.xml file to exclude portions of Xalan from the classpath.
Thank you for this report. I am glad you seem to have found a workaround for the problem but I keep this issue open for a while in hope of more feedback on the effects of this problem. Maybe someone can come up with a small quick-fix to help CallbackParams co-existance with Xalan.
A couple of other thoughts on this issue ...
I am not sure about your specific case but it might be a good idea to put the test-dependencies first on class-path.
This kind of problem was predicted a long time ago and a possible solution has been suggested - maven-shade-plugin: http://maven.apache.org/plugins/maven-shade-plugin/examples/class-relocation.html
But so far the drawbacks, such as a more complicated development-and-buld process, have stood out and made us stick with the explicit BCEL-dependency and the potential version-conflicts that come with it.
Do you think it would a better idea to hurry up with BCEL shading and class-relocation? then please let us know