遇上这个bug我的情况是这样,hibernate4以后,spring3.1不再有hibernateDaoSupport,在dao层不能继承HibernateDaoSupport,

只能显式声明SessionFactory,并且设置get/set方法。

不确定的说:

       在hibernate4以后,session管理变动较大,spring也变了,所以DataSource要在applicationContext.xml里面配置

<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">

<property name="dataSource" ref="dataSource"/>

...

</bean>

如果你在hibernate.cfg.xml里面配置了,就会报出Cannot unwrap to requested type [javax.sql.DataSource]错误。

Cannot unwrap to requested type [javax.sql.DataSource]的更多相关文章

  1. Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource] for property 'dataSource': no matching editors or conversion strategy found

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFa ...

  2. 多个@bean无法通过@resource注入对应的bean(org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type 'javax.sql.DataSource' available: expected single matching bean but found )

    一.异常 org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type ' ...

  3. STS中不同包但相同类名引起的问题:A component required a bean of type 'javax.activation.DataSource' that could not be found

    1. 问题输出: APPLICATION FAILED TO START*************************** Description: A component required a ...

  4. Failed to bind properties under 'spring.datasource' to javax.sql.DataSource

    这是我的配置文件 # 国际化配置文件(包名.基础名) spring.messages.basename=i18n.login server.tomcat.uri-encoding=UTF- sprin ...

  5. springBoot配置druid监控报错Failed to bind properties under 'spring.datasource.druid' to javax.sql.DataSource

    报错信息: Description: Failed to bind properties under 'spring.datasource.druid' to javax.sql.DataSource ...

  6. java.sql和javax.sql的区别

    根据 JDBC 规范,javax.sql 包中的类和接口首先作为 JDBC 2.0 可选包提供.此可选程序包以前与 J2SE1.2 中的 java.sql 程序包是分开的.从 J2SE1.4 开始,这 ...

  7. The type javax.ws.rs.core.MediaType cannot be resolved. It is indirectly referenced from required .class files

    看到了http://stackoverflow.com/questions/5547162/eclipse-error-indirectly-referenced-from-required-clas ...

  8. ORA-12520: TNS:listener could not find available handler for requested type of server

    当你碰到ORA-12520错误时,如下所示: 英文错误提示: ORA-12520: TNS:listener could not find available handler for requeste ...

  9. eclipse中 报出The type javax.servlet.http.HttpServlet cannot be resolved. It is indirect错误

    在Myeclispe部署项目后 报错 The type javax.servlet.http.HttpServlet cannot be resolved. It is indirect错误 如果在M ...

随机推荐

  1. hdoj-2021

    #include "stdio.h"void calculate(int number,int &a,int &b,int &c,int &d,in ...

  2. 在windows 、linux下读取目录下所有文件名

    Windows要引入的头文件是<Windows.h> 主要是两个函数FindFirstFile.FindNextFile MSDN里是这么说的: FindFirstFile functio ...

  3. 二、XML约束

    XML约束有dtd约束和Schema约束两种 dtd约束:可以在xml内部写dtd约束也可以在xml中引用外部dtd文件 book.dtd<!ELEMENT 书架 (书+)>    < ...

  4. 8、网页制作Dreamweaver(jQuery基础:安装、语法)

    在<网页制作Dreamweaver(悬浮动态分层导航)>中,运用到了jQuery的技术,轻松实现了菜单的下拉.显示.隐藏的效果,不必再用样式表一点点地修改,省去了很多麻烦,那么jQuery ...

  5. 解决div里插入img下边缝隙问题

    <html>   <head>   <title> new document </title>   <meta name="author ...

  6. Oracle 触发器,事物

    触发器:自动执行,可以实现表的约束. 1.行级触发器: CREATE OR REPLACE TRIGGER del_deptid AFTER DELETE ON deptment --触发器条件 DE ...

  7. LRU

    rsms/js-lru LRU缓存介绍与实现 (Java) 使用场景 缓存计算结果

  8. 【Better Code】repeat

    <JavaScript 框架设计> 版本1: function repeat(target, n) { return (new Array(n + 1)).join(target) } 版 ...

  9. Iptables 规则 一些简单实例和详细介绍

    设定规则 iptables -p INPUT DROP iptables -p OUTPUT ACCEPT iptables -p FORWARD DROP 1.防止外网用内网IP欺骗 iptable ...

  10. iOS学习笔记---c语言学习第七天

      结构体 结构体是一种自定义的数据类型 struct 结构体名 { 类型说明符  成员名: … 类型说明符  成员名: }: #import <Foundation/Foundation.h& ...