一、问题
tomcat启动是报错:
org.quartz.SchedulerException: Couldn't get host name!
at org.quartz.simpl.SimpleInstanceIdGenerator.generateInstanceId(SimpleInstanceIdGenerator.java:36)
at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:1211)
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)
...
Caused by: java.net.UnknownHostException: WLSHASRV007: WLSHASRV007: 域名解析暂时失败
at java.net.InetAddress.getLocalHost(InetAddress.java:1505)
at org.quartz.simpl.SimpleInstanceIdGenerator.generateInstanceId(SimpleInstanceIdGenerator.java:34)
... 108 common frames omitted
二、解决
其实解决是很简单,
① 查看主机名:
[root@WLSHASRV007 ~]# hostname
WLSHASRV007
② 查看 hosts 文件,vi /etc/hosts ,确保无乱码等异常,并确认 127.0.0.1 后面有上命令查询出的主机名
③ 如图,发现没有,则添加即可
原文地址:http://www.jetchen.cn/quartz%E5%BC%82%E5%B8%B8%E4%B9%8B%EF%BC%9Aorg-quartz-schedulerexception/