when I run my junit test I can get right result and the data can be stored into database.
when I deploy my project into tomcat, I got this exception.
my spri
The correct signature is
public static <A extends Annotation> A getAnnotation(Method method,
Class<A> annotationType)
but something tries to call
public static <A extends Annotation> A getAnnotation(AnnotatedElement element,
Class<A> annotationType)
The second method was introduced with spring 3.2.0 (at least I haven't found in APIs upto spring 3.0) spring 3.1 (thanks to Sebastien) so you most likely have used spring 3.1 or higher for building your application and a version prior to 3.1 on tomcat. Investigate in that direction.
You haven't correctly deployed the Spring libraries to your instance of Tomcat.
You'd better past the full stack with the causes, it would help (not much in this case but it's always better)
Since you get a NoSuchMethodError, it seems the AnnotationUtils class is found, but the method called getAnnotation may not be found. So at runtime i think the wrong version of the class could be used.
You should check on your webapp folder which version of spring is deployed, and check that version have the "getAnnotation" method.
You can check there: https://fisheye.springsource.org/browse/spring-framework/org.springframework.core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java
Notice that it seems the classes have been reorganized on the master branch (are you using that???)
You should also perform a mvn dependency:tree and check the spring versions here, see if you don't have many different spring versions here, and if it's the case, use the dependency exclusion, or the dependency management tag of maven to specify exactly which version you want to use