首页 > 其他分享 >Error creating bean with name 'tomcatEmbeddedServletContainerFactory ' (o

Error creating bean with name 'tomcatEmbeddedServletContainerFactory ' (o

时间:2022-10-24 15:02:42浏览次数:47  
标签:web creating spring boot springframework bean autoconfigure tomcatEmbeddedServle

 

org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat
org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat

tomcatEmbeddedServletContainerFactory

问题:

org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tomcatEmbeddedServletContainerFactory' defined in class path resource [org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat.class]: factory-bean 'org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat' (or a BeanPostProcessor involved) returned null

解决办法:

Error creating bean with name

解决过程:

刚开始看到这个报错,觉得莫名其妙,什么也没做,怎么就不行了。

看到是tomcatEmbeddedServletContainerFactory,就想会不是因为tomcat相关的配置错误,但看了下properties文件,除了这些,就没有web服务的配置了

Error creating bean with name

 

就打了个断点,跟了下,也没有发现啥【陌生信息太多,迷失了。。。】



无意中使用关键词搜了下,发现在日志中出现的次数挺多。

Error creating bean with name

 根据报错信息的中“(or a BeanPostProcessor involved) returned null”  搜了下,看到这段:

Error creating bean with name

Error creating bean with name

想起之前为了梳理Spring启动过程,对各种场景的加载顺序时,也实现了一个BeanPostProcessor的实例。一个代码,果然 返回了null

Error creating bean with name

 



Error creating bean with name

 

详细日志:

2019-07-26 15:27:40.376  INFO 30704 --- [main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@78aab498: startup date [Fri Jul 26 15:27:40 CST 2019]; root of context hierarchy
2019-07-26 15:27:42.871 INFO 30704 --- [main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2019-07-26 15:27:43.174 INFO 30704 --- [main] trationDelegate$BeanPostProcessorChecker : Bean 'taskExecutorConfig' of type [com.tangcheng.learning.thread.TaskExecutorConfig$$EnhancerBySpringCGLIB$$f66efd1e] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-07-26 15:27:43.178 INFO 30704 --- [main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService
2019-07-26 15:27:43.892 INFO 30704 --- [main] trationDelegate$BeanPostProcessorChecker : Bean 'springInitBeanLifeCycleConfig' of type [com.tangcheng.learning.init.spring.SpringInitBeanLifeCycleConfig$$EnhancerBySpringCGLIB$$86d260bc] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-07-26 15:27:43.916 INFO 30704 --- [main] c.t.learning.init.spring.SpringInitBean : begin to execute Constructor Function
2019-07-26 15:27:43.939 INFO 30704 --- [main] c.t.learning.init.spring.SpringInitBean : Step-3调用。BeanNameAware.setBeanName springInitBean
2019-07-26 15:27:43.947 INFO 30704 --- [main] c.t.learning.init.spring.SpringInitBean : Step-4调用。BeanFactoryAware.setBeanFactory org.springframework.beans.factory.support.DefaultListableBeanFactory@273444fe: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.event.internalEventListenerProcessor,org.springframework.context.event.internalEventListenerFactory,demoApplication,org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory,restClient,conditionConfig,authorSettings,settingsConfig,eventBusConfig,observer1,observer2,subject,initBeanConfig,springInitBeanLifeCycleConfig,handler1Impl,handler2Impl,handlerService,redisDemo,echoBiz,quartzConfig,myJobFactory,echoJob,echoService,schedulerConfig,AServiceWithAopImpl,BServiceWithAopImpl,distributedLockAspect,distributeLockServiceImpl,defaultKeyGenerator,validatedServiceImpl,asyncTaskService,taskExecutorConfig,downController,helloController,httpMessageConverterTestController,invalidAopDemoController,MVC_DSL_TestController,mvcAnnotationDemoController,orderRestAPIController,requestParameterInitTestController,requestValidatedDemoController,serviceValidatedController,ctxCommandLine,globalExceptionHandler,randomStringConfig,redisConfig,restTemplateConfig,webConfig,indexController,weatherUserInfoExcelView,swaggerAutoConfiguration,swagger2Configuration,JSONPResponseBodyAdvice,fastJsonViewResponseBodyAdvice,fastJsonpResponseBodyAdvice,serviceModelToSwagger2MapperImpl,vendorExtensionsMapperImpl,parameterMapperImpl,modelMapperImpl,licenseMapperImpl,securityMapperImpl,apiListingReferenceScanner,apiDocumentationScanner,apiDescriptionReader,apiListingReader,cachingOperationReader,mediaTypeReader,apiListingScanner,apiModelReader,apiDescriptionLookup,operationModelsProvider,operationDeprecatedReader,responseMessagesReader,operationParameterReader,defaultTagsProvider,operationTagsReader,apiOperationReader,defaultOperationReader,operationParameterRequestConditionReader,operationParameterHeadersConditionReader,operationResponseClassReader,cachingOperationNameGenerator,parameterMultiplesReader,modelAttributeParameterExpander,parameterTypeReader,parameterRequiredReader,parameterDataTypeReader,parameterDefaultReader,parameterNameReader,expandedParameterBuilder,documentationPluginsBootstrapper,webMvcRequestHandlerProvider,documentationPluginsManager,queryStringUriTemplateDecorator,pathMappingDecorator,pathSanitizer,operationPathDecorator,cachingModelDependencyProvider,typeNameExtractor,propertyDiscriminatorBasedInheritancePlugin,xmlModelPlugin,schemaPluginsManager,cachingModelPropertiesProvider,objectMapperBeanPropertyNamingStrategy,accessorsProvider,fieldProvider,xmlPropertyPlugin,optimized,factoryMethodProvider,cachingModelProvider,defaultModelDependencyProvider,jacksonEnumTypeDeterminer,defaultModelProvider,apiModelPropertyPropertyBuilder,apiModelTypeNameProvider,apiModelBuilder,operationImplicitParameterReader,vendorExtensionsReader,swaggerOperationResponseClassReader,swaggerOperationModelsProvider,swaggerMediaTypeReader,operationHttpMethodReader,operationImplicitParametersReader,operationAuthReader,operationHiddenReader,operationSummaryReader,swaggerResponseMessageReader,operationNicknameIntoUniqueIdReader,operationPositionReader,operationNotesReader,swaggerOperationTagsReader,swaggerParameterDescriptionReader,swaggerExpandedParameterBuilder,swaggerApiListingReader,classOrApiAnnotationResourceGrouping,inMemorySwaggerResourcesProvider,apiResourceController,windowsListService,springfox.documentation.schema.configuration.ModelsConfiguration,typeResolver,modelBuilderPluginRegistry,modelPropertyBuilderPluginRegistry,typeNameProviderPluginRegistry,syntheticModelProviderPluginRegistry,springfox.documentation.spring.web.SpringfoxWebMvcConfiguration,defaults,resourceGroupCache,objectMapperConfigurer,jsonSerializer,descriptionResolver,methodResolver,documentationPluginRegistry,apiListingBuilderPluginRegistry,operationBuilderPluginRegistry,parameterBuilderPluginRegistry,expandedParameterBuilderPluginRegistry,resourceGroupingStrategyRegistry,operationModelsProviderPluginRegistry,defaultsProviderPluginRegistry,pathDecoratorRegistry,apiListingScannerPluginRegistry,springfox.documentation.swagger.configuration.SwaggerCommonConfiguration,springfox.documentation.swagger2.configuration.Swagger2DocumentationConfiguration,swagger2Module,swagger2ControllerMapping,springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration,expanderMinMax,expanderNotNull,expanderPattern,expanderSize,parameterMinMax,parameterNotNull,parameterPattern,parameterSize,minMaxPlugin,decimalMinMaxPlugin,sizePlugin,notNullPlugin,patternPlugin,org.springframework.boot.autoconfigure.condition.BeanTypeRegistry,swaggerProperties,uiConfiguration,createRestApi,eventBus,initBean,springInitBean,scheduler,org.springframework.scheduling.annotation.SchedulingConfiguration,org.springframework.context.annotation.internalScheduledAnnotationProcessor,org.springframework.scheduling.annotation.ProxyAsyncConfiguration,org.springframework.context.annotation.internalAsyncAnnotationProcessor,commandLineRunner,randomStringGenerator,redisTemplate,stringRedisTemplate,hashOperations,listOperations,setOperations,zSetOperations,restTemplate,fastJsonHttpMessageConverter,org.springframework.boot.autoconfigure.AutoConfigurationPackages,org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration,propertySourcesPlaceholderConfigurer,org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$Jackson2ObjectMapperBuilderCustomizerConfiguration,standardJacksonObjectMapperBuilderCustomizer,spring.jackson-org.springframework.boot.autoconfigure.jackson.JacksonProperties,org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor,org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.store,org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperBuilderConfiguration,jacksonObjectMapperBuilder,org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperConfiguration,jacksonObjectMapper,org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration,jsonComponentModule,org.springframework.boot.autoconfigure.websocket.WebSocketAutoConfiguration$TomcatWebSocketConfiguration,websocketContainerCustomizer,org.springframework.boot.autoconfigure.websocket.WebSocketAutoConfiguration,org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat,tomcatEmbeddedServletContainerFactory,org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration,embeddedServletContainerCustomizerBeanPostProcessor,errorPageRegistrarBeanPostProcessor,org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration$DispatcherServletConfiguration,dispatcherServlet,spring.mvc-org.springframework.boot.autoconfigure.web.WebMvcProperties,org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration$DispatcherServletRegistrationConfiguration,dispatcherServletRegistration,org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration,org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration,defaultValidator,methodValidationPostProcessor,org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration,error,beanNameViewResolver,org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$DefaultErrorViewResolverConfiguration,conventionErrorViewResolver,org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration,errorAttributes,basicErrorController,errorPageCustomizer,preserveErrorControllerTargetClassPostProcessor,spring.resources-org.springframework.boot.autoconfigure.web.ResourceProperties,org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration,requestMappingHandlerAdapter,requestMappingHandlerMapping,mvcValidator,mvcContentNegotiationManager,mvcPathMatcher,mvcUrlPathHelper,viewControllerHandlerMapping,beanNameHandlerMapping,resourceHandlerMapping,mvcResourceUrlProvider,defaultServletHandlerMapping,mvcConversionService,mvcUriComponentsContributor,httpRequestHandlerAdapter,simpleControllerHandlerAdapter,handlerExceptionResolver,mvcViewResolver,mvcHandlerMappingIntrospector,org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter$FaviconConfiguration,faviconHandlerMapping,faviconRequestHandler,org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter,defaultViewResolver,viewResolver,welcomePageHandlerMapping,requestContextFilter,org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration,hiddenHttpMethodFilter,httpPutFormContentFilter,org.springframework.boot.actuate.autoconfigure.AuditAutoConfiguration$AuditEventRepositoryConfiguration,auditEventRepository,org.springframework.boot.actuate.autoconfigure.AuditAutoConfiguration,auditListener,org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration$RedisConfiguration,org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration$RedisConnectionConfiguration,redisConnectionFactory,org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration,spring.redis-org.springframework.boot.autoconfigure.data.redis.RedisProperties,org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration,spring.info-org.springframework.boot.autoconfigure.info.ProjectInfoProperties,org.springframework.boot.actuate.autoconfigure.InfoContributorAutoConfiguration,envInfoContributor,management.info-org.springframework.boot.actuate.autoconfigure.InfoContributorProperties,org.springframework.boot.actuate.autoconfigure.HealthIndicatorAutoConfiguration$DiskSpaceHealthIndicatorConfiguration,diskSpaceHealthIndicator,diskSpaceHealthIndicatorProperties,org.springframework.boot.actuate.autoconfigure.HealthIndicatorAutoConfiguration,healthAggregator,management.health.status-org.springframework.boot.actuate.autoconfigure.HealthIndicatorProperties,org.springframework.boot.actuate.autoconfigure.MetricRepositoryAutoConfiguration$FastMetricServicesConfiguration,counterBuffers,gaugeBuffers,actuatorMetricReader,counterService,gaugeService,org.springframework.boot.actuate.autoconfigure.MetricRepositoryAutoConfiguration,org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration,mbeanExporter,objectNamingStrategy,mbeanServer,org.springframework.boot.actuate.autoconfigure.PublicMetricsAutoConfiguration$TomcatMetricsConfiguration,tomcatPublicMetrics,org.springframework.boot.actuate.autoconfigure.PublicMetricsAutoConfiguration,systemPublicMetrics,metricReaderPublicMetrics,org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration$RequestMappingEndpointConfiguration,requestMappingEndpoint,org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration,environmentEndpoint,healthEndpoint,beansEndpoint,infoEndpoint,loggersEndpoint,metricsEndpoint,traceEndpoint,dumpEndpoint,autoConfigurationReportEndpoint,shutdownEndpoint,configurationPropertiesReportEndpoint,endpoints-org.springframework.boot.actuate.endpoint.EndpointProperties,org.springframework.boot.actuate.autoconfigure.EndpointMBeanExportAutoConfiguration,endpointMBeanExporter,auditEventsEndpoint,endpoints.jmx-org.springframework.boot.actuate.autoconfigure.EndpointMBeanExportProperties,org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration,serverProperties,duplicateServerPropertiesDetector,org.springframework.boot.actuate.autoconfigure.ManagementServerPropertiesAutoConfiguration,managementServerProperties,org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration$StringHttpMessageConverterConfiguration,stringHttpMessageConverter,spring.http.encoding-org.springframework.boot.autoconfigure.web.HttpEncodingProperties,org.springframework.boot.autoconfigure.web.JacksonHttpMessageConvertersConfiguration$MappingJackson2HttpMessageConverterConfiguration,mappingJackson2HttpMessageConverter,org.springframework.boot.autoconfigure.web.JacksonHttpMessageConvertersConfiguration,org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration,messageConverters,org.springframework.boot.actuate.autoconfigure.EndpointWebMvcManagementContextConfiguration,endpointHandlerMapping,mvcEndpoints,environmentMvcEndpoint,heapdumpMvcEndpoint,healthMvcEndpoint,loggersMvcEndpoint,metricsMvcEndpoint,logfileMvcEndpoint,auditEventMvcEndpoint,endpoints.health-org.springframework.boot.actuate.autoconfigure.HealthMvcEndpointProperties,endpoints.cors-org.springframework.boot.actuate.autoconfigure.EndpointCorsProperties,org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$EndpointWebMvcConfiguration,org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$ApplicationContextFilterConfiguration,applicationContextIdFilter,org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration,managementContextResolver,managementServletContext,org.springframework.boot.actuate.autoconfigure.MetricExportAutoConfiguration$MetricExportPropertiesConfiguration,spring.metrics.export-org.springframework.boot.actuate.metrics.export.MetricExportProperties,org.springframework.boot.actuate.autoconfigure.MetricExportAutoConfiguration$StatsdConfiguration,org.springframework.boot.actuate.autoconfigure.MetricExportAutoConfiguration,metricWritersMetricExporter,org.springframework.boot.actuate.autoconfigure.MetricFilterAutoConfiguration,metricsFilter,endpoints.metrics.filter-org.springframework.boot.actuate.autoconfigure.MetricFilterProperties,org.springframework.boot.actuate.autoconfigure.TraceRepositoryAutoConfiguration,traceRepository,org.springframework.boot.actuate.autoconfigure.TraceWebFilterAutoConfiguration,webRequestLoggingFilter,management.trace-org.springframework.boot.actuate.trace.TraceProperties,org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration,springApplicationAdminRegistrar,org.springframework.boot.autoconfigure.aop.AopAutoConfiguration$JdkDynamicAutoProxyConfiguration,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.boot.autoconfigure.aop.AopAutoConfiguration,org.springframework.boot.autoconfigure.context.ConfigurationPropertiesAutoConfiguration,org.springframework.boot.autoconfigure.dao.PersistenceExceptionTranslationAutoConfiguration,persistenceExceptionTranslationPostProcessor,org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration,keyValueMappingContext,redisCustomConversions,redisReferenceResolver,redisConverter,redisKeyValueAdapter,redisKeyValueTemplate,org.springframework.data.web.config.ProjectingArgumentResolverRegistrar,projectingArgumentResolverBeanPostProcessor,org.springframework.data.web.config.SpringDataWebConfiguration,pageableResolver,sortResolver,org.springframework.data.web.config.SpringDataJacksonConfiguration,jacksonGeoModule,org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration,org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration,platformTransactionManagerCustomizers,spring.transaction-org.springframework.boot.autoconfigure.transaction.TransactionProperties,org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$ThymeleafResourceHandlingConfig,org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$ThymeleafWebLayoutConfiguration,layoutDialect,org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$ThymeleafDefaultConfiguration,templateEngine,org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$Thymeleaf3Configuration$Thymeleaf3ViewResolverConfiguration,thymeleafViewResolver,org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$Thymeleaf3Configuration$DefaultTemplateResolverConfiguration,defaultTemplateResolver,org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$Thymeleaf3Configuration,org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration,spring.thymeleaf-org.springframework.boot.autoconfigure.thymeleaf.ThymeleafProperties,org.springframework.boot.autoconfigure.web.HttpEncodingAutoConfiguration,characterEncodingFilter,localeCharsetMappingsCustomizer,org.springframework.boot.autoconfigure.web.MultipartAutoConfiguration,multipartConfigElement,multipartResolver,spring.http.multipart-org.springframework.boot.autoconfigure.web.MultipartProperties,org.springframework.boot.autoconfigure.web.WebClientAutoConfiguration$RestTemplateConfiguration,restTemplateBuilder,org.springframework.boot.autoconfigure.web.WebClientAutoConfiguration]; root of factory hierarchy
2019-07-26 15:27:43.951 INFO 30704 --- [main] c.t.learning.init.spring.SpringInitBean : Step-5调用。ApplicationContextAware.setApplicationContext org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@78aab498: startup date [Fri Jul 26 15:27:40 CST 2019]; root of context hierarchy
2019-07-26 15:27:43.953 INFO 30704 --- [main] c.t.learning.init.spring.SpringInitBean : begin to execute @PostConstruct
2019-07-26 15:27:43.954 INFO 30704 --- [main] c.t.learning.init.spring.SpringInitBean : Step-7调用。InitializingBean.afterPropertiesSet
2019-07-26 15:27:43.955 INFO 30704 --- [main] c.t.learning.init.spring.SpringInitBean : Step-7调用。类似地,如果bean使用init-method声明了初始化方法,该方法也会被调用
2019-07-26 15:27:43.956 INFO 30704 --- [main] c.t.learning.init.spring.SpringInitBean : begin to execute initMethod
2019-07-26 15:27:44.083 INFO 30704 --- [main] c.t.learning.init.spring.SpringInitBean : Step-6调用。BeanPostProcessor.postProcessBeforeInitialization bean=org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat$$EnhancerBySpringCGLIB$$9aeb279f,beanName=org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat
2019-07-26 15:27:44.104 INFO 30704 --- [main] c.t.learning.init.spring.SpringInitBean : Step-8调用。BeanPostProcessor.postProcessAfterInitialization bean=org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat$$EnhancerBySpringCGLIB$$9aeb279f@67aaf882,beanName=org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat
2019-07-26 15:27:44.109 WARN 30704 --- [main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tomcatEmbeddedServletContainerFactory' defined in class path resource [org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat.class]: factory-bean 'org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat' (or a BeanPostProcessor involved) returned null
2019-07-26 15:27:44.111 INFO 30704 --- [main] c.t.learning.init.spring.SpringInitBean : Step-10调用。DisposableBean.destroy
2019-07-26 15:27:44.114 INFO 30704 --- [main] c.t.learning.init.spring.SpringInitBean : Step-10调用。同样,如果bean使用destroy-method声明了销毁方法,该方法也会被调用
2019-07-26 15:27:44.116 INFO 30704 --- [main] c.t.learning.init.spring.SpringInitBean : begin to execute destroyMethod
2019-07-26 15:27:44.219 INFO 30704 --- [main] utoConfigurationReportLoggingInitializer :

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2019-07-26 15:27:44.290 ERROR 30704 --- [main] o.s.boot.SpringApplication : Application startup failed

org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tomcatEmbeddedServletContainerFactory' defined in class path resource [org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat.class]: factory-bean 'org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat' (or a BeanPostProcessor involved) returned null
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:139) ~[spring-boot-1.5.18.RELEASE.jar:1.5.18.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537) ~[spring-context-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:124) ~[spring-boot-1.5.18.RELEASE.jar:1.5.18.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.18.RELEASE.jar:1.5.18.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.18.RELEASE.jar:1.5.18.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.18.RELEASE.jar:1.5.18.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.18.RELEASE.jar:1.5.18.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.18.RELEASE.jar:1.5.18.RELEASE]
at com.tangcheng.learning.DemoApplication.main(DemoApplication.java:16) [classes/:na]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tomcatEmbeddedServletContainerFactory' defined in class path resource [org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat.class]: factory-bean 'org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat' (or a BeanPostProcessor involved) returned null
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:374) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1178) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1072) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:481) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-4.3.21.RELEASE.jar:4.3.21.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getEmbeddedServletContainerFactory(EmbeddedWebApplicationContext.java:201) ~[spring-boot-1.5.18.RELEASE.jar:1.5.18.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:164) ~[spring-boot-1.5.18.RELEASE.jar:1.5.18.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:136) ~[spring-boot-1.5.18.RELEASE.jar:1.5.18.RELEASE]
... 8 common frames omitted

Process finished with exit code 1

 

 反思:
仔细从报错信息中获取线索,是解决问题是一个便捷的途径







标签:web,creating,spring,boot,springframework,bean,autoconfigure,tomcatEmbeddedServle
From: https://blog.51cto.com/u_15147537/5789790

相关文章

  • Spring Boot异常org.springframework.beans.factory.NoUniqueBeanDefinitionException
    https://blog.csdn.net/qq_33697094/article/details/114579346?spm=1001.2101.3001.6650.4&utm_medium=distribute.pc_relevant.none-task-blog-2~default~CTRLIST~Rate-4......
  • Spring —— bean实例化
    bean实例化bean本质上就是对象,创建bean使用构造方法完成(反射)    构造方法(常用)      静态工厂*      实例工厂*      FactoryBean(实用)......
  • Spring —— bean配置
    基础配置    别名配置  作用范围配置    适合交给容器进行管理的bean  (复用性的对象,无需重复创建的对象)表现层对象业务层对象数据层对象工具对象......
  • Spring注解开发入门(三)Bean的生命周期和作用范围
    1.Bean的作用域,其实就是bean采用单例模式还是非单例模式放在网络编程环境是指bean在http请求的作用范围的过程! 在java类上加上@Scope注解,可以设置bean的作用范围p......
  • 单例 Bean 的线程安全问题
    最近面试遇到一个问题:单例Bean的线程安全问题怎么解决的。之前了解但是没有深究它的解决方法。大部分时候我们并没有在项目中使用多线程,所以很少有人会关注这个问题。......
  • bean注入属性的几种方式
    bean注入属性的几种方式1.set方法注入2.构造器注入3.静态工厂注入4.实例工厂注入​​Spring中bean的四种注入方式-特务依昂-博客园(cnblogs.com)​​spring中注入bean......
  • java 武侠格斗生级版 javabean
    packagetest_3;importjava.util.Random;publicclassGame{//属性privateStringname;privateintblood;privatechargender;privateStringface;//长相是随机......
  • jmeter BeanShell 后置处理器 提取json数组,重新组装后供下一个接口使用
    前置条件:在jmeter中使用Json需要先下载一个json包放到jmeter安装路径下的lib\ext下我这里用的是json-20140107.jar我已经放到了百度网盘上,需要的可以自取:链接:https://p......
  • Jmeter添加BeanShell后置处理程序保存响应结果
    对于某些请求,无法通过保存响应到文件这个组件来进行保存(会出现UNKNOW文件类型)。那么就可以通过BeanShell后置处理程序来进行将响应结果直接输出到文件,并可以直接指定文件......
  • IOC 操作 Bean 管理(xml 注入其他类型属性)
    1、字面量(1)null值<!--null值--><propertyname="address"><null/></property>(2)属性值包含特殊符号<!--属性值包含特殊符号1把<>进行转义<>2把带特殊符......