title: Error creating bean with name 'accountController'
body: <p>So, we have finally managed to update our Spring Framework from version <code>3.2</code> to <code>4.2.25</code>. After some painful processes I am now stuck at this exception: <code>Error creating bean with name 'accountController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException</code>. <br></p>
  
  <p><strong>web.xml</strong>: <br></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_3_1.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"&gt;
  
  &lt;context-param&gt;
          &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
          &lt;param-value&gt;
              /WEB-INF/spring/servlet-context.xml,
              /WEB-INF/spring/servlet-security.xml
          &lt;/param-value&gt;
  &lt;/context-param&gt;
  
  &lt;servlet&gt;
          &lt;servlet-name&gt;Spring MVC Dispatcher Servlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
          &lt;init-param&gt;
              &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
              &lt;param-value&gt;
                  /WEB-INF/spring/servlet-context.xml,
                  /WEB-INF/spring/servlet-security.xml
              &lt;/param-value&gt;
          &lt;/init-param&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  &lt;/web-app&gt;
  </code></pre>
  
  <p><strong>jdbc-context.xml</strong>: <br></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: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-4.2.xsd
          http://www.springframework.org/schema/tx 
          http://www.springframework.org/schema/tx/spring-tx-4.2.xsd
          http://www.springframework.org/schema/context
          http://www.springframework.org/schema/context/spring-context-4.2.xsd
          "&gt;
  
  &lt;context:property-placeholder location="/WEB-INF/spring/spring.properties" /&gt;
  
  &lt;!-- Enable annotation style of managing transactions --&gt;
  &lt;tx:annotation-driven transaction-manager="transactionManager" /&gt;   
  
  &lt;!-- Declare a transaction manager --&gt;
  &lt;!-- See http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/transaction.html --&gt;
  &lt;bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager" p:dataSource-ref="dataSource" /&gt;
  
  &lt;!-- Declare a datasource that has pooling capabilities--&gt;   
  &lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"
              destroy-method="close"
              p:driverClass="${app.jdbc.driverClassName}"
              p:jdbcUrl="${app.jdbc.url}"
              p:user="${app.jdbc.username}"
              p:password="${app.jdbc.password}"
              p:acquireIncrement="1"
              p:idleConnectionTestPeriod="60"
              p:maxPoolSize="247"
              p:maxStatements="100"
              p:minPoolSize="1" /&gt;    
  
  &lt;bean id="dataSourceSlave" class="org.springframework.jdbc.datasource.DriverManagerDataSource"
              destroy-method="close"
              p:driverClass="${app.jdbc.driverClassName}"
              p:jdbcUrl="${app.slave.jdbc.url}"
              p:user="${app.slave.jdbc.username}"
              p:password="${app.slave.jdbc.password}"
              p:acquireIncrement="1"
              p:idleConnectionTestPeriod="60"
              p:maxPoolSize="247"
              p:maxStatements="100"
              p:minPoolSize="1" /&gt;            
  </code></pre>
  
  <p></p>
  
  <p>And a full exception <strong>printStack()</strong>:</p>
  
  <pre><code>SEVERE: Context initialization failed
  org.springframework.beans.factory.BeanCreationException:
      Error creating bean with name 'accountController': Injection of resource dependencies failed; nested exception is
  org.springframework.beans.factory.BeanCreationException:
      Error creating bean with name 'accountService': Injection of resource dependencies failed; nested exception is
  org.springframework.beans.factory.BeanCreationException:
      Error creating bean with name 'friendService': Injection of resource dependencies failed; nested exception is
  org.springframework.beans.factory.BeanCreationException:
      Error creating bean with name 'agentProfileService': Injection of resource dependencies failed; nested exception is
  org.springframework.beans.factory.BeanCreationException:
      Error creating bean with name 'screenNameService': Injection of resource dependencies failed; nested exception is
  org.springframework.beans.factory.BeanCreationException:
      Error creating bean with name 'exceptionService': Injection of resource dependencies failed; nested exception is
  org.springframework.beans.factory.BeanCreationException:
      Error creating bean with name 'mailService': Injection of resource dependencies failed; nested exception is
  org.springframework.beans.factory.BeanCreationException:
      Error creating bean with name 'emailNotificationService': Injection of resource dependencies failed; nested exception is
  org.springframework.beans.factory.BeanCreationException:
      Error creating bean with name 'sportProfileService': Injection of resource dependencies failed; nested exception is
  org.springframework.beans.factory.BeanCreationException:
      Error creating bean with name 'countryService': Injection of resource dependencies failed; nested exception is
  org.springframework.beans.factory.BeanCreationException:
      Error creating bean with name 'dataSourceSlave' defined in 
      ServletContext resource [/WEB-INF/spring/jdbc-context.xml]:
          Error setting property values; nested exception is
  org.springframework.beans.NotWritablePropertyException:
      Invalid property 'acquireIncrement' of bean class
      [org.springframework.jdbc.datasource.DriverManagerDataSource]:
      Bean property 'acquireIncrement' is not writable or has an invalid setter method.
      Does the parameter type of the setter match the return type of the getter?
  at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:311)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
  at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
  at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
  at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
  at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
  at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
  at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
  at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
  at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444)
  at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326)
  at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
  at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5068)
  at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5584)
  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
  at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
  at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
  at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
  at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1259)
  at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1998)
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
  at java.util.concurrent.FutureTask.run(FutureTask.java:166)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
  at java.lang.Thread.run(Thread.java:722)
  </code></pre>
  
  <p>Not sure if relevant: I am using <code>javax.servlet-api-3.1</code>.</p>
  
  <p>And now <strong>AccountService.java</strong>:</p>
  
  <pre><code>@Service("accountService")
  @Transactional
  public class AccountService
  {
  protected static Logger log = LogManager.getLogger(AccountService.class);
  private NamedParameterJdbcTemplate jdbcTemplate;
  private SimpleJdbcInsert jdbcInviteInsert;
  private SimpleJdbcInsert jdbcChallengeInsert;
  private SimpleJdbcInsert jdbcPostitInsert;
  private SimpleJdbcInsert jdbcPreferenceInsert;
  
  @Resource(name = "dataSource")
  public void setDataSource(DataSource dataSource)
  {
      this.jdbcTemplate = new NamedParameterJdbcTemplate(dataSource);
      this.jdbcInviteInsert = new SimpleJdbcInsert(dataSource).withTableName("invite_contact").usingGeneratedKeyColumns("id");
      this.jdbcChallengeInsert = new SimpleJdbcInsert(dataSource).withTableName("challenge").usingGeneratedKeyColumns("id");
      this.jdbcPreferenceInsert = new SimpleJdbcInsert(dataSource).withTableName("preference").usingGeneratedKeyColumns("id");
      this.jdbcPostitInsert = new SimpleJdbcInsert(dataSource).withTableName("account_postit");
  }
  
  // super-awesome-revolutionary code
  
  }
  </code></pre>
  
  <p>If there is any additional information I should provide, please let me know :)</p>