今天在整合ssh(spring-framework-3.2.5.RELEASE-dist+struts-2.3.15.3-all+hibernate-release-4.2.6.Final)环境的时候,集成了hibernate和spring,经过单元测试,没有问题,集成成功。但是在导入structs包后,项目报错,具体错误如下:

  Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [bean.xml]: Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [bean.xml]: 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;

找不到 getAnnotation(AnnotatedElement ae,Class<T> annotatetype)这样的方法,于是我查找了项目中使用spring版本的文档,发现下面这个方法:

 

public static <T extends Annotation> T getAnnotation(AnnotatedElement ae,
Class<T> annotationType)
Get a single Annotation of annotationType from the supplied Method, Constructor or Field. Meta-annotations will be searched if the annotation is not declared locally on the supplied element.
Parameters:
ae - the Method, Constructor or Field from which to get the annotation
annotationType - the annotation class to look for, both locally and as a meta-annotation
Returns:
the matching annotation or null if not found
Since:
3.1

  文档中显示,3.1以后版本才有这个方法,这是就猜想项目中是不是有3.1一下版本的spring核心包,经过查找,在struts-2.3.15.3这个版本中包含了spring-core-3.0.5.RELEASE.jar这样一个jar包,低于3.1版本。

  在项目中删除spring-core-3.0.5.RELEASE.jar这个jar,问题就解决了

  另外:使用struts-2.3.15.3 需要注意,此版本中包含了包含里除了spring-core-3.0.5.RELEASE.jar以外的spring需要3.0.5版本的jar包,在使用的时候都需要删除

ssh整合,导入structs包后报错 getAnnotation(AnnotatedElement ae,Class<T> annotatetype)找不到的更多相关文章

  1. PyCharm导入tensorflow包报错的问题

    [注]PyCharm导入tensorflow包报错的问题 若是你也遇到这个问题,说明你也没有理解tensorflow到底在哪里. 当安装了anaconda3.6后,在PyCharm中设置interpr ...

  2. Android Studio项目导入aar包报错

    最近在试着接入TrPay的sdk,根据它家文档需要导入它们的aar包(paysdk-release-1.2.2.aar). 在AS中怎么给安卓项目导入aar包,网上搜一下就能看到无非也就下面三步: 1 ...

  3. paycharm导入webdriver包报错:module 'selenium.webdriver' has no attribute 'Firefox'

    首先:试试看在cmd中试试输入from selenium import webdriver,看是否报错,看一看是不是pycharm的原因.经过确认,在dos窗口中输入导入包的命令并没有报错.最后我重现 ...

  4. eclipse导入项目之后报错

    一.项目本身就有错 二.jdk版本的问题 参考网址:http://jingyan.baidu.com/article/95c9d20da3ec5fec4e756186.html 从别的地方导入一个项目 ...

  5. Android源代码编译apk导入第三方包报错

    报错内容例如以下: make: *** 没有规则能够创建"out/target/common/obj/APPS/ AndroidWFS_intermediates/classes-full- ...

  6. ssh整合思想 Spring与Hibernate的整合ssh整合相关JAR包下载 .MySQLDialect方言解决无法服务器启动自动update创建表问题

    除之前的Spring相关包,还有structs2包外,还需要Hibernate的相关包 首先,Spring整合其他持久化层框架的JAR包 spring-orm-4.2.4.RELEASE.jar  ( ...

  7. IDEA 导入 Maven 项目后报错 cannot resolve symbol 解决办法

    这两天整理项目,导入新的 Maven 项目时出现 cannot resolve symbol ,即使 rebuild 也没有用.解决办法如下: 1. File -> Close Project: ...

  8. SSH整合后tomcat启动报错SEVERE: Exception starting filter struts2 java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor

    错误信息:  SEVERE: Exception starting filter struts2 java.lang.NoClassDefFoundError: org/objectweb/asm/C ...

  9. Vite + TS 项目导入 jQuery 包时报错:Could not find a declaration file

    TypeScript 需要类型标注,当使用第三方库(除 ts 以外写的库,即 js)时,又缺少声明文件,我们需要引用它的声明文件,才能获得对应的代码补全.接口提示等功能.jQuery 不是 TypeS ...

随机推荐

  1. sasscore22

    1.setting 如果不需要支持ie6,7,请在引入setting文件之前,设置$lte7:false;. $lte7: true !default  表示的是是否兼容it6/7 2.css3 是一 ...

  2. Scrum7.0

    Sprint回顾 让我们一次比一次做得更好. 1.回顾组织 主题:“我们怎样才能在下个sprint中做的更好?” 时间:1个小时 参与者:整个团队 场所:课室 秘书:陈程 2.回顾流程 (1)spri ...

  3. php sleep()的实时输出打印,清除ob缓冲区

    @ini_set('implicit_flush',1);ob_implicit_flush(1);@ob_end_clean(); echo 1;//echo str_repeat('', 1024 ...

  4. Python全栈开发day6

    1. 简介 正则表达式本身是一种小型的.高度专业化的编程语言,而在python中,通过内嵌集成re模块,程序媛们可以直接调用来实现正则匹配.正则表达式模式被编译成一系列的字节码,然后由用C编写的匹配引 ...

  5. Makefile <网络转载>

    陈皓 (CSDN)概述——什 么是makefile?或许很多Winodws的程序员都不知道这个东西,因为那些Windows的IDE都为你做了这个工作,但我觉得要作一个好的和 professional的 ...

  6. Java继承,多态,组合应用

    继承:  面向对象的三大特征之一:    是类和类之间的一种拓展关系,是一种从一般到特殊的关系;    格式: sub   extends Super,  我们把sub称为子类或者拓展类, 把supe ...

  7. centos如何卸载软件

    需要看你的软件包格式: 如果你带有yum,可以直接yum remove xxx如果是rpm包,rpm -e xxxtar包的话需要你直接删除该文件或者make uninstall xxx常见的就这三种

  8. 'Missing recommended icon file - The bundle does not contain an app icon for iPhone / iPod Touch of exactly '120x120' pixels, in .png format'

    创建120像素的高分辨率和60个像素定期如上,苹果文档中提到,并设置名称的新图标.例如,icon-120.png和icon-152.png. 将这个图标到你的项目资源文件夹并添加该图标到项目: 在此之 ...

  9. Linux基础-目录结构

    /:根目录 /bin:存放可执行程序(二进制文件) /etc:存放系统或者用户安装的软件所用的一些配置文件 /lib:操作系统运行时候使用的一些基本动态库 /media:自动挂载外设,会将外设挂载到该 ...

  10. selenium第二课(脚本录制seleniumIDE的使用)

    一.Selenium也具有录制功能,可以web中回放,录制的脚本可以转换为java.python.ruby.php等多种脚本语言.seleniumIDE是Firefox的一个插件,依附于Firefox ...