mercredi 4 mars 2015

Inexplicably unresolvable IncompatibleClassChangeError in jetty-maven-plugin with Spring

I'm working on a Restlet application issue and thought it would be great to set up a Github repository containing a cut-down version of the application to test out. However, it's never that easy...


The repository is here: http://ift.tt/1M6vERI


Basically, the problem is that whenever I try to run it using mvn jetty:run-war (which I actually need to do to test out the restlet issue) I get the following backtrace:



java.lang.IncompatibleClassChangeError: class org.springframework.cglib.core.DebuggingClassWriter has interface org.springframework.asm.ClassVisitor as super class
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:455)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:367)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:415)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:377)
at org.springframework.cglib.core.DefaultGeneratorStrategy.getClassVisitor(DefaultGeneratorStrategy.java:30)


The part that's interesting is that the original application -- even when I had it use the exact same pom.xml, did not show the same problem for the same command. Both seem to be fine with mvn jetty:run, but the Restlet issue needs a war file to test against.


Now I've seen this issue and it usually an ASM/CGLIB conflict, and when I checked the dependencies, both Jetty and Spring do use different ASM systems, but I figure where or how to set the dependencies right to make this work. And even if I could, I can't figure out why it works in one application and not in a slightly smaller version (which sadly I can't yet show).


Any thoughts on how to resolve this? I've tried adding an exclusion to the Jetty dependency that's causing the issue (jetty-annotations) but then Jetty failed hideously, so it's clearly required.


Aucun commentaire:

Enregistrer un commentaire