Cannot unwrap to requested type [javax.sql.DataSource]
遇上这个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]的更多相关文章
- 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 ...
- 多个@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 ' ...
- 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 ...
- Failed to bind properties under 'spring.datasource' to javax.sql.DataSource
这是我的配置文件 # 国际化配置文件(包名.基础名) spring.messages.basename=i18n.login server.tomcat.uri-encoding=UTF- sprin ...
- 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 ...
- java.sql和javax.sql的区别
根据 JDBC 规范,javax.sql 包中的类和接口首先作为 JDBC 2.0 可选包提供.此可选程序包以前与 J2SE1.2 中的 java.sql 程序包是分开的.从 J2SE1.4 开始,这 ...
- 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 ...
- 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 ...
- 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 ...
随机推荐
- Scheme vs Schema
在计算机数据描述领域,Scheme由于原意为“主题”,“方案”,“构想”等,因此一般指比较明确的(具体的)“方案”.“体系”,例如一个术语词表.分类表等,而Schema通常翻译成“模式”,比较强调形式 ...
- hdu 2098
ps:TLE一次....因为判断素数的时候没开方...作死.. 代码: #include "stdio.h" #include "math.h" int inp ...
- linux上安装hadoop
机器准备 物理机器 总 共4台,想配置基于物理机的hadoop集群中包括 4 个 节点: 1 个 Master , 3 个 Salve , 节点之间局域网连接,可以相互 ping 通Ip分布 为192 ...
- UID 修改 & UID 锁死修复
首先是UID修改的问题,只要卡是UID卡,就都可以修改UID,首先读卡器连接电脑,卡片放到读卡器上. 然后我们要用一个工具,UID207.打开UID207.exe,点Initialize,初始化. 然 ...
- 算法(第4版)-1.1.1 Java程序的基本结构
开始之前,引用书中的一段话: "学习算法的主要原因是它们能节约非常多的资源,甚至能够让我们完成一些本不可能完成的任务.在某些需要处理上百万个对象的应用程序,设计优良的算法甚至可以将程序运行的 ...
- 一个由印度人编写的VC串口类
http://www.cnblogs.com/lwngreat/p/4098374.html 软件介绍 一个由印度人编写的VC串口类(也是一种VC串口控件),他还配合这个类写了VC 串口通信方面的一些 ...
- Python OpenCV ——Matplotlib显示图片
Color image loaded by OpenCV is in BGR mode.But Matplotlib displays in RGB mode.So color images will ...
- Windows10中无法打开这个应用的解决方案
报错的图:
- Mac可设置环境变量的位置、查看和添加PATH环境变量
Mac 启动加载文件位置(可设置环境变量) 首先要知道你使用的 Mac OS X 是什么样的 Shell,使用命令 echo $SHELL 如果输出的是:csh 或者是 tcsh,那么你用的就是 C ...
- HDU2222 (AC自动机)
AC自动机模板题. 被卡内存了 死活A不掉.. AC自动机参考教程: http://www.cppblog.com/menjitianya/archive/2014/07/10/207604.html ...