shardingsphere-elasticjob
shardingsphere-elasticjob copied to clipboard
error when i use elastic-job-lite with java api
I get the error next org.apache.shardingsphere.elasticjob.infra.exception.JobConfigurationException: Can not find executor for elastic job class
i have already import the jar
<dependency>
<groupId>org.apache.shardingsphere.elasticjob</groupId>
<artifactId>elasticjob-lite-core</artifactId>
<version>${elasticjob-version}</version>
</dependency>
<dependency>
<groupId>org.apache.shardingsphere.elasticjob</groupId>
<artifactId>elasticjob-dataflow-executor</artifactId>
<version>${elasticjob-version}</version>
</dependency>
after i recompile my package it can goes well; but i got the error next 2021-03-04 15:44:00,003 [org.quartz.core.ErrorLogger.schedulerError(QuartzScheduler.java:2425)][scheduleJob_Worker-1] - [ ERROR ] Job (DEFAULT.scheduleJob threw an exception. org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: java.lang.NullPointerException] at org.quartz.core.JobRunShell.run(JobRunShell.java:213) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) Caused by: java.lang.NullPointerException at org.apache.shardingsphere.elasticjob.executor.context.ExecutorContext.get(ExecutorContext.java:75) at org.apache.shardingsphere.elasticjob.executor.ElasticJobExecutor.execute(ElasticJobExecutor.java:79) at org.apache.shardingsphere.elasticjob.lite.internal.schedule.LiteJob.execute(LiteJob.java:35) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) ... 1 more
i could'nt figure out why, because it runs well in my person macbook
Could you check if your classpath include the following JARs:
- elasticjob-infra-common
- elasticjob-error-handler-general
i add it, now my dependency are
but i got the same error
2021-03-04 17:08:38,431 [org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobShutdownHookPlugin.registerShutdownHook(JobShutdownHookPlugin.java:75)][main] - [ INFO ] Registering Quartz shutdown hook. ScheduleJob 2021-03-04 17:08:38,431 [org.quartz.simpl.RAMJobStore.initialize(RAMJobStore.java:155)][main] - [ INFO ] RAMJobStore initialized. 2021-03-04 17:08:38,431 [org.quartz.core.QuartzScheduler.initialize(QuartzScheduler.java:305)][main] - [ INFO ] Scheduler meta-data: Quartz Scheduler (v2.2.1) 'ScheduleJob' 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 1 threads. Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered. .......... 2021-03-04 18:13:00,004 [org.quartz.core.ErrorLogger.schedulerError(QuartzScheduler.java:2425)][ScheduleJob_Worker-1] - [ ERROR ] Job (DEFAULT.ScheduleJob threw an exception. org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: java.lang.NullPointerException] at org.quartz.core.JobRunShell.run(JobRunShell.java:213) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) Caused by: java.lang.NullPointerException at org.apache.shardingsphere.elasticjob.executor.context.ExecutorContext.get(ExecutorContext.java:75) at org.apache.shardingsphere.elasticjob.executor.ElasticJobExecutor.execute(ElasticJobExecutor.java:79) at org.apache.shardingsphere.elasticjob.lite.internal.schedule.LiteJob.execute(LiteJob.java:35) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) ... 1 more
Job (DEFAULT.ScheduleJob ) before Quartz Scheduler (v2.2.1) 'ScheduleJob' does this matter?
what depedency i forgot to import? I got the error next, i can run in my idea when i run it with java -jar i got the next error
Exception in thread "main" org.apache.shardingsphere.elasticjob.infra.yaml.exception.YamlConfigurationConverterNotFoundException: No YamlConfigurationConverter found for class [org.apache.shardingsphere.elasticjob.tracing.api.TracingConfiguration] at org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO.lambda$null$0(JobConfigurationPOJO.java:121) at java.util.Optional.orElseThrow(Optional.java:290)
Could you check if your classpath include the following JARs:
- elasticjob-infra-common
- elasticjob-error-handler-general
Since you have configured TracingConfiguration, check if your classpath include the following JARs:
- elasticjob-tracing-api
- elasticjob-tracing-rdb
i also get the same error when i run it with java -jar 16:51:35.005 [MySimpleJob_Worker-1] DEBUG org.quartz.core.JobRunShell - Calling execute on job DEFAULT.MySimpleJob 16:51:35.007 [MySimpleJob_Worker-1] ERROR org.quartz.core.JobRunShell - Job DEFAULT.MySimpleJob threw an unhandled Exception: java.lang.NullPointerException: null at org.apache.shardingsphere.elasticjob.executor.context.ExecutorContext.get(ExecutorContext.java:75) at org.apache.shardingsphere.elasticjob.executor.ElasticJobExecutor.execute(ElasticJobExecutor.java:79) at org.apache.shardingsphere.elasticjob.lite.internal.schedule.LiteJob.execute(LiteJob.java:35) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) 16:51:35.007 [MySimpleJob_Worker-1] ERROR org.quartz.core.ErrorLogger - Job (DEFAULT.MySimpleJob threw an exception. org.quartz.SchedulerException: Job threw an unhandled exception. at org.quartz.core.JobRunShell.run(JobRunShell.java:213) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) Caused by: java.lang.NullPointerException: null at org.apache.shardingsphere.elasticjob.executor.context.ExecutorContext.get(ExecutorContext.java:75) at org.apache.shardingsphere.elasticjob.executor.ElasticJobExecutor.execute(ElasticJobExecutor.java:79) at org.apache.shardingsphere.elasticjob.lite.internal.schedule.LiteJob.execute(LiteJob.java:35) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) ... 1 common frames omitted