title: BeanCreationException: Injection of autowired dependencies failed
body: <p>I want to use <code>Spring</code> for JDBC configuration.</p>
  
  <p>But it throws next bunch of exceptions:</p>
  
  <pre><code>Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdbcDaoImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: public javax.sql.DataSource com.spring.database.dao.JdbcDaoImpl.dataSource; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [spring-db.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
  PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.util.ClassUtils.forName(Ljava/lang/String;)Ljava/lang/Class;
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:292)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1185)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
      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:703)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
      at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:139)
      at org.springframework.context.support.ClassPathXmlApplicationContext.&lt;init&gt;(ClassPathXmlApplicationContext.java:83)
      at com.spring.database.JdbcDemo.main(JdbcDemo.java:10)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:483)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
  Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: public javax.sql.DataSource com.spring.database.dao.JdbcDaoImpl.dataSource; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [spring-db.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
  PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.util.ClassUtils.forName(Ljava/lang/String;)Ljava/lang/Class;
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:508)
      at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
      at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:289)
      ... 18 more
  Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [spring-db.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
  PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.util.ClassUtils.forName(Ljava/lang/String;)Ljava/lang/Class;
  </code></pre>
  
  <p>Here is my <code>main():</code></p>
  
  <pre><code>public class JdbcDemo {
      public static void main(String[] args) {
          ApplicationContext context = new ClassPathXmlApplicationContext("spring-db.xml");
          JdbcDaoImpl dao = context.getBean("jdbcDaoImpl", JdbcDaoImpl.class);
  
          Circle circle = dao.getCircle(1);
          System.out.println(circle.getName());
      }
  }
  </code></pre>
  
  <p><strong><em>JdbcDaoImpl:</em></strong></p>
  
  <pre><code>@Component
  public class JdbcDaoImpl {
      public static final String SELECT_FROM_CIRCLE_WHERE_ID = "SELECT * FROM circle WHERE id = ?";
  
      private Logger log = Logger.getLogger(JdbcDaoImpl.class);
      @Autowired
      private DataSource dataSource;
  
      public Circle getCircle(int circleId) {
          Connection conn = null;
          PreparedStatement ps;
          ResultSet rs;
          Circle circle = null;
          try {
              conn = dataSource.getConnection();
              ps = conn.prepareStatement(SELECT_FROM_CIRCLE_WHERE_ID);
              ps.setInt(1, circleId);
  
              rs = ps.executeQuery();
              if (rs.next()) {
                  circle = new Circle(circleId, rs.getString("name"));
              }
  
              rs.close();
              ps.close();
          } catch (Exception e) {
              log.error(e);
              throw new RuntimeException(e);
          } finally {
              try {
                  if (conn != null) {
                      conn.close();
                  }
              } catch (SQLException e) {
                  log.error(e);
              }
          }
          return circle;
      }
  }
  </code></pre>
  
  <p><strong><em>spring-db.xml:</em></strong></p>
  
  <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:context="http://www.springframework.org/schema/context"
         xsi:schemaLocation="http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
      http://www.springframework.org/schema/context
      http://www.springframework.org/schema/context/spring-context.xsd"&gt;
  
      &lt;context:annotation-config/&gt;
      &lt;context:component-scan base-package="com.spring.database"/&gt;
  
      &lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" &gt;
          &lt;property name="driverClassName" value="org.apache.derby.jdbc.ClientDriver"/&gt;
          &lt;property name="url" value="jdbc:derby://localhost:1527/db;create=true" /&gt;
      &lt;/bean&gt;    
  &lt;/beans&gt;
  </code></pre>
  
  <p><strong><em>How to solve this trouble?</em></strong></p>