title: How can I resolve java.lang.ClassNotFoundException: org.hibernate.util.DTDEntityResolver when using Spring 3.1 with Hibernate 4.0.1?
body: <p>I recently upgraded to Hibernate 4.0.1.Final and am receiving the following error on context startup:</p>
  
  <pre class="lang-none prettyprint-override"><code>Caused by: java.lang.NoClassDefFoundError: org/hibernate/util/DTDEntityResolver
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
      at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2823)
      at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1160)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1655)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1533)
      at org.hibernate.cfg.Configuration.reset(Configuration.java:322)
      at org.hibernate.cfg.Configuration.&lt;init&gt;(Configuration.java:261)
      at org.hibernate.cfg.Configuration.&lt;init&gt;(Configuration.java:265)
      at org.hibernate.ejb.Ejb3Configuration.&lt;clinit&gt;(Ejb3Configuration.java:150)
      at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:71)
      at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:257)
      at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
      ... 65 more
  Caused by: java.lang.ClassNotFoundException: org.hibernate.util.DTDEntityResolver
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1533)
  </code></pre>
  
  <p>My configuration is as follows:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;!-- Holding Properties for hibernate --&gt;
      &lt;context:property-placeholder location="classpath:hibernate.properties"/&gt;
  
      &lt;!-- Configure annotated beans --&gt;
      &lt;context:annotation-config /&gt;
      &lt;context:component-scan base-package="com.mypackage" /&gt;
  
      &lt;!-- Drives transactions using local JPA APIs --&gt;
      &lt;tx:annotation-driven transaction-manager="transactionManager"/&gt;
      &lt;bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"
          p:entityManagerFactory-ref="entityManagerFactory"/&gt;
  
      &lt;!-- Creates a EntityManagerFactory for use with the Hibernate JPA provider --&gt;
      &lt;bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
          p:dataSource-ref="dataSource"
          p:packagesToScan="com.mypackage.entity"
          p:jpaVendorAdapter-ref="jpaAdapter"/&gt;
  
      &lt;bean id="jpaAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"
                  p:showSql="true"
                  p:generateDdl="false"
                  p:database="MYSQL"
                  p:databasePlatform="org.hibernate.dialect.MySQL5InnoDBDialect" /&gt;
  
      &lt;!-- Deploys datasource--&gt;
      &lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"
          p:driverClassName="com.mysql.jdbc.Driver"
          p:url="jdbc:mysql://localhost:${mysql.port}/?zeroDateTimeBehavior=convertToNull"
          p:username="bla"
          p:password="bla123"/&gt;
  
      &lt;bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" /&gt;
  
      &lt;bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" /&gt;
  </code></pre>
  
  <p>Some of the dependencies are:</p>
  
  <pre class="lang-xml prettyprint-override"><code>    &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
          &lt;version&gt;${hibernate.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-annotations&lt;/artifactId&gt;
          &lt;version&gt;3.5.6-Final&lt;/version&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
                  &lt;artifactId&gt;ejb3-persistence&lt;/artifactId&gt;                    
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
                  &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;                  
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
          &lt;version&gt;${hibernate.version}&lt;/version&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;javax.transaction&lt;/groupId&gt;
                  &lt;artifactId&gt;jta&lt;/artifactId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;jboss&lt;/groupId&gt;
                  &lt;artifactId&gt;javassist&lt;/artifactId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
                  &lt;artifactId&gt;hibernate-annotations&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
  
      &lt;properties&gt;
          &lt;hibernate.version&gt;4.0.1.Final&lt;/hibernate.version&gt;
      &lt;/properties&gt;
  </code></pre>
  
  <p>And spring version of: 3.1.0.RELEASE</p>
  
  <p>I am assuming that something is trying to read an xml file.  There are no hibernate xml configurations for hibernate other than the properties file. Persistence.xml does not exist in current setup.  Why or who is seeking a class that does not exist in hibernate 4.0.1?</p>
  
  <p>Any help would greatly be appreciated!</p>