siaorg / sia-task

微服务任务调度框架
Apache License 2.0
1.82k stars 586 forks source link

作业为什么总是不执行 #71

Open yhq1220 opened 5 years ago

yhq1220 commented 5 years ago

试抢占JOB IS SUCCESS , 开始启动JOB; JobGroupName is network JobKey is network_test-noParam 2019-09-11 09:41:39.570 INFO 2733 --- [ main] c.s.s.q.impl.OnlineSchedulerFactory : >>>>>>>>>>** init OnlineScheduler ** 2019-09-11 09:41:39.615 INFO 2733 --- [ main] org.quartz.impl.StdSchedulerFactory : Using default implementation for ThreadExecutor 2019-09-11 09:41:39.620 INFO 2733 --- [ main] org.quartz.simpl.SimpleThreadPool : Job execution threads will use class loader of thread: main 2019-09-11 09:41:39.669 INFO 2733 --- [ main] org.quartz.core.SchedulerSignalerImpl : Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl 2019-09-11 09:41:39.670 INFO 2733 --- [ main] org.quartz.core.QuartzScheduler : Quartz Scheduler v.2.3.0 created. 2019-09-11 09:41:39.671 INFO 2733 --- [ main] c.s.s.q.l.MultiSerialJobListener : this is method MultiSerialJobListener initialize DefaultQuartzScheduler 2019-09-11 09:41:39.671 INFO 2733 --- [ main] org.quartz.simpl.RAMJobStore : RAMJobStore initialized. 2019-09-11 09:41:39.672 INFO 2733 --- [ main] org.quartz.core.QuartzScheduler : Scheduler meta-data: Quartz Scheduler (v2.3.0) 'DefaultQuartzScheduler' with instanceId 'NON_CLUSTERED' Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally. NOT STARTED. Currently in standby mode. Number of jobs executed: 0 Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 60 threads. Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered.

2019-09-11 09:41:39.673 INFO 2733 --- [ main] org.quartz.impl.StdSchedulerFactory : Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties' 2019-09-11 09:41:39.673 INFO 2733 --- [ main] org.quartz.impl.StdSchedulerFactory : Quartz scheduler version: 2.3.0 2019-09-11 09:41:39.677 INFO 2733 --- [ main] utoConfigurationReportLoggingInitializer :

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled. 2019-09-11 09:41:39.685 ERROR 2733 --- [ main] o.s.boot.SpringApplication : Application startup failed

java.lang.IllegalStateException: Failed to execute CommandLineRunner at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:735) at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:716) at org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:703) at org.springframework.boot.SpringApplication.run(SpringApplication.java:304) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) at com.sia.scheduler.SchedulerApplication.main(SchedulerApplication.java:52) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) Caused by: java.lang.NullPointerException: null at com.sia.scheduler.service.common.CommonService.runJob(CommonService.java:325) at com.sia.scheduler.zk.monitor.JobMonitor.acquireJob(JobMonitor.java:289) at com.sia.scheduler.zk.monitor.JobMonitor.handleJobKey(JobMonitor.java:250) at com.sia.scheduler.zk.monitor.JobMonitor.handleJobKey(JobMonitor.java:237) at com.sia.scheduler.zk.monitor.JobMonitor.initJobZookeeper(JobMonitor.java:155) at com.sia.scheduler.zk.monitor.JobMonitor.run(JobMonitor.java:177) at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:732) ... 14 common frames omitted

2019-09-11 09:41:39.687 INFO 2733 --- [ main] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@b7dd107: startup date [Wed Sep 11 09:41:25 CST 2019]; parent: org.springfram ework.context.annotation.AnnotationConfigApplicationContext@1d251891 2019-09-11 09:41:39.691 INFO 2733 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown 2019-09-11 09:41:39.691 INFO 2733 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans 2019-09-11 09:41:39.697 INFO 2733 --- [tor-Framework-0] o.a.c.f.imps.CuratorFrameworkImpl : backgroundOperationsLoop exiting 2019-09-11 09:41:39.702 INFO 2733 --- [ main] org.apache.zookeeper.ZooKeeper : Session: 0x46cdd016a0e6142 closed 2019-09-11 09:41:39.704 INFO 2733 --- [ main] c.s.hunter.register.OnlineTaskRegister : OnlineTask->close zookeeper connection 2019-09-11 09:41:39.709 INFO 2733 --- [ain-EventThread] org.apache.zookeeper.ClientCnxn : EventThread shut down for session: 0x46cdd016a0e6142

Li-JH commented 5 years ago

调度器程序启动时报NPE,也就是调度器没有正确启动,因此作业没有执行。建议重新拉取最新代码,部署一下,看能否正确启动。

Maozw commented 5 years ago

这块的确存在一个问题,问题的具体原因在于 jvm 实例化对象的时候递归地在堆中首先创建其父类对象,调用父类构造方法,超类中的使用了springContext容器中的对象,如果容器中的对象此时还没有初始化完成就会出现npe,此问题也和具体机器有关系,不同的机器打的包也会出现不同的现象。我们会在近期修复此问题。

DR-YangLong commented 5 years ago

https://github.com/DR-YangLong/sia-task 修改了代码,验证通过了,不过没用全部覆盖测试,前期预研可以用