遇上这个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. Java关键字final、static使用总结(转)

    Java关键字final.static使用总结   一.final        根据程序上下文环境,Java关键字final有“这是无法改变的”或者“终态的”含义,它可以修饰非抽象类.非抽象类成员方 ...

  2. SQL Server LEFT Functions

    LEFT(string, n)函数,是处理字符数据获取子字符串.第一个参数是将要处理的字符串,第二个参数,是从字符串的左边开始截取的字符个数. 例子: DECLARE @string NVARCHAR ...

  3. typedef的用法

    我最开始学习的是C++,而不是C语言.虽说C++涵盖了C,但是C++的语法更加方便,比如输入输出……但是为了与C兼容,常常需要保留C语言的用法,这就比较烦人了,因为我们都希望有一个固定的语法. 首先让 ...

  4. PHP使用mysqli操作MySQL数据库

    PHP的 mysqli 扩展提供了其先行版本的所有功能,此外,由于 MySQL 已经是一个 具有完整特性的数据库服务器 , 这为PHP 又添加了一些新特性 . 而 mysqli 恰恰也支持了 这些新特 ...

  5. JQuery源码分析(三)

    jQuery中ready与load事件 jQuery有3种针对文档加载的方法 $(document).ready(function() { // ...代码... }) //document read ...

  6. ios学习之 关于Certificate、Provisioning Profile、App ID的介绍及其之间的关系

    刚接触iOS开发的人难免会对苹果的各种证书.配置文件等不甚了解,可能你按照网上的教程一步一步的成功申请了真机调试,但是还是对其中的缘由一知半解.这篇文章就对Certificate.Provisioni ...

  7. 【转】同形的JavaScript:Web应用的未来

    原文转自:http://blog.jobbole.com/51786/ 在Airbnb,这几年我们已经学习了很多了关于构建富应用的经验,从2011年通过做我们的网站手机版,我们开始研究single-p ...

  8. c# 多语言实现 与 InitializeCulture

    在实现多语言的时候,我们会使用GetGlobalResourceObject,在服务器控件中显示多语言文本要使用<%$ Resources:Common, Export %>, 但是在设置 ...

  9. Mysql数据库搭建-Windows

    首先先下载一下文件包. 下面这个文件包里面包含了已配置的MySQL5.5和连接器. https://www.dropbox.com/s/iu4ifv0m2232ktn/Win_Mysql5_ODBC. ...

  10. ZOJ 1089 Lotto

    原题链接 题目大意:有一种抽奖游戏乐透(Lotto),规则是从1到49这49个自然数中随机抽取6个数.现在有一种简化版的游戏,先在49个数里面选出k(6<k<13)个数,然后再从这k个数里 ...