title: Error loading class [org.apache.commons.dbcp.BasicDataSource] for bean with name 'dataSource'
body: <p>*<em>is the console log error *</em></p>
  
  <p>java.lang.IllegalStateException: Failed to load ApplicationContext</p>
  
  <p>Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loginLogDao': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.jdbc.core.JdbcTemplate com.spring.dao.LoginLogDao.jdbcTemplate; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.apache.commons.dbcp.BasicDataSource] for bean with name 'dataSource' defined in class path resource [applicationContext.xml]: problem with class file or dependent class; nested exception is java.lang.UnsupportedClassVersionError: Bad version number in .class file
      Related cause: org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.apache.commons.dbcp.BasicDataSource] for bean with name 'dataSource' defined in class path resource [applicationContext.xml]: problem with class file or dependent class; nested exception is java.lang.UnsupportedClassVersionError: Bad version number in .class file</p>
  
  <p>below is my applicationContext.xml</p>
  
  <pre><code>&lt;context:component-scan base-package="com.spring.dao" /&gt;
  &lt;context:component-scan base-package="com.spring.service" /&gt;
  &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
      p:driverClassName="com.mysql.jdbc.Driver"
      p:url="jdbc:mysql://192.168.196.5:3307/apu" 
      p:username="dev"
      p:password="password" /&gt;
  &lt;bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"
      p:dataSource-ref="dataSource" /&gt;
  
  &lt;bean id="transactionManager"
      class="org.springframework.jdbc.datasource.DataSourceTransactionManager"
      p:dataSource-ref="dataSource" /&gt;
  &lt;aop:config proxy-target-class="true"&gt;
      &lt;aop:pointcut id="serviceMethod" expression="execution(* com.spring.service..*(..))" /&gt;
      &lt;aop:advisor pointcut-ref="serviceMethod" advice-ref="txAdvice" /&gt;
  &lt;/aop:config&gt;
  &lt;tx:advice id="txAdvice" transaction-manager="transactionManager"&gt;
      &lt;tx:attributes&gt;
          &lt;tx:method name="*" /&gt;
      &lt;/tx:attributes&gt;
  &lt;/tx:advice&gt;
  </code></pre>
  
  <p> </p>
  
  <p>below is my test file</p>
  
  <pre><code>    import static org.junit.Assert.*;
  
      import org.junit.Test;
      import org.junit.runner.RunWith;
      import org.springframework.beans.factory.annotation.Autowired;
      import org.springframework.test.context.ContextConfiguration;
      import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
      import com.spring.model.User;
      @RunWith(SpringJUnit4ClassRunner.class)
      @ContextConfiguration(locations={"classpath:/applicationContext.xml"})
      public class TestUserService {
  
      @Autowired
      private UserService userService;
      @Test
      public void hasMatchUser() {
          boolean b1=userService.hasMatchUser("admin", "123456");
          boolean b2=userService.hasMatchUser("admin", "11111");
          assertTrue(b1);
          assertTrue(!b2);
      }
  
      @Test
      public void findUserByName(){
          User user = userService.findUserByUserName("admin");
          assertEquals(user.getUserName(),"admin");
      }
  }
  </code></pre>
  
  <p>I don't know how to fix the problem,who can help me?
  Thanks a lot!</p>