title: Error creating bean with name 'transactionManager : BeanCreationException
body: <p><strong>Please note</strong> I already tried the previous posts, but their not working for me.</p>
  
  <p>I am having a problem with my Spring and Hibernate Configuration.</p>
  
  <p>I think the reason is because it could not connect to my database, but I have the credentials in my properties file are all correct.
  MySQL version is 5.5.44, Spring version is 4.0.2 and Hibernate version is 4.2.7.Final</p>
  
  <p>This is the error of my tomcat.</p>
  
  <pre><code>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in ServletContext resource [/WEB-INF/spring/root-context.xml]: Cannot resolve reference to bean 'mySessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mySessionFactory' defined in ServletContext resource [/WEB-INF/spring/root-context.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: com.mchange.v2.async.ThreadPoolAsynchronousRunner.&lt;init&gt;(IZLjava/util/Timer;Ljava/lang/String;)V
  at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) ~[spring-beans-4.0.2.RELEASE.jar:na]
  at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:107) ~[spring-beans-4.0.2.RELEASE.jar:na]
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1456) ~[spring-beans-4.0.2.RELEASE.jar:na]
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1197) ~[spring-beans-4.0.2.RELEASE.jar:na]
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537) ~[spring-beans-4.0.2.RELEASE.jar:na]
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) ~[spring-beans-4.0.2.RELEASE.jar:na]
  15-Oct-2015 13:22:45.620 SEVERE [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file
  at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304) ~[spring-beans-4.0.2.RELEASE.jar:na]
  at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-4.0.2.RELEASE.jar:na]
  at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300) ~[spring-beans-4.0.2.RELEASE.jar:na]
  at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195) ~[spring-beans-4.0.2.RELEASE.jar:na]
  at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:700) ~[spring-beans-4.0.2.RELEASE.jar:na]
  at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760) ~[spring-context-4.0.2.RELEASE.jar:na]
  at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482) ~[spring-context-4.0.2.RELEASE.jar:na]
  at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403) ~[spring-web-4.0.2.RELEASE.jar:4.0.2.RELEASE]
  at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) ~[spring-web-4.0.2.RELEASE.jar:4.0.2.RELEASE]
  at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) [spring-web-4.0.2.RELEASE.jar:4.0.2.RELEASE]
  at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4729) [catalina.jar:8.0.24]
  at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5167) [catalina.jar:8.0.24]
  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:8.0.24]
  at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725) [catalina.jar:8.0.24]
  at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701) [catalina.jar:8.0.24]
  at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717) [catalina.jar:8.0.24]
  15-Oct-2015 13:22:45.625 SEVERE [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.StandardContext.startInternal Context [/service] startup failed due to previous errors
  at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1648) [catalina.jar:8.0.24]
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_80]
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_80]
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_80]
  at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_80]
  at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300) [tomcat-coyote.jar:8.0.24]
  at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) [na:1.7.0_80]
  at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) [na:1.7.0_80]
  at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:463) [catalina.jar:8.0.24]
  at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:413) [catalina.jar:8.0.24]
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_80]
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_80]
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_80]
  at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_80]
  at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300) [tomcat-coyote.jar:8.0.24]
  at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) [na:1.7.0_80]
  at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) [na:1.7.0_80]
  at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1487) [na:1.7.0_80]
  at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:97) [na:1.7.0_80]
  at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1328) [na:1.7.0_80]
  at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1420) [na:1.7.0_80]
  at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:848) [na:1.7.0_80]
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_80]
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_80]
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_80]
  at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_80]
  at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322) [na:1.7.0_80]
  at sun.rmi.transport.Transport$2.run(Transport.java:202) [na:1.7.0_80]
  at sun.rmi.transport.Transport$2.run(Transport.java:199) [na:1.7.0_80]
  at java.security.AccessController.doPrivileged(Native Method) [na:1.7.0_80]
  at sun.rmi.transport.Transport.serviceCall(Transport.java:198) [na:1.7.0_80]
  at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:567) [na:1.7.0_80]
  at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828) [na:1.7.0_80]
  at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.access$400(TCPTransport.java:619) [na:1.7.0_80]
  at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$1.run(TCPTransport.java:684) [na:1.7.0_80]
  at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$1.run(TCPTransport.java:681) [na:1.7.0_80]
  at java.security.AccessController.doPrivileged(Native Method) [na:1.7.0_80]
  at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:681) [na:1.7.0_80]
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_80]
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_80]
  at java.lang.Thread.run(Thread.java:745) [na:1.7.0_80]
  Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mySessionFactory' defined in ServletContext resource [/WEB-INF/spring/root-context.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: com.mchange.v2.async.ThreadPoolAsynchronousRunner.&lt;init&gt;(IZLjava/util/Timer;Ljava/lang/String;)V
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553) ~[spring-beans-4.0.2.RELEASE.jar:na]
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) ~[spring-beans-4.0.2.RELEASE.jar:na]
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) ~[spring-beans-4.0.2.RELEASE.jar:na]
  at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304) ~[spring-beans-4.0.2.RELEASE.jar:na]
  at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-4.0.2.RELEASE.jar:na]
  at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300) ~[spring-beans-4.0.2.RELEASE.jar:na]
  at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195) ~[spring-beans-4.0.2.RELEASE.jar:na]
  at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:320) ~[spring-beans-4.0.2.RELEASE.jar:na]
  ... 62 common frames omitted
  Caused by: java.lang.NoSuchMethodError: com.mchange.v2.async.ThreadPoolAsynchronousRunner.&lt;init&gt;(IZLjava/util/Timer;Ljava/lang/String;)V
  at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.createTaskRunner(C3P0PooledConnectionPoolManager.java:145) ~[c3p0-0.9.2.1.jar:na]
  at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.poolsInit(C3P0PooledConnectionPoolManager.java:174) ~[c3p0-0.9.2.1.jar:na]
  at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPoolManager.&lt;init&gt;(C3P0PooledConnectionPoolManager.java:295) ~[c3p0-0.9.2.1.jar:na]
  at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getPoolManager(AbstractPoolBackedDataSource.java:520) ~[c3p0-0.9.2.1.jar:na]
  at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:140) ~[c3p0-0.9.2.1.jar:na]
  at org.hibernate.service.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:141) ~[hibernate-core-4.2.7.Final.jar:4.2.7.Final]
  at org.hibernate.engine.jdbc.internal.JdbcServicesImpl$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcServicesImpl.java:242) ~[hibernate-core-4.2.7.Final.jar:4.2.7.Final]
  at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:117) ~[hibernate-core-4.2.7.Final.jar:4.2.7.Final]
  at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:76) ~[hibernate-core-4.2.7.Final.jar:4.2.7.Final]
  at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:160) ~[hibernate-core-4.2.7.Final.jar:4.2.7.Final]
  at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:132) ~[hibernate-core-4.2.7.Final.jar:4.2.7.Final]
  at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1822) ~[hibernate-core-4.2.7.Final.jar:na]
  at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1780) ~[hibernate-core-4.2.7.Final.jar:na]
  at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1865) ~[hibernate-core-4.2.7.Final.jar:na]
  at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:343) ~[spring-orm-4.0.2.RELEASE.jar:4.0.2.RELEASE]
  at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:431) ~[spring-orm-4.0.2.RELEASE.jar:4.0.2.RELEASE]
  at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:416) ~[spring-orm-4.0.2.RELEASE.jar:4.0.2.RELEASE]
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1612) ~[spring-beans-4.0.2.RELEASE.jar:na]
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1549) ~[spring-beans-4.0.2.RELEASE.jar:na]
  ... 69 common frames omitted
  </code></pre>
  
  <p>This is my root context</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:context="http://www.springframework.org/schema/context"
     xmlns:tx="http://www.springframework.org/schema/tx"
     xmlns:p="http://www.springframework.org/schema/p"
     xmlns="http://www.springframework.org/schema/beans"
     xsi:schemaLocation="
     http://www.springframework.org/schema/beans
     http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
     http://www.springframework.org/schema/tx
     http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
     http://www.springframework.org/schema/context
     http://www.springframework.org/schema/context/spring-context-3.2.xsd"&gt;
  
  &lt;context:property-placeholder location="classpath:props.properties"/&gt;
  &lt;tx:annotation-driven transaction-manager="transactionManager"/&gt;
  
  &lt;bean id="transactionManager"
        class="org.springframework.orm.hibernate4.HibernateTransactionManager"&gt;
      &lt;property name="sessionFactory" ref="mySessionFactory"/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="mySessionFactory"
        class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt;
      &lt;property name="dataSource" ref="myDataSource"/&gt;
      &lt;property name="hibernateProperties"&gt;
          &lt;props&gt;
              &lt;prop key="hibernate.dialect"&gt;${locationdb.hibernate.dialect}&lt;/prop&gt;
              &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;
              &lt;prop key="hibernate.hbm2ddl.auto"&gt;update&lt;/prop&gt;
              &lt;prop key="hibernate.current_session_context_class"&gt;
                  org.springframework.orm.hibernate4.SpringSessionContext
              &lt;/prop&gt;
          &lt;/props&gt;
      &lt;/property&gt;
      &lt;property name="packagesToScan"&gt;
          &lt;list&gt;
              &lt;value&gt;com.mypackage&lt;/value&gt;
          &lt;/list&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;!-- Location DB Datasource --&gt;
  &lt;!-- When changing between database types, take note:
        * Change the driverClass and driverClassName below.
        * Update props.properties as needed (see: endpoint and Hibernate dialect)
  --&gt;
  
  &lt;bean id="myDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
        destroy-method="close"&gt;
      &lt;property name="driverClass" value="com.mysql.jdbc.Driver"/&gt;
      &lt;property name="jdbcUrl" value="${locationdb.endpoint}"/&gt;
      &lt;property name="user" value="${locationdb.username}"/&gt;
      &lt;property name="password" value="${locationdb.password}"/&gt;
  
      &lt;property name="acquireIncrement" value="${locationdb.c3p0.acquireIncrement}"/&gt;
      &lt;property name="minPoolSize" value="${locationdb.c3p0.minPoolSize}"/&gt;
      &lt;property name="maxPoolSize" value="${locationdb.c3p0.maxPoolSize}"/&gt;
      &lt;property name="maxIdleTime" value="${locationdb.c3p0.maxIdleTime}"/&gt;
  &lt;/bean&gt;
  
  
  &lt;!-- Location DB MySQL Datasource --&gt;
  &lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
      &lt;property name="driverClassName" value="com.mysql.jdbc.Driver"/&gt;
      &lt;property name="url" value="${locationdb.endpoint}"/&gt;
      &lt;property name="username" value="${locationdb.username}"/&gt;
      &lt;property name="password" value="${locationdb.password}"/&gt;
  &lt;/bean&gt;
  
  
  &lt;bean id="jedisConnFactory"
        class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"
        p:hostName="${jedis_endpoint}"
        p:port="${jedis_endpoint_port}"
        p:timeout="${jedis_timeout}"
        p:usePool="true"
        p:poolConfig-ref="jedisPoolConfig"/&gt;
  
  &lt;bean id="serializer" class="org.springframework.data.redis.serializer.StringRedisSerializer"/&gt;
  
  &lt;bean id="redisTemplate"
        class="org.springframework.data.redis.core.RedisTemplate"
        p:connectionFactory-ref="jedisConnFactory"
        p:defaultSerializer-ref="serializer"/&gt;
  
  &lt;bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig"
        p:maxTotal="150"
        p:minIdle="5"
        p:maxIdle="15"/&gt;
  
  &lt;!-- Job Manager --&gt;
  &lt;bean id="jobManager" class="com.mypackage.restws.controllers.jobs.JobManager"/&gt;
  
  
  &lt;bean id="restTemplate" class="org.springframework.web.client.RestTemplate"/&gt;
  </code></pre>
  
  <p></p>
  
  <p>and this is my props.properties</p>
  
  <pre><code>locationdb.hibernate.dialect=org.hibernate.dialect.MySQLDialect
  
  locationdb.endpoint=jdbc:mysql://localhost/locationdb
  locationdb.username=root
  locationdb.password=root
  
  locationdb.c3p0.acquireIncrement=1
  locationdb.c3p0.minPoolSize=1
  locationdb.c3p0.maxPoolSize=10
  locationdb.c3p0.maxIdleTime=200
  
  optout.endpoint=https://localhost:8443/
  </code></pre>
  
  <p>My buddies have their project setup successfully, but mine is having this error. Is there anything that I should consider in configuration?</p>