Spring事务管理器(注释样式)运行时错误

因此,当我在glassfish应用程序服务器中加载战争时,基本上我得到了一个例外。 我在我的mysql数据库中使用Spring的事务管理器。 报告的错误(完整堆栈跟踪)如下:

java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0': Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotationUtils.getAnnotation(Ljava/lang/reflect/AnnotatedElement;Ljava/lang/Class;)Ljava/lang/annotation/Annotation; 

我的applicationContext.xml文件如下:

                         

我发现这个错误非常神秘,因为它正在抱怨的类甚至不在我的应用程序Context中。 我顺便使用Spring 3.1。 感谢您的任何建议或帮助。

查看您的类路径并确保那里只有一个版本的所有Spring依赖项。

显然你的应用程序使用的是旧版本的spring-core*.jar 。 确保所有Spring JAR都在3.1.x版本中,并且您没有重复项。

spring-core*.jar包含3.1中引入的AnnotationUtils.getAnnotation()方法。