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 ...
随机推荐
- node.js 学习书籍推荐
今天向大家推荐一本node.js开发的书籍,本人刚刚看完. 建议:如果你是node.js小白,下边的介绍你可以看一下,如果不是请直接return. <Node.js开发指南>是一本带有开发 ...
- Linux中的汇编简介
GNU as汇编语法 GNU汇编语法使用的是AT&T汇编它和Intel汇编的语法主要有以下一些不同: AT&T汇编中的立即操作数前面要加上'$',寄存器操作数名前要加上百分号'%',绝 ...
- vijos 1741 观光公交
TMD这种题有什么意思啊...敲着都烦啊...感觉啥都没有用就敲完了...光考个贪心有什么意思啊. 反正不想写.NOIP遇到了...管他呢. #include<iostream> #inc ...
- iptables 用法
又有人攻击服务器了,没有办法又的去防,这里简单介绍一种限制指定IP访问的办法. 单个IP的命令是 iptables -I INPUT -s 59.151.119.180 -j DROP 封IP段的命 ...
- Cash Machine_多重背包
Description A Bank plans to install a machine for cash withdrawal. The machine is able to deliver ap ...
- 【Bear】api分类
参考 jQuery API 中文文档
- 让IE9支持html5
IE10以上才算是真正支持了html5 ,但仍然有些地方和别的浏览器不一致,比如要在js里移除一个html标签, 如果是IE,document.getElementById("a" ...
- win7录屏工具
psr.exe http://jingyan.baidu.com/article/aa6a2c14d330710d4d19c47c.html
- linux监控nmon和analyser的使用
测试压力的时候使用linux一个简单的监控工具nmon,不仅可以实时监测,也可以生成文件以图标样式展现,小巧实用 安装nmon nmon实际上是个tarball直接解压到所要放置的目录,然后直接运行就 ...
- Linux(Ubuntu 13)下安装Eclipse
1.本机配置及软件情况: Ubuntu版本:Ubuntukylin-13.10-desktop-i386(32位) JDK:jdk1.7.0_15(jdk-7u15-i856.gz) eclipse: ...