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 ...
随机推荐
- hadoop中Text类 与 java中String类的区别
hadoop 中 的Text类与java中的String类感觉上用法是相似的,但两者在编码格式和访问方式上还是有些差别的,要说明这个问题,首先得了解几个概念: 字符集: 是一个系统支持的所有抽象字符的 ...
- java互斥方法
synchronized, lock/unlock, volatile类型变量, atom类, 同步集合, 新类库中的构件: CountDownLatch\CyclicBarric\Semaph ...
- 给宏基装WIN8.1系统之问题与解决方法(原创)
1.采用老毛桃U盘PE进入笔记本: 2.备份桌面文件以防丢失: 3.将下载好的Win8操作系统镜像加载到虚拟光驱,最好把操作系统拷贝到笔记本硬盘上,不然可能会出现意想不到的错误: 4.打开老毛桃桌面安 ...
- BZOJ 1968 约数研究
其实打个表就会发现,这个玩意儿是积性的,然后很happy的搞了一下. 不,不是这样. 考虑每个约数对答案的贡献,不难发现:约数i的贡献为n/i. 加之即可. #include<iostream& ...
- 查询所有表的记录数SQLServer
SELECT object_name (i.id) TableName, rows as RowCnt FROM sysindexes i INNER JOIN sysObj ...
- iOS打包为ipa的两种方式和生成P12证书的方式
iOS项目打包为ipa的两种方式: 准备工作:先行在Xcode里面打开preferences,填写apple id. 通过iTunes+Xcode 在Xcode里,把模拟器调整为iOS Device, ...
- IDataReader转换成list通用方法
public static IList<T> ReaderToList<T>(this IDataReader dr) { //DateTime dt = DateTime.N ...
- 301、404、200、304、500等HTTP状态,代表什么意思?
一些常见的状态码为: 200 - 服务器成功返回网页 404 - 请求的网页不存在 503 - 服务器超时 下面提供 HTTP 状态码的完整列表.点击链接可了解详情.您也可以访问 HTTP 状态码上的 ...
- 计算机硕士工资一览表 08年最新各大IT公司薪水行
编号:1017时间:2016年6月13日11:26:20功能:计算机硕士工资一览表 08年最新各大IT公司薪水行 URL :http://blog.csdn.net/icerock2000/artic ...
- MAVEN ERROR : Dynamic Web Module 3.0 requires Java 1.6 or newer
问题: 在eclipse中,通过Maven->Update Project更新项目后,出现Dynamic Web Module 3.0 requires Java 1.6 or newer错误提 ...