---
title: "java.lang.NoClassDefFoundError: Lorg/hibernate/cache/CacheProvider;"
author: "abccyz"
date: "2013-12-14T20:48:00Z"
tags: []
slug: "java-lang-noclassdeffounderror-lorg-hibernate-cache-cacheprovider"
draft: false
lastmod: "2013-12-20T09:24:35Z"
id: 1992431
url: "https://abccyz.iteye.com/blog/1992431"
---

整合spring3.1.2+hibernate 4.2报的错：java.lang.NoClassDefFoundError: Lorg/hibernate/cache/CacheProvider;原因是这里的配置导致的：

```
<!-- 数据源的配置 sessionFactory -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="hibernateProperties">
<props>
<!-- 实现数据托管 -->
<prop key="hibernate.hbm2ddl.auto">${dataSource.hbm2ddl.auto}</prop>
<!-- mysql的方言 -->
<prop key="hibernate.dialect">${dataSource.dialect}</prop>
<!-- console 输出 -->
<!-- <prop key="hibernate.format_sql">${dataSource.hibernate.format_sql}</prop> -->
</props>
</property>
```

解决方法：

改成：  
&lt;wbr style="color:rgb(72,72,72); font-family:simsun; font-size:14px; line-height:21px; background-color:rgb(224,227,218)"&gt;&lt;span style="color:rgb(72,72,72); font-family:simsun; font-size:14px; line-height:21px; background-color:rgb(224,227,218)"&gt;&lt;/span&gt;&lt;wbr style="color:rgb(72,72,72); font-family:simsun; font-size:14px; line-height:21px; background-color:rgb(224,227,218)"&gt;&lt;span style="color:rgb(72,72,72); font-family:simsun; font-size:14px; line-height:21px; background-color:rgb(224,227,218)"&gt;class="org.springframework.orm.hibernate4.LocalSessionFactoryBean&lt;/span&gt;&lt;span style="color:rgb(72,72,72); font-family:simsun; font-size:14px; line-height:21px; background-color:rgb(224,227,218)"&gt;"&gt;&lt;/span&gt;&lt;br&gt;&lt;/wbr&gt;&lt;/wbr&gt;