title: org.springframework.beans.factory.BeanCreationException Error creating bean with name 'sessionFactory' defined in ServletContext
body: <p>I try to deploy the application, but the console show me this error, I'm not familiar with Spring MVC and Hibernate 3 this is my first project </p>
  
  <pre><code> org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: component class not found: com.GestionEtudiant.model.EtudiantId
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
          at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
          at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
          at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)
          at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
          at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:684)
          at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)
          at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
          at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
          at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
          at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
          at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4701)
          at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5204)
          at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5199)
          at java.util.concurrent.FutureTask.run(Unknown Source)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
          at java.lang.Thread.run(Unknown Source)
      Caused by: org.hibernate.MappingException: component class not found: com.GestionEtudiant.model.EtudiantId
          at org.hibernate.mapping.Component.getComponentClass(Component.java:104)
          at org.hibernate.tuple.component.PojoComponentTuplizer.buildGetter(PojoComponentTuplizer.java:133)
          at org.hibernate.tuple.component.AbstractComponentTuplizer.&lt;init&gt;(AbstractComponentTuplizer.java:43)
          at org.hibernate.tuple.component.PojoComponentTuplizer.&lt;init&gt;(PojoComponentTuplizer.java:38)
          at org.hibernate.tuple.component.ComponentEntityModeToTuplizerMapping.&lt;init&gt;(ComponentEntityModeToTuplizerMapping.java:52)
          at org.hibernate.tuple.component.ComponentMetamodel.&lt;init&gt;(ComponentMetamodel.java:50)
          at org.hibernate.mapping.Component.buildType(Component.java:152)
          at org.hibernate.mapping.Component.getType(Component.java:145)
          at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253)
          at org.hibernate.mapping.RootClass.validate(RootClass.java:193)
          at org.hibernate.cfg.Configuration.validate(Configuration.java:1102)
          at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1287)
          at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:805)
          at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:745)
          at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:134)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1612)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1549)
          ... 19 more
      Caused by: java.lang.ClassNotFoundException: com.GestionEtudiant.model.EtudiantId
          at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
          at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
          at java.lang.Class.forName0(Native Method)
          at java.lang.Class.forName(Unknown Source)
          at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:100)
          at org.hibernate.mapping.Component.getComponentClass(Component.java:101)
          ... 35 more
  </code></pre>
  
  <p>application-context.xml code </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
      xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
      xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
          http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
          http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"&gt;
  
      &lt;bean id="propertyConfigurer"
          class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
          p:location="/WEB-INF/jdbc.properties" /&gt;
  
      &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
          destroy-method="close" p:driverClassName="${jdbc.driverClassName}"
          p:url="${jdbc.url}" p:username="${jdbc.username}" p:password="${jdbc.password}" /&gt;
  
      &lt;!-- ADD PERSISTENCE SUPPORT HERE (jpa, hibernate, etc) --&gt;
      &lt;bean id="sessionFactory"
          class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"&gt;
          &lt;property name="dataSource" ref="dataSource" /&gt;
          &lt;property name="mappingResources"&gt;
              &lt;list&gt;
                  &lt;value&gt;com/GestionEtudiant/model/Etudiant.hbm.xml&lt;/value&gt;
                  &lt;value&gt;com/GestionEtudiant/model/Commentaire.hbm.xml&lt;/value&gt;
                  &lt;value&gt;com/GestionEtudiant/model/Ensiegnant.hbm.xml&lt;/value&gt;
                  &lt;value&gt;com/GestionEtudiant/model/Person.hbm.xml&lt;/value&gt;
                  &lt;value&gt;com/GestionEtudiant/model/Compte.hbm.xml&lt;/value&gt;
                  &lt;value&gt;com/GestionEtudiant/model/Groupe.hbm.xml&lt;/value&gt;
                  &lt;value&gt;com/GestionEtudiant/model/Fiche.hbm.xml&lt;/value&gt;
                  &lt;value&gt;com/GestionEtudiant/model/Sujet.hbm.xml&lt;/value&gt;
                  &lt;value&gt;com/GestionEtudiant/model/Document.hbm.xml&lt;/value&gt;
              &lt;/list&gt;
          &lt;/property&gt;
          &lt;property name="hibernateProperties"&gt;
              &lt;props&gt;
                  &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/prop&gt;
                  &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;
                  &lt;prop key="hibernate.hbm2ddl.auto"&gt;update&lt;/prop&gt;
              &lt;/props&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;!-- Transaction Manager --&gt;
      &lt;bean id="txManager"
          class="org.springframework.orm.hibernate3.HibernateTransactionManager"&gt;
          &lt;property name="sessionFactory" ref="sessionFactory" /&gt;
      &lt;/bean&gt;
  
      &lt;!-- Service --&gt;
      &lt;bean id="compteService"
          class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"&gt;
          &lt;property name="target"&gt;
              &lt;bean class="com.GestionEtudiant.service.CompteServiceImp"&gt;
                  &lt;property name="compteDAO" ref="compteDAO" /&gt;
              &lt;/bean&gt;
          &lt;/property&gt;
          &lt;property name="transactionAttributes"&gt;
              &lt;props&gt;
                  &lt;prop key="get*"&gt;PROPAGATION_SUPPORTS,readOnly&lt;/prop&gt;
                  &lt;prop key="*"&gt;PROPAGATION_REQUIRED&lt;/prop&gt;
              &lt;/props&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
      &lt;!-- DAO --&gt;
      &lt;bean id="compteDAO" class="com.GestionEtudiant.dao.CompteDAOHib"
          p:sessionFactory="sessionFactory" p:sessionFactory-ref="sessionFactory" /&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>Dispatcher-servlet.xml code is :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
      xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
      xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
         http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
         http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"&gt;
  
      &lt;!-- Action Handling --&gt;
      &lt;!-- BeanNameUrlHandlerMapping This configuration is optional because BeanNameUrlHandlerMapping 
          is the default handler. In case no handler mapping is found in the web application 
          context, SpringMVC will create an instance of BeanNameUrlHandlerMapping. --&gt;
      &lt;bean name="beanNameUrlHandlerMapping"
          class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping" /&gt;
  
      &lt;!-- SimpleUrlHandlerMapping The BeanNameUrlHandlerMapping class does not 
          support wildcards to resolve a request URL to a bean name. Configuration 
          can be simplified with Apache Ant–style wildcard path mapping with the SimpleUrlHandlerMapping. 
          &lt;bean name="simpleUrlHandlerMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"&gt; 
          &lt;property name="mappings"&gt; &lt;props&gt; &lt;prop key="/*.html"&gt;&lt;/prop&gt; &lt;/props&gt; &lt;/property&gt; 
          &lt;/bean&gt; --&gt;
      &lt;!-- ControllerClassNameHandlerMapping &lt;bean name="controllerClassNameHandlerMapping" 
          class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping"/&gt; --&gt;
      &lt;!-- end of Action Handling --&gt;
  
  
      &lt;!-- View Handler --&gt;
      &lt;!-- InternalResourceViewResolver The InternalResourceViewResolver class 
          can determine the physical view in the web application archive given the 
          logical view name. --&gt;
      &lt;bean id="viewResolver"
          class="org.springframework.web.servlet.view.InternalResourceViewResolver"
          p:prefix="/WEB-INF/jsp/" p:suffix=".jsp" /&gt;
      &lt;!-- ResourceBundleViewResolver It allows the logical view name to physical 
          resource mapping to be configured in externalized properties or resource 
          bundle files. &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.ResourceBundleViewResolver"&gt; 
          &lt;property name="basename" value=""/&gt; &lt;/bean&gt; --&gt;
      &lt;!-- XmlViewResolver To use an XML-based view resolver, configuration information 
          should be moved in XML files from the properties file. This view configuration 
          file should be located in the WEB-INF folder and is called views.xml by default. 
          &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.XmlViewResolver"/&gt; --&gt;
      &lt;!-- end of View Handler --&gt;
  
  
      &lt;!-- Page Controller --&gt;
  
      &lt;bean name="/Comptes.html" class="com.affectation.controller.CompteController"
          p:compteService="compteService" p:compteService-ref="compteService" /&gt;
  &lt;!-- end of Page Controller --&gt;
  
  
      &lt;!-- &lt;bean id="springUtilInitializer" class="com.affectation.controller.SpringApplicationContextHolder" 
          lazy-init="false" /&gt; --&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>web.xml code is :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
      xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
      xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
         http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
         http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"&gt;
  
      &lt;!-- Action Handling --&gt;
      &lt;!-- BeanNameUrlHandlerMapping This configuration is optional because BeanNameUrlHandlerMapping 
          is the default handler. In case no handler mapping is found in the web application 
          context, SpringMVC will create an instance of BeanNameUrlHandlerMapping. --&gt;
      &lt;bean name="beanNameUrlHandlerMapping"
          class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping" /&gt;
  
      &lt;!-- SimpleUrlHandlerMapping The BeanNameUrlHandlerMapping class does not 
          support wildcards to resolve a request URL to a bean name. Configuration 
          can be simplified with Apache Ant–style wildcard path mapping with the SimpleUrlHandlerMapping. 
          &lt;bean name="simpleUrlHandlerMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"&gt; 
          &lt;property name="mappings"&gt; &lt;props&gt; &lt;prop key="/*.html"&gt;&lt;/prop&gt; &lt;/props&gt; &lt;/property&gt; 
          &lt;/bean&gt; --&gt;
      &lt;!-- ControllerClassNameHandlerMapping &lt;bean name="controllerClassNameHandlerMapping" 
          class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping"/&gt; --&gt;
      &lt;!-- end of Action Handling --&gt;
  
  
      &lt;!-- View Handler --&gt;
      &lt;!-- InternalResourceViewResolver The InternalResourceViewResolver class 
          can determine the physical view in the web application archive given the 
          logical view name. --&gt;
      &lt;bean id="viewResolver"
          class="org.springframework.web.servlet.view.InternalResourceViewResolver"
          p:prefix="/WEB-INF/jsp/" p:suffix=".jsp" /&gt;
      &lt;!-- ResourceBundleViewResolver It allows the logical view name to physical 
          resource mapping to be configured in externalized properties or resource 
          bundle files. &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.ResourceBundleViewResolver"&gt; 
          &lt;property name="basename" value=""/&gt; &lt;/bean&gt; --&gt;
      &lt;!-- XmlViewResolver To use an XML-based view resolver, configuration information 
          should be moved in XML files from the properties file. This view configuration 
          file should be located in the WEB-INF folder and is called views.xml by default. 
          &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.XmlViewResolver"/&gt; --&gt;
      &lt;!-- end of View Handler --&gt;
  
  
      &lt;!-- Page Controller --&gt;
  
      &lt;bean name="/Comptes.html" class="com.affectation.controller.CompteController"
          p:compteService="compteService" p:compteService-ref="compteService" /&gt;
  &lt;!-- end of Page Controller --&gt;
  
  
      &lt;!-- &lt;bean id="springUtilInitializer" class="com.affectation.controller.SpringApplicationContextHolder" 
          lazy-init="false" /&gt; --&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>EtudiantId class code is :</p>
  
  <pre><code>package com.GestionEtudiant.model;
  
  
      public class EtudiantId implements java.io.Serializable {
  
          /**
           * 
           */
          private static final long serialVersionUID = 1L;
          private int idPersonne;
          private int idEtudiant;
  
          public EtudiantId() {
          }
  
          public EtudiantId(int idPersonne, int idEtudiant) {
              this.idPersonne = idPersonne;
              this.idEtudiant = idEtudiant;
          }
  
          public int getIdPersonne() {
              return this.idPersonne;
          }
  
          public void setIdPersonne(int idPersonne) {
              this.idPersonne = idPersonne;
          }
  
          public int getIdEtudiant() {
              return this.idEtudiant;
          }
  
          public void setIdEtudiant(int idEtudiant) {
              this.idEtudiant = idEtudiant;
          }
  
          public boolean equals(Object other) {
              if ((this == other))
                  return true;
              if ((other == null))
                  return false;
              if (!(other instanceof EtudiantId))
                  return false;
              EtudiantId castOther = (EtudiantId) other;
  
              return (this.getIdPersonne() == castOther.getIdPersonne())
                      &amp;&amp; (this.getIdEtudiant() == castOther.getIdEtudiant());
          }
  
          public int hashCode() {
              int result = 17;
  
              result = 37 * result + this.getIdPersonne();
              result = 37 * result + this.getIdEtudiant();
              return result;
          }
  
      }
  </code></pre>