java - Error creating bean with name 'transactionManager : BeanCreationException -
please note tried previous posts, not working me.
i having problem spring , hibernate configuration.
i think reason because not connect database, have credentials in properties file correct. mysql version 5.5.44, spring version 4.0.2 , hibernate version 4.2.7.final
this error of tomcat.
org.springframework.beans.factory.beancreationexception: error creating bean name 'transactionmanager' defined in servletcontext resource [/web-inf/spring/root-context.xml]: cannot resolve reference bean 'mysessionfactory' while setting bean property 'sessionfactory'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'mysessionfactory' defined in servletcontext resource [/web-inf/spring/root-context.xml]: invocation of init method failed; nested exception java.lang.nosuchmethoderror: com.mchange.v2.async.threadpoolasynchronousrunner.<init>(izljava/util/timer;ljava/lang/string;)v @ org.springframework.beans.factory.support.beandefinitionvalueresolver.resolvereference(beandefinitionvalueresolver.java:328) ~[spring-beans-4.0.2.release.jar:na] @ org.springframework.beans.factory.support.beandefinitionvalueresolver.resolvevalueifnecessary(beandefinitionvalueresolver.java:107) ~[spring-beans-4.0.2.release.jar:na] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.applypropertyvalues(abstractautowirecapablebeanfactory.java:1456) ~[spring-beans-4.0.2.release.jar:na] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.populatebean(abstractautowirecapablebeanfactory.java:1197) ~[spring-beans-4.0.2.release.jar:na] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:537) ~[spring-beans-4.0.2.release.jar:na] @ 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 1 or more listeners failed start. full details found in appropriate container log file @ org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:304) ~[spring-beans-4.0.2.release.jar:na] @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:228) ~[spring-beans-4.0.2.release.jar:na] @ org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:300) ~[spring-beans-4.0.2.release.jar:na] @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:195) ~[spring-beans-4.0.2.release.jar:na] @ org.springframework.beans.factory.support.defaultlistablebeanfactory.preinstantiatesingletons(defaultlistablebeanfactory.java:700) ~[spring-beans-4.0.2.release.jar:na] @ org.springframework.context.support.abstractapplicationcontext.finishbeanfactoryinitialization(abstractapplicationcontext.java:760) ~[spring-context-4.0.2.release.jar:na] @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:482) ~[spring-context-4.0.2.release.jar:na] @ org.springframework.web.context.contextloader.configureandrefreshwebapplicationcontext(contextloader.java:403) ~[spring-web-4.0.2.release.jar:4.0.2.release] @ org.springframework.web.context.contextloader.initwebapplicationcontext(contextloader.java:306) ~[spring-web-4.0.2.release.jar:4.0.2.release] @ org.springframework.web.context.contextloaderlistener.contextinitialized(contextloaderlistener.java:106) [spring-web-4.0.2.release.jar:4.0.2.release] @ org.apache.catalina.core.standardcontext.listenerstart(standardcontext.java:4729) [catalina.jar:8.0.24] @ org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5167) [catalina.jar:8.0.24] @ org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150) [catalina.jar:8.0.24] @ org.apache.catalina.core.containerbase.addchildinternal(containerbase.java:725) [catalina.jar:8.0.24] @ org.apache.catalina.core.containerbase.addchild(containerbase.java:701) [catalina.jar:8.0.24] @ 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 previous errors @ org.apache.catalina.startup.hostconfig.manageapp(hostconfig.java:1648) [catalina.jar:8.0.24] @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) ~[na:1.7.0_80] @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) ~[na:1.7.0_80] @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) ~[na:1.7.0_80] @ java.lang.reflect.method.invoke(method.java:606) ~[na:1.7.0_80] @ org.apache.tomcat.util.modeler.basemodelmbean.invoke(basemodelmbean.java:300) [tomcat-coyote.jar:8.0.24] @ com.sun.jmx.interceptor.defaultmbeanserverinterceptor.invoke(defaultmbeanserverinterceptor.java:819) [na:1.7.0_80] @ com.sun.jmx.mbeanserver.jmxmbeanserver.invoke(jmxmbeanserver.java:801) [na:1.7.0_80] @ org.apache.catalina.mbeans.mbeanfactory.createstandardcontext(mbeanfactory.java:463) [catalina.jar:8.0.24] @ org.apache.catalina.mbeans.mbeanfactory.createstandardcontext(mbeanfactory.java:413) [catalina.jar:8.0.24] @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) ~[na:1.7.0_80] @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) ~[na:1.7.0_80] @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) ~[na:1.7.0_80] @ java.lang.reflect.method.invoke(method.java:606) ~[na:1.7.0_80] @ org.apache.tomcat.util.modeler.basemodelmbean.invoke(basemodelmbean.java:300) [tomcat-coyote.jar:8.0.24] @ com.sun.jmx.interceptor.defaultmbeanserverinterceptor.invoke(defaultmbeanserverinterceptor.java:819) [na:1.7.0_80] @ com.sun.jmx.mbeanserver.jmxmbeanserver.invoke(jmxmbeanserver.java:801) [na:1.7.0_80] @ javax.management.remote.rmi.rmiconnectionimpl.dooperation(rmiconnectionimpl.java:1487) [na:1.7.0_80] @ javax.management.remote.rmi.rmiconnectionimpl.access$300(rmiconnectionimpl.java:97) [na:1.7.0_80] @ javax.management.remote.rmi.rmiconnectionimpl$privilegedoperation.run(rmiconnectionimpl.java:1328) [na:1.7.0_80] @ javax.management.remote.rmi.rmiconnectionimpl.doprivilegedoperation(rmiconnectionimpl.java:1420) [na:1.7.0_80] @ javax.management.remote.rmi.rmiconnectionimpl.invoke(rmiconnectionimpl.java:848) [na:1.7.0_80] @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) ~[na:1.7.0_80] @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) ~[na:1.7.0_80] @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) ~[na:1.7.0_80] @ java.lang.reflect.method.invoke(method.java:606) ~[na:1.7.0_80] @ sun.rmi.server.unicastserverref.dispatch(unicastserverref.java:322) [na:1.7.0_80] @ sun.rmi.transport.transport$2.run(transport.java:202) [na:1.7.0_80] @ sun.rmi.transport.transport$2.run(transport.java:199) [na:1.7.0_80] @ java.security.accesscontroller.doprivileged(native method) [na:1.7.0_80] @ sun.rmi.transport.transport.servicecall(transport.java:198) [na:1.7.0_80] @ sun.rmi.transport.tcp.tcptransport.handlemessages(tcptransport.java:567) [na:1.7.0_80] @ sun.rmi.transport.tcp.tcptransport$connectionhandler.run0(tcptransport.java:828) [na:1.7.0_80] @ sun.rmi.transport.tcp.tcptransport$connectionhandler.access$400(tcptransport.java:619) [na:1.7.0_80] @ sun.rmi.transport.tcp.tcptransport$connectionhandler$1.run(tcptransport.java:684) [na:1.7.0_80] @ sun.rmi.transport.tcp.tcptransport$connectionhandler$1.run(tcptransport.java:681) [na:1.7.0_80] @ java.security.accesscontroller.doprivileged(native method) [na:1.7.0_80] @ sun.rmi.transport.tcp.tcptransport$connectionhandler.run(tcptransport.java:681) [na:1.7.0_80] @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145) [na:1.7.0_80] @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615) [na:1.7.0_80] @ java.lang.thread.run(thread.java:745) [na:1.7.0_80] caused by: org.springframework.beans.factory.beancreationexception: error creating bean name 'mysessionfactory' defined in servletcontext resource [/web-inf/spring/root-context.xml]: invocation of init method failed; nested exception java.lang.nosuchmethoderror: com.mchange.v2.async.threadpoolasynchronousrunner.<init>(izljava/util/timer;ljava/lang/string;)v @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1553) ~[spring-beans-4.0.2.release.jar:na] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:539) ~[spring-beans-4.0.2.release.jar:na] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:475) ~[spring-beans-4.0.2.release.jar:na] @ org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:304) ~[spring-beans-4.0.2.release.jar:na] @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:228) ~[spring-beans-4.0.2.release.jar:na] @ org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:300) ~[spring-beans-4.0.2.release.jar:na] @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:195) ~[spring-beans-4.0.2.release.jar:na] @ 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.<init>(izljava/util/timer;ljava/lang/string;)v @ com.mchange.v2.c3p0.impl.c3p0pooledconnectionpoolmanager.createtaskrunner(c3p0pooledconnectionpoolmanager.java:145) ~[c3p0-0.9.2.1.jar:na] @ com.mchange.v2.c3p0.impl.c3p0pooledconnectionpoolmanager.poolsinit(c3p0pooledconnectionpoolmanager.java:174) ~[c3p0-0.9.2.1.jar:na] @ com.mchange.v2.c3p0.impl.c3p0pooledconnectionpoolmanager.<init>(c3p0pooledconnectionpoolmanager.java:295) ~[c3p0-0.9.2.1.jar:na] @ com.mchange.v2.c3p0.impl.abstractpoolbackeddatasource.getpoolmanager(abstractpoolbackeddatasource.java:520) ~[c3p0-0.9.2.1.jar:na] @ com.mchange.v2.c3p0.impl.abstractpoolbackeddatasource.getconnection(abstractpoolbackeddatasource.java:140) ~[c3p0-0.9.2.1.jar:na] @ org.hibernate.service.jdbc.connections.internal.datasourceconnectionproviderimpl.getconnection(datasourceconnectionproviderimpl.java:141) ~[hibernate-core-4.2.7.final.jar:4.2.7.final] @ org.hibernate.engine.jdbc.internal.jdbcservicesimpl$connectionproviderjdbcconnectionaccess.obtainconnection(jdbcservicesimpl.java:242) ~[hibernate-core-4.2.7.final.jar:4.2.7.final] @ org.hibernate.engine.jdbc.internal.jdbcservicesimpl.configure(jdbcservicesimpl.java:117) ~[hibernate-core-4.2.7.final.jar:4.2.7.final] @ org.hibernate.service.internal.standardserviceregistryimpl.configureservice(standardserviceregistryimpl.java:76) ~[hibernate-core-4.2.7.final.jar:4.2.7.final] @ org.hibernate.service.internal.abstractserviceregistryimpl.initializeservice(abstractserviceregistryimpl.java:160) ~[hibernate-core-4.2.7.final.jar:4.2.7.final] @ org.hibernate.service.internal.abstractserviceregistryimpl.getservice(abstractserviceregistryimpl.java:132) ~[hibernate-core-4.2.7.final.jar:4.2.7.final] @ org.hibernate.cfg.configuration.buildtyperegistrations(configuration.java:1822) ~[hibernate-core-4.2.7.final.jar:na] @ org.hibernate.cfg.configuration.buildsessionfactory(configuration.java:1780) ~[hibernate-core-4.2.7.final.jar:na] @ org.hibernate.cfg.configuration.buildsessionfactory(configuration.java:1865) ~[hibernate-core-4.2.7.final.jar:na] @ org.springframework.orm.hibernate4.localsessionfactorybuilder.buildsessionfactory(localsessionfactorybuilder.java:343) ~[spring-orm-4.0.2.release.jar:4.0.2.release] @ org.springframework.orm.hibernate4.localsessionfactorybean.buildsessionfactory(localsessionfactorybean.java:431) ~[spring-orm-4.0.2.release.jar:4.0.2.release] @ org.springframework.orm.hibernate4.localsessionfactorybean.afterpropertiesset(localsessionfactorybean.java:416) ~[spring-orm-4.0.2.release.jar:4.0.2.release] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.invokeinitmethods(abstractautowirecapablebeanfactory.java:1612) ~[spring-beans-4.0.2.release.jar:na] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1549) ~[spring-beans-4.0.2.release.jar:na] ... 69 common frames omitted
this root context
<?xml version="1.0" encoding="utf-8"?> <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"> <context:property-placeholder location="classpath:props.properties"/> <tx:annotation-driven transaction-manager="transactionmanager"/> <bean id="transactionmanager" class="org.springframework.orm.hibernate4.hibernatetransactionmanager"> <property name="sessionfactory" ref="mysessionfactory"/> </bean> <bean id="mysessionfactory" class="org.springframework.orm.hibernate4.localsessionfactorybean"> <property name="datasource" ref="mydatasource"/> <property name="hibernateproperties"> <props> <prop key="hibernate.dialect">${locationdb.hibernate.dialect}</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.hbm2ddl.auto">update</prop> <prop key="hibernate.current_session_context_class"> org.springframework.orm.hibernate4.springsessioncontext </prop> </props> </property> <property name="packagestoscan"> <list> <value>com.mypackage</value> </list> </property> </bean> <!-- location db datasource --> <!-- when changing between database types, take note: * change driverclass , driverclassname below. * update props.properties needed (see: endpoint , hibernate dialect) --> <bean id="mydatasource" class="com.mchange.v2.c3p0.combopooleddatasource" destroy-method="close"> <property name="driverclass" value="com.mysql.jdbc.driver"/> <property name="jdbcurl" value="${locationdb.endpoint}"/> <property name="user" value="${locationdb.username}"/> <property name="password" value="${locationdb.password}"/> <property name="acquireincrement" value="${locationdb.c3p0.acquireincrement}"/> <property name="minpoolsize" value="${locationdb.c3p0.minpoolsize}"/> <property name="maxpoolsize" value="${locationdb.c3p0.maxpoolsize}"/> <property name="maxidletime" value="${locationdb.c3p0.maxidletime}"/> </bean> <!-- location db mysql datasource --> <bean id="datasource" class="org.springframework.jdbc.datasource.drivermanagerdatasource"> <property name="driverclassname" value="com.mysql.jdbc.driver"/> <property name="url" value="${locationdb.endpoint}"/> <property name="username" value="${locationdb.username}"/> <property name="password" value="${locationdb.password}"/> </bean> <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"/> <bean id="serializer" class="org.springframework.data.redis.serializer.stringredisserializer"/> <bean id="redistemplate" class="org.springframework.data.redis.core.redistemplate" p:connectionfactory-ref="jedisconnfactory" p:defaultserializer-ref="serializer"/> <bean id="jedispoolconfig" class="redis.clients.jedis.jedispoolconfig" p:maxtotal="150" p:minidle="5" p:maxidle="15"/> <!-- job manager --> <bean id="jobmanager" class="com.mypackage.restws.controllers.jobs.jobmanager"/> <bean id="resttemplate" class="org.springframework.web.client.resttemplate"/>
and props.properties
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/
my buddies have project setup successfully, mine having error. there should consider in configuration?
this seems version incompatibility of libraries. ( verbose) way find out using "-verbose:class"
in jvm parameter of server startup. generate lot of logs prefer output file on server startup command line. on searching class in question, logs print jar , it's location classloader picked class. give hint compatibility issue.
Comments
Post a Comment