title: Error in autowiring Beans despite declare in the xml file when testing
body: <p>I have the beans.xml as follows:</p>
  
  <pre><code> &lt;beans xmlns="http://www.springframework.org/schema/beans"
          xmlns:context="http://www.springframework.org/schema/context"
          xmlns:tx="http://www.springframework.org/schema/tx"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="
          http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
          http://www.springframework.org/schema/context
          http://www.springframework.org/schema/context/spring-context-3.2.xsd
          http://www.springframework.org/schema/tx
          http://www.springframework.org/schema/tx/spring-tx-3.2.xsd"&gt;
  
          &lt;context:component-scan base-package="no.uio.inf5750.assignment2" /&gt;
  
          &lt;!-- Hibernate part of assignment 2 --&gt;
          &lt;tx:annotation-driven transaction-manager="transactionManager"/&gt;
  
          &lt;bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"&gt;
              &lt;property name="sessionFactory" ref="sessionFactory" /&gt;
              &lt;property name="dataSource" ref="dataSource" /&gt;
          &lt;/bean&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;hibernate/Course.hbm.xml&lt;/value&gt;
                      &lt;value&gt;hibernate/Student.hbm.xml&lt;/value&gt;
                      &lt;value&gt;hibernate/Degree.hbm.xml&lt;/value&gt;
                  &lt;/list&gt;
              &lt;/property&gt;
              &lt;property name="hibernateProperties"&gt;
                  &lt;props&gt;
                  &lt;!--  
                      &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.H2Dialect&lt;/prop&gt;
                  --&gt;
  
                      &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.PostgreSQLDialect&lt;/prop&gt;
  
                       &lt;prop key="hibernate.hbm2ddl.auto"&gt;create-drop&lt;/prop&gt;
                   &lt;/props&gt;
              &lt;/property&gt;
           &lt;/bean&gt;
  
           &lt;bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"&gt;  
           &lt;!--  
              &lt;property name="driverClass" value="org.h2.Driver"/&gt;    
              &lt;property name="jdbcUrl" value="jdbc:h2:mem:inf5750;DB_CLOSE_ON_EXIT=FALSE"/&gt;
              &lt;property name="user" value="sa"/&gt;
              &lt;property name="password" value=""/&gt;
         --&gt;
  
      &lt;!-- The postgres configuration is commented out. Left here as a hint for future assignments --&gt;
  
              &lt;property name="driverClass" value="org.postgresql.Driver"/&gt;
              &lt;property name="jdbcUrl" value="jdbc:postgresql:inf5750"/&gt;
              &lt;property name="user" value="dhis"/&gt;
              &lt;property name="password" value="dhis"/&gt;
  
          &lt;/bean&gt;
  
          &lt;!-- ContenNegotiationViewResolver --&gt;
          &lt;bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"&gt;
              &lt;property name="mediaTypes"&gt;
                  &lt;map&gt;
                      &lt;entry key="html" value="text/html"/&gt;
                      &lt;entry key="json" value="application/json"/&gt;
                      &lt;entry key="xml" value="application/xml"/&gt;
                  &lt;/map&gt;
              &lt;/property&gt;
              &lt;property name="viewResolvers"&gt;
                  &lt;list&gt;
                      &lt;bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
                          &lt;property name="prefix" value="/WEB-INF/pages/"/&gt;  &lt;property name="suffix" value=".jsp"/&gt;
                      &lt;/bean&gt;
                        &lt;!--  
                      &lt;bean class="org.springframework.web.servlet.view.xml.MarshallingView"&gt;
                      &lt;constructor-arg&gt;
                          &lt;bean class="org.springframework.oxm.jaxb.Jaxb2Mashaller"&gt;
                              &lt;property name="classesToBeBound"&gt;
                                  &lt;list&gt;
                                      &lt;value&gt;no.uio.inf5750.assignment2.Student&lt;/value&gt;
                                      &lt;value&gt;no.uio.inf5750.assignment2.Course&lt;/value&gt;
                                      &lt;value&gt;no.uio.inf5750.assignment2.Degree&lt;/value&gt;
                                  &lt;/list&gt;
                              &lt;/property&gt;
                          &lt;/bean&gt;
                      &lt;/constructor-arg&gt;
                      &lt;/bean&gt;
                      --&gt;
                  &lt;/list&gt;
              &lt;/property&gt;
  
              &lt;property name="defaultViews"&gt;
                  &lt;list&gt;
                      &lt;bean class="org.springframework.web.servlet.view.json.MappingJackson2JsonView" /&gt;
                  &lt;/list&gt;
              &lt;/property&gt;
              &lt;!--  
              &lt;property name="ignoreAcceptHeader" value="true"/&gt;
               --&gt;
          &lt;/bean&gt;
  
  
          &lt;bean id="studentSystem" 
          class="no.uio.inf5750.assignment2.service.impl.DefaultStudentSystem"&gt;
          &lt;/bean&gt;
  
          &lt;bean id="studentService" 
          class="no.uio.inf5750.assignment2.service.impl.DefaultStudentSystem"&gt;
          &lt;/bean&gt;
  
          &lt;bean id="courseDao" class="no.uio.inf5750.assignment2.dao.hibernate.HibernateCourseDao"&gt;
              &lt;property name="sessionFactory" ref="sessionFactory"/&gt;
          &lt;/bean&gt;
  
          &lt;bean id="studentDao" class="no.uio.inf5750.assignment2.dao.hibernate.HibernateStudentDao"&gt;
              &lt;property name="sessionFactory" ref="sessionFactory"/&gt;
          &lt;/bean&gt;
  
          &lt;bean id="degreeDao" class="no.uio.inf5750.assignment2.dao.hibernate.HibernateDegreeDao"&gt;
              &lt;property name="sessionFactory" ref="sessionFactory"/&gt;
          &lt;/bean&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>And the test file:</p>
  
  <pre><code> package no.uio.inf5750.assignment2.dao;
  
  import static org.junit.Assert.*;
  import static org.junit.Assert.assertEquals;
  
  import java.util.HashSet;
  import java.util.Set;
  
  import org.junit.Before;
  import org.junit.After;
  import org.junit.Assert;
  import org.junit.Test;
  import org.junit.runner.RunWith;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.context.ApplicationContext;
  import org.springframework.test.context.ContextConfiguration;
  import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
  import org.springframework.transaction.annotation.Transactional;
  import no.uio.inf5750.assignment2.dao.StudentDAO;
  import no.uio.inf5750.assignment2.model.Degree;
  import no.uio.inf5750.assignment2.model.Student;
  
  //@ContextConfiguration(locations={"classpath*:src/test/testbeans.xml"})
  @RunWith(SpringJUnit4ClassRunner.class)
  @ContextConfiguration(locations={"classpath*:/META-INF/assignment2/beans.xml"})
  //@Transactional
  public class StudentDAOTest {
  
      @Autowired
      private StudentDAO studentDao;
      private int studentId;
      private Student student;
  
      @Before
      public void init() {
          student = new Student();
          student.setName("Tan Tran");
          studentId = studentDao.saveStudent(student);
      }
  
      //Test cases for assignment 3
      @Test
      public void testSaveLongitude() {
          String longitude;
          longitude = "10.183341";
          student.setLongitude(longitude);
          studentDao.saveStudent(student);
          Student studentTest = studentDao.getStudent(studentId);
          Assert.assertEquals("10.183341", studentTest.getLongitude());
      }
  
      @Test
      public void testSaveLatitude() {
          String latitude;
          latitude = "59.7326693";
          student.setLatitude(latitude);
          studentDao.saveStudent(student);
          Student studentTest = studentDao.getStudent(studentId);
          Assert.assertEquals("59.7326693", studentTest.getLatitude());
      }    
  }
  </code></pre>
  
  <p>However when running unit test (maven and junit) I got the following errors, I tried all the solutions but it doesn't help at all. In the same project, it worked very perfectly.</p>
  
  <pre><code>-------------------------------------------------------------------------------
  Test set: no.uio.inf5750.assignment2.dao.StudentDAOTest
  -------------------------------------------------------------------------------
  Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 2.319 sec &lt;&lt;&lt; FAILURE!
  testSaveLongitude(no.uio.inf5750.assignment2.dao.StudentDAOTest)  Time elapsed: 0.87 sec  &lt;&lt;&lt; ERROR!
  java.lang.IllegalStateException: Failed to load ApplicationContext
      at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:308)
      at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
      at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
      at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:333)
      at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:220)
      at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:301)
      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
      at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:303)
      at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
      at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
      at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
      at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
      at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
      at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
      at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
      at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180)
      at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
      at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
      at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
      at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
      at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
      at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)
      at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)
  Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultStudentSystem': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private no.uio.inf5750.assignment2.dao.CourseDAO no.uio.inf5750.assignment2.service.impl.DefaultStudentSystem.courseDao; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.web.servlet.view.ContentNegotiatingViewResolver] for bean with name 'org.springframework.web.servlet.view.ContentNegotiatingViewResolver#0' defined in URL [file:/home/whitedragon27/assignment3_thdtran/assignment2-deliverable/target/classes/META-INF/assignment2/beans.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.web.servlet.view.ContentNegotiatingViewResolver
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:286)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1064)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:872)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423)
      at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:84)
      at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1)
      at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:280)
      at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:304)
      ... 30 more
  Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private no.uio.inf5750.assignment2.dao.CourseDAO no.uio.inf5750.assignment2.service.impl.DefaultStudentSystem.courseDao; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.web.servlet.view.ContentNegotiatingViewResolver] for bean with name 'org.springframework.web.servlet.view.ContentNegotiatingViewResolver#0' defined in URL [file:/home/whitedragon27/assignment3_thdtran/assignment2-deliverable/target/classes/META-INF/assignment2/beans.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.web.servlet.view.ContentNegotiatingViewResolver
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:507)
      at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:283)
      ... 44 more
  Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.web.servlet.view.ContentNegotiatingViewResolver] for bean with name 'org.springframework.web.servlet.view.ContentNegotiatingViewResolver#0' defined in URL [file:/home/whitedragon27/assignment3_thdtran/assignment2-deliverable/target/classes/META-INF/assignment2/beans.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.web.servlet.view.ContentNegotiatingViewResolver
      at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1223)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:576)
      at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1292)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:304)
      at org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(BeanFactoryUtils.java:185)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:812)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:769)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:686)
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:478)
      ... 46 more
  Caused by: java.lang.ClassNotFoundException: org.springframework.web.servlet.view.ContentNegotiatingViewResolver
      at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
      at org.springframework.util.ClassUtils.forName(ClassUtils.java:258)
      at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:408)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1244)
      at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1215)
      ... 54 more
  testSaveLatitude(no.uio.inf5750.assignment2.dao.StudentDAOTest)  Time elapsed: 1.447 sec  &lt;&lt;&lt; ERROR!
  java.lang.IllegalStateException: Failed to load ApplicationContext
      at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:308)
      at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
      at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
      at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:333)
      at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:220)
      at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:301)
      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
      at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:303)
      at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
      at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
      at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
      at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
      at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
      at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
      at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
      at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180)
      at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
      at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
      at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
      at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
      at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175)
      at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107)
      at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68)
  Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultStudentSystem': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private no.uio.inf5750.assignment2.dao.CourseDAO no.uio.inf5750.assignment2.service.impl.DefaultStudentSystem.courseDao; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.web.servlet.view.ContentNegotiatingViewResolver] for bean with name 'org.springframework.web.servlet.view.ContentNegotiatingViewResolver#0' defined in URL [file:/home/whitedragon27/assignment3_thdtran/assignment2-deliverable/target/classes/META-INF/assignment2/beans.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.web.servlet.view.ContentNegotiatingViewResolver
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:286)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1064)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:872)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423)
      at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:84)
      at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1)
      at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:280)
      at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:304)
      ... 30 more
  Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private no.uio.inf5750.assignment2.dao.CourseDAO no.uio.inf5750.assignment2.service.impl.DefaultStudentSystem.courseDao; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.web.servlet.view.ContentNegotiatingViewResolver] for bean with name 'org.springframework.web.servlet.view.ContentNegotiatingViewResolver#0' defined in URL [file:/home/whitedragon27/assignment3_thdtran/assignment2-deliverable/target/classes/META-INF/assignment2/beans.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.web.servlet.view.ContentNegotiatingViewResolver
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:507)
      at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:283)
      ... 44 more
  Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.web.servlet.view.ContentNegotiatingViewResolver] for bean with name 'org.springframework.web.servlet.view.ContentNegotiatingViewResolver#0' defined in URL [file:/home/whitedragon27/assignment3_thdtran/assignment2-deliverable/target/classes/META-INF/assignment2/beans.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.web.servlet.view.ContentNegotiatingViewResolver
      at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1223)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:576)
      at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1292)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:304)
      at org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(BeanFactoryUtils.java:185)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:812)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:769)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:686)
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:478)
      ... 46 more
  Caused by: java.lang.ClassNotFoundException: org.springframework.web.servlet.view.ContentNegotiatingViewResolver
      at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
      at org.springframework.util.ClassUtils.forName(ClassUtils.java:258)
      at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:408)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1244)
      at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1215)
      ... 54 more
  </code></pre>
  
  <p>Could anyone help me? Thanks</p>