Spring+Hibernate Error: org.hibernate.service.UnknownUnwrapTypeException: Cannot unwrap to requested
来源:互联网 发布:单片机串口通讯程序 编辑:程序博客网 时间:2024/06/09 18:51
环境:MyEclipse2015+maven3
框架:Spring3.1.1+Hibernate4.1.3
注:Spring 3.0.5以下版本不支持Hinernate4.
错误:org.hibernate.service.UnknownUnwrapTypeException: Cannot unwrap to requested type [javax.sql.DataSource]
解决方案:applicationContext.xml中配置datasource。
<!-- 配置SessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
</bean>
<!-- datasource -->
<bean id="datasource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/ssh_demo" />
<property name="username" value="alan" />
<property name="password" value="123456" />
</bean>
<!-- 配置事务管理器 -->
<bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
<property name="dataSource" ref="datasource"></property>
</bean>
结构:解决错误
- Spring+Hibernate Error: org.hibernate.service.UnknownUnwrapTypeException: Cannot unwrap to requested
- Spring+Hibernate Error: org.hibernate.service.UnknownUnwrapTypeException: Cannot unwrap to requeste
- spring和hibernate整合的时候一个错误Cannot unwrap to requested type [javax.sql.DataSource]
- Unable to create requested service [org.hibernate.engine.spi.CacheImple
- org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine
- org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine
- hibernate异常Unable to create requested service [org.hibernate.engine.spi.CacheImple
- Hibernate:Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
- hibernate 报错Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
- Unable to create requested service [org.hibernate.service.jdbc.connections.spi.ConnectionProvider]
- Unable to create requested service [org.hibernate.service.jdbc.connections.spi.ConnectionProvider]
- Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
- tomcat 启动报错, Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
- Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
- Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
- Cannot unwrap to requested type [javax.sql.DataSource]
- Cannot unwrap to requested type [javax.sql.DataSource]
- Cannot unwrap to requested type [javax.sql.DataSource] 的解决办法
- c/c++ sizeof运算符详解以及对象大小
- Linux下第一次使用MySQL数据库,设置密码
- 'Cursor' object has no attribute '_last_executed'
- Fiddler抓取手机http请求
- Solr服务安装(Windows)
- Spring+Hibernate Error: org.hibernate.service.UnknownUnwrapTypeException: Cannot unwrap to requested
- LCM的个数 UVa10892
- Oracle 备份脚本
- linux的tar命令压缩和解压缩文件
- SAP中负数的表示增强 负号从数字后更改到数字前面
- LeetCode中Count Primes的java实现
- 4.1 eclipse -android 中文乱码的解决
- Logstash
- Oracle LISTAGG排重方法