报错信息
engineeringsafety-saas-web-2021-06-15 17:39:23:INFO HV000001: Hibernate Validator 6.0.13.Final
engineeringsafety-saas-web-2021-06-15 17:39:24:INFO Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@4cc451f2: startup date [Tue Jun 15 17:39:24 CST 2021]; root of context hierarchy
engineeringsafety-saas-web-2021-06-15 17:39:24:INFO JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
engineeringsafety-saas-web-2021-06-15 17:39:24:INFO Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$55e352dc] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
engineeringsafety-saas-web-2021-06-15 17:39:24:INFO No active profile set, falling back to default profiles: default
engineeringsafety-saas-web-2021-06-15 17:39:24:INFO Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@31dadd46: startup date [Tue Jun 15 17:39:24 CST 2021]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@4cc451f2
engineeringsafety-saas-web-2021-06-15 17:39:29:INFO Overriding bean definition for bean 'JdbcTemplateDao' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=propertiesConfig; factoryMethodName=JdbcTemplateDao; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/persagy/web/config/PropertiesConfig.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=com.persagy.framework.ems.data.config.JdbcConfig; factoryMethodName=createCoreDao; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/persagy/framework/ems/data/config/JdbcConfig.class]]
engineeringsafety-saas-web-2021-06-15 17:39:29:INFO Overriding bean definition for bean 'ZillionDao' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=propertiesConfig; factoryMethodName=ZillionDao; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/persagy/web/config/PropertiesConfig.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=com.persagy.framework.ems.data.config.ZillionConfig; factoryMethodName=createCoreDao; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/persagy/framework/ems/data/config/ZillionConfig.class]]
engineeringsafety-saas-web-2021-06-15 17:39:29:WARN No MyBatis mapper was found in '[com.persagy.framework.ems.data, com.persagy]' package. Please check your configuration.
engineeringsafety-saas-web-2021-06-15 17:39:29:INFO Multiple Spring Data modules found, entering strict repository configuration mode!
engineeringsafety-saas-web-2021-06-15 17:39:29:INFO Bootstrapping Spring Data repositories in DEFAULT mode.
engineeringsafety-saas-web-2021-06-15 17:39:29:INFO Finished Spring Data repository scanning in 53ms. Found 0 repository interfaces.
engineeringsafety-saas-web-2021-06-15 17:39:29:INFO Multiple Spring Data modules found, entering strict repository configuration mode!
engineeringsafety-saas-web-2021-06-15 17:39:29:INFO Bootstrapping Spring Data repositories in DEFAULT mode.
engineeringsafety-saas-web-2021-06-15 17:39:29:INFO Finished Spring Data repository scanning in 34ms. Found 0 repository interfaces.
engineeringsafety-saas-web-2021-06-15 17:39:29:INFO BeanFactory id=eb910f9f-bc83-32bb-984e-cf8f8da5239b
engineeringsafety-saas-web-2021-06-15 17:39:29:INFO JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
engineeringsafety-saas-web-2021-06-15 17:39:29:INFO Bean 'org.springframework.amqp.rabbit.annotation.RabbitBootstrapConfiguration' of type [org.springframework.amqp.rabbit.annotation.RabbitBootstrapConfiguration$$EnhancerBySpringCGLIB$$350e0d] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
engineeringsafety-saas-web-2021-06-15 17:39:30:INFO Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$39c94fdf] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
engineeringsafety-saas-web-2021-06-15 17:39:30:INFO Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$55e352dc] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
engineeringsafety-saas-web-2021-06-15 17:39:30:INFO Tomcat initialized with port(s): 9978 (http)
engineeringsafety-saas-web-2021-06-15 17:39:30:INFO Root WebApplicationContext: initialization completed in 6298 ms
engineeringsafety-saas-web-2021-06-15 17:39:30:INFO Servlet dispatcherServlet mapped to [/]
engineeringsafety-saas-web-2021-06-15 17:39:30:INFO Mapping filter: 'characterEncodingFilter' to: [/*]
engineeringsafety-saas-web-2021-06-15 17:39:31:INFO Building JPA container EntityManagerFactory for persistence unit 'default'
engineeringsafety-saas-web-2021-06-15 17:39:31:INFO HHH000204: Processing PersistenceUnitInfo [
name: default
...]
engineeringsafety-saas-web-2021-06-15 17:39:31:INFO HHH000412: Hibernate Core {5.2.17.Final}
engineeringsafety-saas-web-2021-06-15 17:39:31:INFO HHH000206: hibernate.properties not found
engineeringsafety-saas-web-2021-06-15 17:39:31:INFO HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
Console logging handler is not configured.
engineeringsafety-saas-web-2021-06-15 17:39:31:INFO {dataSource-1} inited
engineeringsafety-saas-web-2021-06-15 17:39:32:INFO HHH000400: Using dialect: com.persagy.web.config.MySQL5InnoDBDialectUtf8
engineeringsafety-saas-web-2021-06-15 17:39:33:INFO Initialized JPA EntityManagerFactory for persistence unit 'default'
engineeringsafety-saas-web-2021-06-15 17:39:33:INFO Refreshing FeignContext-dmp-alarm: startup date [Tue Jun 15 17:39:33 CST 2021]; parent: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@31dadd46
engineeringsafety-saas-web-2021-06-15 17:39:33:INFO JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
engineeringsafety-saas-web-2021-06-15 17:39:33:WARN Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'alarmController': Unsatisfied dependency expressed through field 'alarmServiceRecord'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'alarmServiceRecordImpl': Unsatisfied dependency expressed through field 'alarmServerClient'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.client.AlarmServerClient': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: RequestParam.value() was empty on parameter 0
engineeringsafety-saas-web-2021-06-15 17:39:33:INFO Closing FeignContext-dmp-alarm: startup date [Tue Jun 15 17:39:33 CST 2021]; parent: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@31dadd46
engineeringsafety-saas-web-2021-06-15 17:39:33:WARN Exception thrown from ApplicationListener handling ContextClosedEvent
org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'rabbitConnectionFactory': Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:208)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204)
at org.springframework.context.event.AbstractApplicationEventMulticaster.retrieveApplicationListeners(AbstractApplicationEventMulticaster.java:239)
at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:196)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:133)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:400)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:406)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:354)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:998)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:965)
at org.springframework.cloud.context.named.NamedContextFactory.destroy(NamedContextFactory.java:76)
at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:256)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:571)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:543)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:954)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:504)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:961)
at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1039)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:561)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1242)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1230)
at com.persagy.EngineeringSafetySaasWebApplication.main(EngineeringSafetySaasWebApplication.java:28)
engineeringsafety-saas-web-2021-06-15 17:39:33:INFO Closing JPA EntityManagerFactory for persistence unit 'default'
engineeringsafety-saas-web-2021-06-15 17:39:33:INFO {dataSource-1} closed
engineeringsafety-saas-web-2021-06-15 17:39:33:INFO
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
engineeringsafety-saas-web-2021-06-15 17:39:33:ERROR Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'alarmController': Unsatisfied dependency expressed through field 'alarmServiceRecord'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'alarmServiceRecordImpl': Unsatisfied dependency expressed through field 'alarmServerClient'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.client.AlarmServerClient': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: RequestParam.value() was empty on parameter 0
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:584)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:370)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1336)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:572)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:759)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:548)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1242)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1230)
at com.persagy.EngineeringSafetySaasWebApplication.main(EngineeringSafetySaasWebApplication.java:28)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'alarmServiceRecordImpl': Unsatisfied dependency expressed through field 'alarmServerClient'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.client.AlarmServerClient': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: RequestParam.value() was empty on parameter 0
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:584)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:370)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1336)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:572)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1135)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1062)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:581)
... 19 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.client.AlarmServerClient': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: RequestParam.value() was empty on parameter 0
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:178)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:101)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1644)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getObjectForBeanInstance(AbstractAutowireCapableBeanFactory.java:1174)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:257)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1322)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1288)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1098)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1062)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:581)
... 32 more
Caused by: java.lang.IllegalStateException: RequestParam.value() was empty on parameter 0
at feign.Util.checkState(Util.java:126)
at org.springframework.cloud.openfeign.annotation.RequestParamParameterProcessor.processArgument(RequestParamParameterProcessor.java:63)
at org.springframework.cloud.openfeign.support.SpringMvcContract.processAnnotationsOnParameter(SpringMvcContract.java:238)
at feign.Contract$BaseContract.parseAndValidateMetadata(Contract.java:108)
at org.springframework.cloud.openfeign.support.SpringMvcContract.parseAndValidateMetadata(SpringMvcContract.java:133)
at feign.Contract$BaseContract.parseAndValidatateMetadata(Contract.java:64)
at feign.ReflectiveFeign$ParseHandlersByName.apply(ReflectiveFeign.java:153)
at feign.ReflectiveFeign.newInstance(ReflectiveFeign.java:52)
at feign.Feign$Builder.target(Feign.java:242)
at org.springframework.cloud.openfeign.HystrixTargeter.target(HystrixTargeter.java:39)
at org.springframework.cloud.openfeign.FeignClientFactoryBean.loadBalance(FeignClientFactoryBean.java:223)
at org.springframework.cloud.openfeign.FeignClientFactoryBean.getTarget(FeignClientFactoryBean.java:252)
at org.springframework.cloud.openfeign.FeignClientFactoryBean.getObject(FeignClientFactoryBean.java:232)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:171)
... 43 more
问题分析
-
启动第一行报错位置:
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘alarmController’: Unsatisfied dependency expressed through field ‘alarmServiceRecord’; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘alarmServiceRecordImpl’: Unsatisfied dependency expressed through field ‘alarmServerClient’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘com.client.AlarmServerClient’: FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: RequestParam.value() was empty on parameter 0创建bean出错,网上搜了一些,基本都是提示注解没加,查看报错的Controller,serviceImpl中@Controller,@Service注解是否正确加入。
-
启动第二处报错
Error creating bean with name ‘rabbitConnectionFactory’: Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)
根据上下文分析,本以为是AlarmServerClient 没有连接到rabbitMQ,或者是启动端口被占用,如果遇到启动端口被占用的情况下,修改端口启动,或停掉相同端口的服务。
最终解决方法
最终解决的问题是 启动第一处报错最后一句:RequestParam.value() was empty on parameter 0
使用@FeignClient注解的时候,如果接口方法中参数没有指明,就会报RequestParam.value() was empty on parameter 0
修改如下:
修改前
Result methord(@RequestParam String param)
修改后
Result methord(@RequestParam(“param”) String param)
修改完所有的地方后,启动项目成功。
解决问题找第一层报错的地方,最后的位置, 一点一点排查解决。少走弯路。