Error creating bean with name ‘transactionManager‘ defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is
org.hibernate.service.UnknownUnwrapTypeException: Cannot unwrap to requested type [javax.sql.DataSource]
Caused by: org.hibernate.service.UnknownUnwrapTypeException: Cannot unwrap to requested type [javax.sql.DataSource]
报这个错误的原因是用了下面的配置
<property name="hibernateProperties" value="hibernate.properties"></property>
改成
<property name="dataSource" ref="dataSource"></property> 就可以了
还有就是Sping3.x在整合Hibernate4.x的时候,尽量不要用org.springframework.orm.hibernate3下面的东西,换成org.springframework.orm.hibernate4吧,要不然会有很多莫名其妙的错误,会搞的头大的
时间: 2024-11-07 03:10:27