java.lang.IllegalStateException: Cannot run without an instance id.

启动springboot,报错:quartz集群报错:

Sep 09, 2016 5:33:47 AM org.apache.catalina.core.ApplicationContext log  
INFO: No Spring WebApplicationInitializer types detected on classpath  
Sep 09, 2016 5:33:57 AM org.apache.catalina.core.ApplicationContext log  
INFO: Initializing Spring root WebApplicationContext  
Sep 09, 2016 5:34:26 AM org.apache.catalina.core.StandardContext listenerStart  
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener  
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'schedulerController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.zynsun.platform.quartz.QuartzJobManager com.zynsun.platform.controller.quartz.SchedulerController.quartzJobManager; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'quartzJobManager': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.scheduling.quartz.SchedulerFactoryBean com.zynsun.platform.quartz.QuartzJobManager.schedulerFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'schedulerFactory' defined in file [/usr/local/tomcat/apache-tomcat-7.0.64_2/webapps/ashare/WEB-INF/classes/config/spring-quartz.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Cannot run without an instance id.  
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)  
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1208)  
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)  
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)  
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)  
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)  
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)  
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)  
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755)  
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:762)  
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)  
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:434)  
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)  
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)  
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5003)  
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5517)  
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)  
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)  
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)  
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)  
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1095)  
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1930)  
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)  
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)  
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)  
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  
    at java.lang.Thread.run(Thread.java:745)  
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.zynsun.platform.quartz.QuartzJobManager com.zynsun.platform.controller.quartz.SchedulerController.quartzJobManager; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'quartzJobManager': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.scheduling.quartz.SchedulerFactoryBean com.zynsun.platform.quartz.QuartzJobManager.schedulerFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'schedulerFactory' defined in file [/usr/local/tomcat/apache-tomcat-7.0.64_2/webapps/ashare/WEB-INF/classes/config/spring-quartz.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Cannot run without an instance id.  
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:561)  
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)  
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)  
    ... 26 more  
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'quartzJobManager': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.scheduling.quartz.SchedulerFactoryBean com.zynsun.platform.quartz.QuartzJobManager.schedulerFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'schedulerFactory' defined in file [/usr/local/tomcat/apache-tomcat-7.0.64_2/webapps/ashare/WEB-INF/classes/config/spring-quartz.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Cannot run without an instance id.  
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)  
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1208)  
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)  
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)  
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)  
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)  
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)  
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)  
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1120)  
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1044)  
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942)  
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:533)  
    ... 28 more  
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.scheduling.quartz.SchedulerFactoryBean com.zynsun.platform.quartz.QuartzJobManager.schedulerFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'schedulerFactory' defined in file [/usr/local/tomcat/apache-tomcat-7.0.64_2/webapps/ashare/WEB-INF/classes/config/spring-quartz.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Cannot run without an instance id.  
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:561)  
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)  
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)  
    ... 39 more  
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'schedulerFactory' defined in file [/usr/local/tomcat/apache-tomcat-7.0.64_2/webapps/ashare/WEB-INF/classes/config/spring-quartz.xml]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Cannot run without an instance id.  
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1572)  
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)  
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)  
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)  
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)  
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)  
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)  
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1120)  
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1044)  
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942)  
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:533)  
    ... 41 more  
Caused by: java.lang.IllegalStateException: Cannot run without an instance id.  
    at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1215)  
    at org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1519)  
    at org.springframework.scheduling.quartz.SchedulerFactoryBean.createScheduler(SchedulerFactoryBean.java:597)  
    at org.springframework.scheduling.quartz.SchedulerFactoryBean.afterPropertiesSet(SchedulerFactoryBean.java:480)  
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1631)  
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1568)  
    ... 51 more  
  
Sep 09, 2016 5:34:26 AM org.apache.catalina.core.ApplicationContext log  
INFO: Set web app root system property: 'webapp.root' = [/usr/local/tomcat/apache-tomcat-7.0.64_2/webapps/ashare/]  
Sep 09, 2016 5:34:26 AM org.apache.catalina.core.ApplicationContext log  
INFO: Initializing Logback from [classpath:logback.xml]  
Sep 09, 2016 5:34:36 AM org.apache.catalina.core.ApplicationContext log  
INFO: JUL to SLF4J bridge is not available on the classpath  
Sep 09, 2016 5:34:36 AM org.apache.catalina.core.ApplicationContext log  
INFO: Shutting down Logback  
Sep 09, 2016 5:34:36 AM org.apache.catalina.core.ApplicationContext log  
INFO: Closing Spring root WebApplicationContext 

解决:

vim 编辑/etc/hosts文件,将当前服务器主机名添加到127.0.0.1 后面任意位置 如图所示:

原文地址:https://www.cnblogs.com/gmq-sh/p/8035721.html