title: Exception org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class
body: <p>I have been struggling with this error for quite few days.
  I have a maven based project in eclipse. I am trying to deploy the application in Tomcat.
  My versions are :
  Java : JDK 1.7.0_55
  Eclipse : Luna
  Maven : 3.2.1
  Tomcat : 7.0.54</p>
  
  <p>While maven creates the war file properly and gets deployed in standalone Tomcat successfully. The same does not work while I try to publish it within Eclipse.</p>
  
  <p>I receive the following error.</p>
  
  <pre><code>SEVERE: Context initialization failed
  org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.test.testhr.dao.EmployeeDAO] for bean with name 'employeeDAO' defined in ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: com.test.testhr.dao.EmployeeDAO
      at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1327)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:594)
      at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1396)
      at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:959)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:683)
      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.springframewor
  </code></pre>
  
  <p>My web.xml looks like below</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
      id="WebApp_ID" version="2.5"&gt;
  
      &lt;context-param&gt;  
          &lt;param-name&gt;primefaces.THEME&lt;/param-name&gt;  
          &lt;param-value&gt;aristo&lt;/param-value&gt;  
      &lt;/context-param&gt; 
      &lt;servlet&gt;
          &lt;servlet-name&gt;FacesServlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
  
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;FacesServlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/faces/*&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
      &lt;context-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;/WEB-INF/applicationContext.xml&lt;/param-value&gt;
      &lt;/context-param&gt;
  
      &lt;filter&gt;
          &lt;filter-name&gt;AuthenticationFilter&lt;/filter-name&gt;
          &lt;filter-class&gt;com.test.testhr.core.ui.servlet.AuthenticationFilter&lt;/filter-class&gt;
      &lt;/filter&gt;
  
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;AuthenticationFilter&lt;/filter-name&gt;
          &lt;url-pattern&gt;/faces/*&lt;/url-pattern&gt;
      &lt;/filter-mapping&gt;
  
      &lt;listener&gt;
          &lt;listener-class&gt;
          org.springframework.web.context.ContextLoaderListener
          &lt;/listener-class&gt;
      &lt;/listener&gt; 
  
  &lt;/web-app&gt;
  </code></pre>
  
  <p>My applicationContext.xml looks like below.</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:tx="http://www.springframework.org/schema/tx"
      xmlns:context="http://www.springframework.org/schema/context"
      xsi:schemaLocation="http://www.springframework.org/schema/beans
                          http://www.springframework.org/schema/beans/spring-beans.xsd
                          http://www.springframework.org/schema/tx                        
                          http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
                          http://www.springframework.org/schema/context
                          http://www.springframework.org/schema/context/spring-context-3.0.xsd"&gt;
  
      &lt;bean id="entityManagerFactory"
          class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"&gt;
          &lt;property name="dataSource" ref="dataSource" /&gt;
          &lt;property name="loadTimeWeaver"&gt;
              &lt;bean
                  class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver" /&gt;
          &lt;/property&gt;
          &lt;property name="persistenceXmlLocation" value="WEB-INF/persistence.xml" /&gt;
          &lt;property name="persistenceUnitName" value="myUnit" /&gt;
          &lt;property name="persistenceProviderClass" value="org.hibernate.ejb.HibernatePersistence" /&gt;
          &lt;property name="jpaVendorAdapter"&gt;
              &lt;bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" /&gt;
          &lt;/property&gt;
          &lt;property name="jpaProperties"&gt;
              &lt;props&gt;
                  &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.Oracle10gDialect&lt;/prop&gt;
                  &lt;prop key="showSql"&gt;true&lt;/prop&gt;
              &lt;/props&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;tx:annotation-driven transaction-manager="transactionManager"
          proxy-target-class="false" /&gt;
  
      &lt;bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"&gt;
          &lt;property name="dataSource" ref="dataSource" /&gt;
          &lt;property name="entityManagerFactory" ref="entityManagerFactory" /&gt;
      &lt;/bean&gt;
      &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
          destroy-method="close"&gt;
          &lt;property name="driverClassName" value="oracle.jdbc.OracleDriver" /&gt;
          &lt;property name="url" value="jdbc:oracle:thin:@//localhost:1521/orclktlt" /&gt;
          &lt;property name="username" value="testhr" /&gt;
          &lt;property name="password" value="testhr" /&gt;
      &lt;/bean&gt;
  
      &lt;context:component-scan base-package="com" /&gt;
  
      &lt;!-- Declare DAO --&gt;
      &lt;bean id="genericDAO" class="com.test.testhr.dao.GenericDAO"
          abstract="true" /&gt;
      &lt;bean id="employeeDAO" class="com.test.testhr.dao.EmployeeDAO"
          parent="genericDAO" /&gt;
      &lt;bean id="userDAO" class=" com.test.testhr.dao.UserDAO" parent="genericDAO" /&gt;
      &lt;bean id="departmentDAO" class=" com.test.testhr.dao.DepartmentDAO"
          parent="genericDAO" /&gt;
      &lt;bean id="streamDAO" class="com.test.testhr.dao.StreamDAO"
          parent="genericDAO" /&gt;
      &lt;bean id="lookupCodeDAO" class="com.test.testhr.dao.LookupCodeDAO"
          parent="genericDAO" /&gt;
  
  
  
      &lt;!-- Declare Services --&gt;
      &lt;bean id="employeeService" class="com.test.testhr.service.employee.EmployeeService"&gt;
          &lt;!-- &lt;property name="employeeDAO" ref="employeeDAO" /&gt; --&gt;
      &lt;/bean&gt;
      &lt;bean id="logInService" class="com.test.testhr.service.authentication.LogInService" /&gt;
      &lt;bean id="departmentService" class="com.test.testhr.service.settings.DepartmentService"&gt;
          &lt;!-- &lt;property name="departmentDAO" ref="departmentDAO" /&gt; --&gt;
      &lt;/bean&gt;
      &lt;bean id="streamService" class="com.test.testhr.service.settings.StreamService"&gt;
          &lt;!-- &lt;property name="streamDAO" ref="streamDAO" /&gt; --&gt;
      &lt;/bean&gt;
      &lt;bean id="lookupCodeService" class="com.test.testhr.service.settings.LookupCodeService"&gt;
          &lt;!-- &lt;property name="lookupCodeDAO" ref="lookupCodeDAO" /&gt; --&gt;
      &lt;/bean&gt;
  
      &lt;bean id="userService" class="com.test.testhr.service.user.UserService"&gt;
          &lt;!-- &lt;property name="userDAO" ref="userDAO" /&gt; --&gt;
      &lt;/bean&gt;
  
      &lt;!-- Other utility classes --&gt;
  
      &lt;!-- &lt;bean id="lookupCodeCacheUtil" class="com.test.testhr.cache.util.LookupCodeCacheUtil"/&gt; --&gt;
      &lt;!-- &lt;bean id="variableContext" class="com.test.testhr.system.VariableContext" 
          scope="prototype" /&gt; --&gt;
  
      &lt;!-- Security configuration --&gt;
      &lt;!-- &lt;bean id="abstractEncrypptor" class="com.test.testhr.security.encryption.AbstractEncrypptor" 
          abstract="true"&gt; --&gt;
      &lt;!-- &lt;property name="password" value="test" /&gt; --&gt;
      &lt;!-- &lt;property name="pswdIterations" value="65536" /&gt; --&gt;
      &lt;!-- &lt;property name="keySize" value="256" /&gt; --&gt;
      &lt;!-- &lt;/bean&gt; --&gt;
  &lt;/beans&gt;    
  </code></pre>
  
  <p>Can someone help?</p>