本文介绍了一种常见的Quartz调度框架异常:'Cannot run without an instance id'的原因及解决办法。通过修改/etc/hosts文件,将当前服务器的主机名添加到127.0.0.1对应的条目中,可以有效解决此问题。
摘要由CSDN通过智能技术生成
Caused by: java.lang.IllegalStateException: Cannot run without an instance id.
at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1179)
at org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1460)
at org.springframework.scheduling.quartz.SchedulerFactoryBean.createScheduler(SchedulerFactoryBean.java:600)
at org.springframework.scheduling.quartz.SchedulerFactoryBean.afterPropertiesSet(SchedulerFactoryBean.java:481)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
... 38 more
修改如下:
vi 编辑 /etc/hosts文件,将当前服务器主机名加入127.0.0.1这一行即可(位置前、中、后随意),注意空格与其他名字分开: