java - ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context -
i developing spring boot application , using hikaricp connection pool , jdbc template insert data database.but when start error.
java.lang.illegalstateexception: applicationeventmulticaster not initialized - call 'refresh' before multicasting events via context: org.springframework.boot.context.embedded.annotationconfigembeddedwebapplicationcontext@1c90ca10: startup date [wed jul 26 13:55:18 sgt 2017]; root of context hierarchy @ org.springframework.context.support.abstractapplicationcontext.getapplicationeventmulticaster(abstractapplicationcontext.java:404) [spring-context-4.3.7.release.jar:4.3.7.release] @ org.springframework.context.support.applicationlistenerdetector.postprocessbeforedestruction(applicationlistenerdetector.java:97) ~[spring-context-4.3.7.release.jar:4.3.7.release] @ org.springframework.beans.factory.support.disposablebeanadapter.destroy(disposablebeanadapter.java:253) ~[spring-beans-4.3.7.release.jar:4.3.7.release] @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.destroybean(defaultsingletonbeanregistry.java:578) [spring-beans-4.3.7.release.jar:4.3.7.release] @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.destroysingleton(defaultsingletonbeanregistry.java:554) [spring-beans-4.3.7.release.jar:4.3.7.release] @ org.springframework.beans.factory.support.defaultlistablebeanfactory.destroysingleton(defaultlistablebeanfactory.java:961) [spring-beans-4.3.7.release.jar:4.3.7.release] @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.destroysingletons(defaultsingletonbeanregistry.java:523) [spring-beans-4.3.7.release.jar:4.3.7.release] @ org.springframework.beans.factory.support.defaultlistablebeanfactory.destroysingletons(defaultlistablebeanfactory.java:968) [spring-beans-4.3.7.release.jar:4.3.7.release] @ org.springframework.context.support.abstractapplicationcontext.destroybeans(abstractapplicationcontext.java:1033) [spring-context-4.3.7.release.jar:4.3.7.release] @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:555) [spring-context-4.3.7.release.jar:4.3.7.release] @ org.springframework.boot.context.embedded.embeddedwebapplicationcontext.refresh(embeddedwebapplicationcontext.java:122) [spring-boot-1.5.2.release.jar:1.5.2.release] @ org.springframework.boot.springapplication.refresh(springapplication.java:737) [spring-boot-1.5.2.release.jar:1.5.2.release] @ org.springframework.boot.springapplication.refreshcontext(springapplication.java:370) [spring-boot-1.5.2.release.jar:1.5.2.release] @ org.springframework.boot.springapplication.run(springapplication.java:314) [spring-boot-1.5.2.release.jar:1.5.2.release] @ org.springframework.boot.springapplication.run(springapplication.java:1162) [spring-boot-1.5.2.release.jar:1.5.2.release] @ org.springframework.boot.springapplication.run(springapplication.java:1151) [spring-boot-1.5.2.release.jar:1.5.2.release] @ com.dmmltasmu.driverguidanceapiapplication.main(driverguidanceapiapplication.java:24) [classes/:na] 2017-07-26 13:55:20.222 error 10164 --- [ main] o.s.b.f.s.defaultlistablebeanfactory : destroy method on bean name 'org.springframework.boot.context.properties.configurationpropertiesbindingpostprocessor' threw exception java.lang.illegalstateexception: applicationeventmulticaster not initialized - call 'refresh' before multicasting events via context: org.springframework.boot.context.embedded.annotationconfigembeddedwebapplicationcontext@1c90ca10: startup date [wed jul 26 13:55:18 sgt 2017]; root of context hierarchy @ org.springframework.context.support.abstractapplicationcontext.getapplicationeventmulticaster(abstractapplicationcontext.java:404) [spring-context-4.3.7.release.jar:4.3.7.release] @ org.springframework.context.support.applicationlistenerdetector.postprocessbeforedestruction(applicationlistenerdetector.java:97) ~[spring-context-4.3.7.release.jar:4.3.7.release] @ org.springframework.beans.factory.support.disposablebeanadapter.destroy(disposablebeanadapter.java:253) ~[spring-beans-4.3.7.release.jar:4.3.7.release] @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.destroybean(defaultsingletonbeanregistry.java:578) [spring-beans-4.3.7.release.jar:4.3.7.release] @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.destroysingleton(defaultsingletonbeanregistry.java:554) [spring-beans-4.3.7.release.jar:4.3.7.release] @ org.springframework.beans.factory.support.defaultlistablebeanfactory.destroysingleton(defaultlistablebeanfactory.java:961) [spring-beans-4.3.7.release.jar:4.3.7.release] @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.destroysingletons(defaultsingletonbeanregistry.java:523) [spring-beans-4.3.7.release.jar:4.3.7.release] @ org.springframework.beans.factory.support.defaultlistablebeanfactory.destroysingletons(defaultlistablebeanfactory.java:968) [spring-beans-4.3.7.release.jar:4.3.7.release] @ org.springframework.context.support.abstractapplicationcontext.destroybeans(abstractapplicationcontext.java:1033) [spring-context-4.3.7.release.jar:4.3.7.release] @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:555) [spring-context-4.3.7.release.jar:4.3.7.release] @ org.springframework.boot.context.embedded.embeddedwebapplicationcontext.refresh(embeddedwebapplicationcontext.java:122) [spring-boot-1.5.2.release.jar:1.5.2.release] @ org.springframework.boot.springapplication.refresh(springapplication.java:737) [spring-boot-1.5.2.release.jar:1.5.2.release] @ org.springframework.boot.springapplication.refreshcontext(springapplication.java:370) [spring-boot-1.5.2.release.jar:1.5.2.release] @ org.springframework.boot.springapplication.run(springapplication.java:314) [spring-boot-1.5.2.release.jar:1.5.2.release] @ org.springframework.boot.springapplication.run(springapplication.java:1162) [spring-boot-1.5.2.release.jar:1.5.2.release] @ org.springframework.boot.springapplication.run(springapplication.java:1151) [spring-boot-1.5.2.release.jar:1.5.2.release] @ com.dmmltasmu.driverguidanceapiapplication.main(driverguidanceapiapplication.java:24) [classes/:na] 2017-07-26 13:55:20.222 error 10164 --- [ main] o.s.b.f.s.defaultlistablebeanfactory : destroy method on bean name 'org.springframework.boot.autoconfigure.internalcachingmetadatareaderfactory' threw exception java.lang.illegalstateexception: applicationeventmulticaster not initialized - call 'refresh' before multicasting events via context: org.springframework.boot.context.embedded.annotationconfigembeddedwebapplicationcontext@1c90ca10: startup date [wed jul 26 13:55:18 sgt 2017]; root of context hierarchy @ org.springframework.context.support.abstractapplicationcontext.getapplicationeventmulticaster(abstractapplicationcontext.java:404) [spring-context-4.3.7.release.jar:4.3.7.release] @ org.springframework.context.support.applicationlistenerdetector.postprocessbeforedestruction(applicationlistenerdetector.java:97) ~[spring-context-4.3.7.release.jar:4.3.7.release] @ org.springframework.beans.factory.support.disposablebeanadapter.destroy(disposablebeanadapter.java:253) ~[spring-beans-4.3.7.release.jar:4.3.7.release] @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.destroybean(defaultsingletonbeanregistry.java:578) [spring-beans-4.3.7.release.jar:4.3.7.release] @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.destroysingleton(defaultsingletonbeanregistry.java:554) [spring-beans-4.3.7.release.jar:4.3.7.release] @ org.springframework.beans.factory.support.defaultlistablebeanfactory.destroysingleton(defaultlistablebeanfactory.java:961) [spring-beans-4.3.7.release.jar:4.3.7.release] @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.destroysingletons(defaultsingletonbeanregistry.java:523) [spring-beans-4.3.7.release.jar:4.3.7.release] @ org.springframework.beans.factory.support.defaultlistablebeanfactory.destroysingletons(defaultlistablebeanfactory.java:968) [spring-beans-4.3.7.release.jar:4.3.7.release] @ org.springframework.context.support.abstractapplicationcontext.destroybeans(abstractapplicationcontext.java:1033) [spring-context-4.3.7.release.jar:4.3.7.release] @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:555) [spring-context-4.3.7.release.jar:4.3.7.release] @ org.springframework.boot.context.embedded.embeddedwebapplicationcontext.refresh(embeddedwebapplicationcontext.java:122) [spring-boot-1.5.2.release.jar:1.5.2.release] @ org.springframework.boot.springapplication.refresh(springapplication.java:737) [spring-boot-1.5.2.release.jar:1.5.2.release] @ org.springframework.boot.springapplication.refreshcontext(springapplication.java:370) [spring-boot-1.5.2.release.jar:1.5.2.release] @ org.springframework.boot.springapplication.run(springapplication.java:314) [spring-boot-1.5.2.release.jar:1.5.2.release] @ org.springframework.boot.springapplication.run(springapplication.java:1162) [spring-boot-1.5.2.release.jar:1.5.2.release] @ org.springframework.boot.springapplication.run(springapplication.java:1151) [spring-boot-1.5.2.release.jar:1.5.2.release] @ com.dmmltasmu.driverguidanceapiapplication.main(driverguidanceapiapplication.java:24) [classes/:na] 2017-07-26 13:55:20.227 error 10164 --- [ main] o.s.boot.springapplication : application startup failed org.springframework.beans.factory.beancreationexception: error creating bean name 'persistenceexceptiontranslationpostprocessor' defined in class path resource [org/springframework/boot/autoconfigure/dao/persistenceexceptiontranslationautoconfiguration.class]: initialization of bean failed; nested exception java.lang.illegalstateexception: no persistence exception translators found in bean factory. cannot perform exception translation. @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:564) ~[spring-beans-4.3.7.release.jar:4.3.7.release] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:483) ~[spring-beans-4.3.7.release.jar:4.3.7.release] @ org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:306) ~[spring-beans-4.3.7.release.jar:4.3.7.release] @ org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:230) ~[spring-beans-4.3.7.release.jar:4.3.7.release] @ org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:302) ~[spring-beans-4.3.7.release.jar:4.3.7.release] @ org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:202) ~[spring-beans-4.3.7.release.jar:4.3.7.release] @ org.springframework.context.support.postprocessorregistrationdelegate.registerbeanpostprocessors(postprocessorregistrationdelegate.java:223) ~[spring-context-4.3.7.release.jar:4.3.7.release] @ org.springframework.context.support.abstractapplicationcontext.registerbeanpostprocessors(abstractapplicationcontext.java:702) ~[spring-context-4.3.7.release.jar:4.3.7.release] @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:527) ~[spring-context-4.3.7.release.jar:4.3.7.release] @ org.springframework.boot.context.embedded.embeddedwebapplicationcontext.refresh(embeddedwebapplicationcontext.java:122) ~[spring-boot-1.5.2.release.jar:1.5.2.release] @ org.springframework.boot.springapplication.refresh(springapplication.java:737) [spring-boot-1.5.2.release.jar:1.5.2.release] @ org.springframework.boot.springapplication.refreshcontext(springapplication.java:370) [spring-boot-1.5.2.release.jar:1.5.2.release] @ org.springframework.boot.springapplication.run(springapplication.java:314) [spring-boot-1.5.2.release.jar:1.5.2.release] @ org.springframework.boot.springapplication.run(springapplication.java:1162) [spring-boot-1.5.2.release.jar:1.5.2.release] @ org.springframework.boot.springapplication.run(springapplication.java:1151) [spring-boot-1.5.2.release.jar:1.5.2.release] @ com.dmmltasmu.driverguidanceapiapplication.main(driverguidanceapiapplication.java:24) [classes/:na] caused by: java.lang.illegalstateexception: no persistence exception translators found in bean factory. cannot perform exception translation. @ org.springframework.dao.support.persistenceexceptiontranslationinterceptor.detectpersistenceexceptiontranslators(persistenceexceptiontranslationinterceptor.java:142) ~[spring-tx-3.1.1.release.jar:3.1.1.release] @ org.springframework.dao.support.persistenceexceptiontranslationinterceptor.<init>(persistenceexceptiontranslationinterceptor.java:79) ~[spring-tx-3.1.1.release.jar:3.1.1.release] @ org.springframework.dao.annotation.persistenceexceptiontranslationadvisor.<init>(persistenceexceptiontranslationadvisor.java:70) ~[spring-tx-3.1.1.release.jar:3.1.1.release] @ org.springframework.dao.annotation.persistenceexceptiontranslationpostprocessor.setbeanfactory(persistenceexceptiontranslationpostprocessor.java:103) ~[spring-tx-3.1.1.release.jar:3.1.1.release] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.invokeawaremethods(abstractautowirecapablebeanfactory.java:1647) ~[spring-beans-4.3.7.release.jar:4.3.7.release] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1615) ~[spring-beans-4.3.7.release.jar:4.3.7.release] @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:555) ~[spring-beans-4.3.7.release.jar:4.3.7.release] ... 15 common frames omitted
my pom.xml below:
<dependencies> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-jdbc</artifactid> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-tx</artifactid> <version>3.1.1.release</version> </dependency> <dependency> <groupid>com.zaxxer</groupid> <artifactid>hikaricp-java7</artifactid> <version>2.4.12</version> </dependency> <dependency> <groupid>org.asynchttpclient</groupid> <artifactid>async-http-client</artifactid> <version>2.0.11</version> </dependency> <!-- https://mvnrepository.com/artifact/org.springframework/spring-jdbc --> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-jdbc</artifactid> <version>2.0.6</version> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-thymeleaf</artifactid> </dependency> <dependency> <groupid>io.jsonwebtoken</groupid> <artifactid>jjwt</artifactid> <version>0.6.0</version> </dependency> <dependency> <groupid>org.springframework.security.oauth</groupid> <artifactid>spring-security-oauth2</artifactid> </dependency> <dependency> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-war-plugin</artifactid> <version>3.0.0</version> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-test</artifactid> <scope>test</scope> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-security</artifactid> </dependency> <dependency> <groupid>org.springframework.security.oauth</groupid> <artifactid>spring-security-oauth2</artifactid> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-web</artifactid> </dependency> <dependency> <groupid>org.springframework.mobile</groupid> <artifactid>spring-mobile-device</artifactid> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-tomcat</artifactid> <scope>provided</scope> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-test</artifactid> <scope>test</scope> </dependency> <dependency> <groupid>com.opencsv</groupid> <artifactid>opencsv</artifactid> <version>1.0</version> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-logging</artifactid> <version>1.4.1.release</version> </dependency> <dependency> <groupid>com.fasterxml.jackson.core</groupid> <artifactid>jackson-core</artifactid> <version>2.8.5</version> </dependency> <!-- <dependency> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-compiler-plugin</artifactid> <version>3.1</version> </dependency> --> <dependency> <groupid>org.codehaus.jackson</groupid> <artifactid>jackson-mapper-asl</artifactid> <version>1.9.13</version> </dependency> <dependency> <groupid>com.fasterxml.jackson.core</groupid> <artifactid>jackson-databind</artifactid> <version>2.5.3</version> </dependency> <dependency> <groupid>org.postgresql</groupid> <artifactid>postgresql</artifactid> <version>9.4-1201-jdbc41</version> </dependency> <dependency> <groupid>com.google.code.gson</groupid> <artifactid>gson</artifactid> <version>2.8.1</version> </dependency> <dependency> <groupid>org.apache.commons</groupid> <artifactid>commons-dbcp2</artifactid> <version>2.0</version> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-configuration-processor</artifactid> <optional>true</optional> </dependency> </dependencies>
my application class below:
@springbootapplication @enablescheduling @enablecaching @enableasync @enableautoconfiguration public class driverguidanceapiapplication implements asyncconfigurer { public static void main(string[] args) { springapplication.run(driverguidanceapiapplication.class, args); } @override public executor getasyncexecutor() { threadpooltaskexecutor executor = new threadpooltaskexecutor(); executor.setcorepoolsize(1000); executor.setmaxpoolsize(3000); executor.setqueuecapacity(1000); executor.setthreadnameprefix("dgs -"); executor.initialize(); return executor; } @override public asyncuncaughtexceptionhandler getasyncuncaughtexceptionhandler() { return null; } }
i not sure causing error because dependencies there , runs in application well. appreciated.
it due version conflict wheni updated version
<dependency> <groupid>org.springframework</groupid> <artifactid>spring-jdbc</artifactid> <version>2.0.6</version> </dependency>
to
<dependency> <groupid>org.springframework</groupid> <artifactid>spring-jdbc</artifactid> <version>4.3.8.release</version> </dependency>
it worked fine. hope helps same issue.
Comments
Post a Comment