title: Spring 3 with Hibernate 3 Annotations - Session Factory Configuration
body: <p>I am having very little luck configuring my spring config file for Hibernate Annotations. I have been looking at other posts and I'm not sure what I am missing. I shouldn't need to define a config file since I am using HibernateProperties in my session factory correct? I`m getting the following error:</p>
  <h1>Error Message</h1>
  <h2>Error creating bean with name 'HibernateSessionFactory'</h2>
  <p>Could not instantiate bean class [org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org.hibernate.cfg.AnnotationConfiguration</p>
  <p>at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:965)</p>
  <h1>Spring Configuration</h1>
  <pre><code>&lt;!--     Defines the hibernate session factory to be used by the hibernate support dao classes --&gt;
  &lt;bean id=&quot;HibernateSessionFactory&quot; class=&quot;org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean&quot; &gt;
      &lt;property name=&quot;dataSource&quot; ref=&quot;webDataSrc&quot; /&gt;
      &lt;property name=&quot;annotatedClasses&quot;&gt; 
              &lt;list&gt; 
                      &lt;value&gt;ca.test.Foo&lt;/value&gt; 
              &lt;/list&gt; 
      &lt;/property&gt;
  
      &lt;property name=&quot;hibernateProperties&quot;&gt;
          &lt;props&gt;
              &lt;prop key=&quot;hibernate.show_sql&quot;&gt;true&lt;/prop&gt;
              &lt;prop key=&quot;debug&quot;&gt;true&lt;/prop&gt;
              &lt;prop key=&quot;hibernate.dialect&quot;&gt;org.hibernate.dialect.OracleDialect&lt;/prop&gt;
              &lt;prop key=&quot;hibernate.cglib.use_reflection_optimizer&quot;&gt;false&lt;/prop&gt;
          &lt;/props&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  <p><img src="https://i.stack.imgur.com/aA3AL.png" alt="enter image description here" /></p>