spring boot 项目启动报错:原因一般是注入了相同名字的service

 -- :: com.gxcards.mes.MainWwwWeb: logStartupProfileInfo INFO: No active profile set, falling back to default profiles: default
-- :: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext: prepareRefresh INFO: Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@: startup date [Thu Aug :: CST ]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@764faa6
-- :: org.springframework.beans.factory.support.DefaultListableBeanFactory: registerBeanDefinition INFO: Overriding bean definition for bean 'restTemplate' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=; dependencyCheck=; autowireCandidate=true; primary=false; factoryBeanName=restTemplateConfiguration; factoryMethodName=restTemplate; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/gxcards/mes/config/RestTemplateConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=; dependencyCheck=; autowireCandidate=true; primary=false; factoryBeanName=mainGoodsService; factoryMethodName=restTemplate; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/gxcards/mes/MainGoodsService.class]]
-- :: org.springframework.beans.factory.support.DefaultListableBeanFactory: registerBeanDefinition INFO: Overriding bean definition for bean 'restTemplate' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=; dependencyCheck=; autowireCandidate=true; primary=false; factoryBeanName=mainGoodsService; factoryMethodName=restTemplate; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/gxcards/mes/MainGoodsService.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=; dependencyCheck=; autowireCandidate=true; primary=false; factoryBeanName=mainWwwWeb; factoryMethodName=restTemplate; initMethodName=null; destroyMethodName=(inferred); defined in com.gxcards.mes.MainWwwWeb]
-- :: org.springframework.boot.SpringApplication: reportFailure ERROR: Application startup failed
java.lang.UnsupportedOperationException
at java.util.AbstractCollection.add(AbstractCollection.java:)
at java.util.AbstractCollection.addAll(AbstractCollection.java:)
at org.springframework.boot.web.servlet.ServletComponentScanRegistrar.updatePostProcessor(ServletComponentScanRegistrar.java:)
at org.springframework.boot.web.servlet.ServletComponentScanRegistrar.registerBeanDefinitions(ServletComponentScanRegistrar.java:)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromRegistrars(ConfigurationClassBeanDefinitionReader.java:)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:)
at com.gxcards.mes.MainWwwWeb.main(MainWwwWeb.java:)
-- :: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext: doClose INFO: Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@: startup date [Thu Aug :: CST ]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@764faa6
-- :: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext: doClose WARN: Exception thrown from LifecycleProcessor on context close
java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@: startup date [Thu Aug :: CST ]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@764faa6
at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:)
at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:)
at com.gxcards.mes.MainWwwWeb.main(MainWwwWeb.java:)
-- :: org.springframework.beans.factory.support.DefaultListableBeanFactory: destroyBean ERROR: Destroy method on bean with name 'org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory' threw an exception
java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@: startup date [Thu Aug :: CST ]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@764faa6
at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:)
at org.springframework.context.support.ApplicationListenerDetector.postProcessBeforeDestruction(ApplicationListenerDetector.java:)
at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:)
at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:)
at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:)
at com.gxcards.mes.MainWwwWeb.main(MainWwwWeb.java:)
Disconnected from the target VM, address: '127.0.0.1:61286', transport: 'socket'

说是在项目中有了相同的 Overriding bean definition for bean 'restTemplate',原来是在我的这个项目的pom文件中引用了另一个项目,另一个项目也注入有restTemplate,导致启动报错。把本项目中的引用的另一个项目删除就解决了。

java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context 错误的更多相关文章

  1. eclipse启动报错java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' befo

    报错: java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invo ...

  2. java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date [Mon Oct 01 16:32:37 CS

    使用idea工具更改项目包名时报 :java.lang.ClassNotFoundException 解决方案: 1.删除项目的target目录,这个目录存放的是编译后的文件 2.清除缓存 3.重新编 ...

  3. java.lang.IllegalStateException: ApplicationEventMulticaster not initialized

    <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring- ...

  4. 解决java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext这个问题

    今天在运行别人的SSH项目时,遇到了这个问题 严重: Exception sending context initialized event to listener instance of class ...

  5. java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext

    spring的项目中有时候会报错:java.lang.IllegalStateException: BeanFactory not initialized or already closed - ca ...

  6. 解决java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext问题

    使用ClassPathXmlApplicationContext加载项目时, ClassPathXmlApplicationContext context = new ClassPathXmlAppl ...

  7. 项目启动异常,java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext

    java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' befo ...

  8. ApplicationEventMulticaster not initialized - call 'refresh' before

    https://stackoverflow.com/questions/45318618/applicationeventmulticaster-not-initialized-call-refres ...

  9. Tomcat启动之异常java.lang.IllegalStateException

    严重: Exception sending context destroyed event to listener instance of class org.springframework.web. ...

随机推荐

  1. flask hook

    @app.before_first_requestdef before_first_request(): """在第一次请求之前会访问该函数""&qu ...

  2. JAVA String中文乱码

    System.out.println(str); String str1 = new String(str.getBytes("ISO-8859-1"), "utf-8& ...

  3. Cpython解释器GIL-多线程执行流程

  4. 关于SimpleDateFormat安全的时间格式化线程安全问题

    想必大家对SimpleDateFormat并不陌生.SimpleDateFormat 是 Java 中一个非常常用的类,该类用来对日期字符串进行解析和格式化输出,但如果使用不小心会导致非常微妙和难以调 ...

  5. MongoDB在Windows系统下的安装和启动

    版本选择MongoDB的版本命名规范如:x.y.z: y为奇数时表示当前版本为开发版,如:2.3.0.2.1.1: y为偶数时表示当前版本为稳定版,如:2.0.1.2.2.0: 目前官网上最新的版本为 ...

  6. CentOS7 源码编译安装Tengine

    简介 Tengine是由淘宝网发起的Web服务器项目.它在Nginx的基础上,针对大访问量网站的需求,添加了很多高级功能和特性.它的目的是打造一个高效.安全的Web平台. 发展 Tengine的性能和 ...

  7. meterpreter 持久后门

    创建持久后门 当成功获取目标系统的访问权限后,需要寻找方法来恢复与目标主机的连接,而无需再进入目标系统.如果目标用户破坏了该连接,例如重新启动计算机,此时使用后门将允许自动重新与目标系统建立连接.为了 ...

  8. Openstack oslo.config【一】

    OpenStack的项目貌似越来越多了,在Grizzly版之前,每个项目都得实现一套处理配置文件的代码.在每个项目的源码中基本上都可以找到openstack/common/cfg.py,inipars ...

  9. Install rapyuta client on Raspberry Pi

    Install rapyuta on client sudo git clone -b master https://github.com/cnsdytzy/-Rapyuta-installation ...

  10. UDP广播 与 TCP客户端 --服务端

    随着倒计时的响声,自觉无心工作,只想为祖国庆生. 最近有遇到过这样一个问题,将摄像头识别的行人,车辆实时显示在客户端中.有提供接口,会以Json的数据的形式将实时将识别的对象进行Post提交.所以我们 ...