Alfred’s Computing Weblog

Alfred Java-cored Computing Weblog

Posts Tagged ‘GenericTypeResolver

Spring | NoSuchMethodError: GenericTypeResolver

with 4 comments

ERROR: java.lang.NoSuchMethodError: org.springframework.core.GenericTypeResolver.resolveTypeArguments(Ljava/lang/Class;Ljava/lang/Class;)[Ljava/lang/Class;

STORY:
I am starting a new webapps recently, since its a new webapps, I decided to use the latest Spring version 3.1.0.M2. Everything looks fine when the development is still in standalone environment. After dive into the development, the webapps I’m working on need to ‘talk’ to some other existing components in the system. After I have integrated my webapps with the existing components and I restart my tomcat, I get the error java.lang.NoSuchMethodError: org.springframework.core.GenericTypeResolver.resolveTypeArguments(Ljava/lang/Class;Ljava/lang/Class;)[Ljava/lang/Class;

First of all, for Java developer, when you see ‘NoSuchMethodError’, you will directly check the existence of the mentioned method in your JAR file. But ‘sadly’ the mentioned class file and method is there.

SOLUTION:
Thanks to Google, I got my answer in Spring Forum. The answer is pretty simple, I have more than 1 version of Spring in the classpath. As mentioned earlier, the new webapps is running on latest Spring (v3.1.0.M2) but the existing components I integrates with only running on Spring v2.5. So, pls ensure that there is only ONE SPRING VERSION in your classpath.

Written by Alfred

June 20, 2011 at 18:02