2017  Kodetalk | Feedback | Privacy Policy | Terms | About
userimage

IncompatibleClassChangeError: class org.springframework.core.type.classreading.ClassMetadataReadingVisitor

I deployed a spring based web application into my wildfly server and getting the below exception.


Failed to define class org.springframework.core.type.classreading.ClassMetadataReadingVisitor in Module "deployment.RestfulApp-0.0.1-SNAPSHOT.war:main" from Service Module Loader: java.lang.IncompatibleClassChangeError: class org.springframework.core.type.classreading.ClassMetadataReadingVisitor 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 org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:353)
    at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:432)
    at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:269)
    at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:77)

...

userimage

You face this kind of exception because of version mismatch which seems to be you are using new spring-core jar and old spring-asm jar in your application. ClassMetadataReadingVisitor class is getting loaded from spring-core and ClassVisitor from spring-asm.


And if you are using a spring version which is greater than 3.2.x, you no longer need to include specifically spring-asm since it has been included in spring-core. Its better to Remove or exclude spring-asm from your build definition and ensure that spring-core is there.

Answer is