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. 000-SQL Server

    MyWeb数据库,cantus表 USE [MyWeb]GO /****** Object: Table [dbo].[cantus] Script Date: 2017/12/12 12:12:12 ...

  2. 最新阿里云服务器免费SSL证书配置HTTPS的两种方法(图文教程二)

    在大家学习如何利用免费SSL证书配置网站HTTPS之前,我们先要搞清楚为什么要开启HTTPS,这个绿色的小锁真的有用吗?所谓的HTTPS其实是(安全套接字层超文本传输协议)是以安全为目标的HTTP通道 ...

  3. GALV_maptravel研究分析(2)

    本节地图:Gov's Mansion,Campsite,Yourmansion ++++++++++++++++++++华丽丽的分割线+++++++++++++++++++++++++++++++++ ...

  4. 莫名奇妙虚拟机 ip addr 不显示 ip 地址,连不上网络

    CentOS7 Failed to start LSB: Bring up/down networking. 说是mac地址不对.其实,本人并没有配置mac,按理说用的默认的.之前一直是可以正常工作的 ...

  5. HTTP劫持和DNS劫持

    HTTP劫持和DNS劫持 首先对运营商的劫持行为做一些分析,他们的目的无非就是赚钱,而赚钱的方式有两种: 1.对正常网站加入额外的广告,这包括网页内浮层或弹出广告窗口: 2.针对一些广告联盟或带推广链 ...

  6. Python汉罗塔

    第一步代码: import turtle class Stack: def __init__(self): self.items = [] def isEmpty(self): return len( ...

  7. [C++ Primer Plus] 第9章、内存模型和名称空间(一)程序清单

    程序清单9.9(静态存储连续性.无链接性) #include<iostream> using namespace std; ; void strcount(const char *str) ...

  8. [c/c++] programming之路(26)、结构体

    一.初始化字符串 #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<stdlib.h> #include&l ...

  9. day14带参装饰器,迭代器,可迭代对象 , 迭代器对象 ,for迭代器 , 枚举对象

    复习 ''' 函数的嵌套定义:在函数内部定义另一个函数 闭包:被嵌套的函数 -- 1.外层通过形参给内层函数传参 -- 2.验证执行 开放封闭原则: 功能可以拓展,但源代码与调用方式都不可以改变 装饰 ...

  10. Pycharm 的设置--参数设置(运行.py文件带参数,例如argument)

    程序运行时,如果需要输入参数,如下图中程序代码: 在生成exe后,程序在控制台下运行时格式为: 这种情况在调试程序时,如果只是在Pycharm环境中简单执行“Run”菜单下的“Run”命令,会出现以下 ...