今天在整合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. Memcached安装配置及访问

    1.Memcached键值对访问,对于网页来说,key需要使用uri. 2.Memcached的相关配置 memcached:缓存服务器,但本身无法决定缓存任何数据 一半依赖于客户端,一半依赖于服务端 ...

  2. bool 类型存在数据库中为 0 和 1

    bool 类型存在数据库中为 0 和 1 但是在程序中应该使用  true 和 false 查询. 例如: bIsStart = 0 在数据中bIsStart为 0 sql 查询的时候,使用:sele ...

  3. 【Java布局】FlowLayout布局时设定组件大小

    默认的JPanel中,采用的是FlowLayout布局 下面是api中的定义: JPanel(boolean isDoubleBuffered)           创建具有 FlowLayout 和 ...

  4. PHP用户名用星号处理

    PHP用户名用*号处理: 用户名:英文.中文.中英文混合的.中英文字符混合的 处理为:首字母和末尾保留,中间用*号代替(一个字符直接显示,两个字符:张*,三个以上字符:宋*丹) 首先判断字符中是否包含 ...

  5. 谈谈Activiti中流程对象之间的关系

    详细见:http://www.kafeitu.me/activiti/2012/03/22/workflow-activiti-action.html (咖啡兔好牛!) 详细见: http://blo ...

  6. 把HBITMAP 保存图片文件.

    //VC下把HBITMAP保存为bmp图片 BOOL CtestBitMapDlg::SaveBmp(HBITMAP hBitmap, CString FileName) { HDC hDC; //当 ...

  7. 【转】c3p0详细配置

      官方文档 : http://www.mchange.com/projects/c3p0/index.html <c3p0-config><default-config>&l ...

  8. VLC嵌入网页,终于要成功了!

    <OBJECT classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921" width="640" heig ...

  9. table 排序 添加 删除 等操作

    <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...

  10. Amoeba+Mysql实现数据库读写分离

    一.Amoeba 是什么 Amoeba(变形虫)项目,专注 分布式数据库 proxy 开发.座落与Client.DB Server(s)之间.对客户端透明.具有负载均衡.高可用性.sql过滤.读写分离 ...