Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExecutionContextService java.lang.NullPointerException #620

Closed
gMan1990 opened this issue Jan 18, 2019 · 2 comments
Closed

ExecutionContextService java.lang.NullPointerException #620

gMan1990 opened this issue Jan 18, 2019 · 2 comments
Labels

Comments

@gMan1990
Copy link

gMan1990 commented Jan 18, 2019

Please answer these questions before submitting your issue. Thanks!
开源不易,我们希望将精力放在完成新功能和解决有价值的问题上,为了让大家的配合更具有效率,请填写以下列出的全部问题

Which version of Elastic-Job do you using?(您使用的Elastic-Job版本为?)

elastic-job-lite-core-2.1.5.jar

Expected behavior (您预期的结果是)

maybe null safe?

Actual behavior (实际运行的结果是)

NullPointerException

Steps to reproduce the behavior (可重现问题的操作步骤)

I am not sure. 应该是网络访问不到的原因

Please provide the reproduce example codes (such as github link),otherwise we will label the issue as Invalid and close it.(为了节省复现问题的时间,请务必提供可重现的代码,否则我们会将issue直接标记为invalid并关闭)

Code should based on https://github.com/elasticjob/elastic-job-example
(代码请基于 https://github.com/elasticjob/elastic-job-example)


NullPointerException 1 with {liteJobConfig-null, shardingItems-[0]}

  1. https://github.com/elasticjob/elastic-job-lite/blob/9cc659f8e315e18efa9a3e57f0260fa50f616d17/elastic-job-lite/elastic-job-lite-core/src/main/java/com/dangdang/ddframe/job/lite/internal/sharding/ExecutionContextService.java#L63
        LiteJobConfiguration liteJobConfig = configService.load(false);
        removeRunningIfMonitorExecution(liteJobConfig.isMonitorExecution(), shardingItems);
    Job DEFAULT.XXX threw an unhandled Exception:
java.lang.NullPointerException: null
        at com.dangdang.ddframe.job.lite.internal.sharding.ExecutionContextService.getJobShardingContext(ExecutionContextService.java:63) ~[conf/:?]
        at com.dangdang.ddframe.job.lite.internal.schedule.LiteJobFacade.getShardingContexts(LiteJobFacade.java:121) ~[elastic-job-lite-core-2.1.5.jar:?]
        at com.dangdang.ddframe.job.executor.AbstractElasticJobExecutor.execute(AbstractElasticJobExecutor.java:103) ~[elastic-job-common-core-2.1.5.jar:?]
        at com.dangdang.ddframe.job.lite.internal.schedule.LiteJob.execute(LiteJob.java:26) ~[elastic-job-lite-core-2.1.5.jar:?]
        at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [quartz-2.2.1.jar:?]
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [quartz-2.2.1.jar:?]
    Job (DEFAULT.XXX threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception.
        at org.quartz.core.JobRunShell.run(JobRunShell.java:213) [quartz-2.2.1.jar:?]
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [quartz-2.2.1.jar:?]
Caused by: java.lang.NullPointerException
        at com.dangdang.ddframe.job.lite.internal.sharding.ExecutionContextService.getJobShardingContext(ExecutionContextService.java:63) ~[conf/:?]
        at com.dangdang.ddframe.job.lite.internal.schedule.LiteJobFacade.getShardingContexts(LiteJobFacade.java:121) ~[elastic-job-lite-core-2.1.5.jar:?]
        at com.dangdang.ddframe.job.executor.AbstractElasticJobExecutor.execute(AbstractElasticJobExecutor.java:103) ~[elastic-job-common-core-2.1.5.jar:?]
        at com.dangdang.ddframe.job.lite.internal.schedule.LiteJob.execute(LiteJob.java:26) ~[elastic-job-lite-core-2.1.5.jar:?]
        at org.quartz.core.JobRunShell.run(JobRunShell.java:202) ~[quartz-2.2.1.jar:?]
        ... 1 more

调用这句都可能LiteJobConfiguration liteJobConfig = configService.load(false);

  1. https://github.com/elasticjob/elastic-job-lite/blob/9cc659f8e315e18efa9a3e57f0260fa50f616d17/elastic-job-lite/elastic-job-lite-core/src/main/java/com/dangdang/ddframe/job/lite/internal/sharding/ShardingService.java#L113
        LiteJobConfiguration liteJobConfig = configService.load(false);
        int shardingTotalCount = liteJobConfig.getTypeConfig().getCoreConfig().getShardingTotalCount();
    Job DEFAULT.XXX threw an unhandled Exception:
java.lang.NullPointerException: null
        at com.dangdang.ddframe.job.lite.internal.sharding.ShardingService.shardingIfNecessary(ShardingService.java:113) ~[elastic-job-lite-core-2.1.5.jar:?]
        at com.dangdang.ddframe.job.lite.internal.schedule.LiteJobFacade.getShardingContexts(LiteJobFacade.java:115) ~[elastic-job-lite-core-2.1.5.jar:?]
        at com.dangdang.ddframe.job.executor.AbstractElasticJobExecutor.execute(AbstractElasticJobExecutor.java:103) ~[elastic-job-common-core-2.1.5.jar:?]
        at com.dangdang.ddframe.job.lite.internal.schedule.LiteJob.execute(LiteJob.java:26) ~[elastic-job-lite-core-2.1.5.jar:?]
        at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [quartz-2.2.1.jar:?]
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [quartz-2.2.1.jar:?]

NullPointerException 2 with {liteJobConfig-{}, shardingItems-[], jobInstance-null}

https://github.com/elasticjob/elastic-job-lite/blob/9cc659f8e315e18efa9a3e57f0260fa50f616d17/elastic-job-lite/elastic-job-lite-core/src/main/java/com/dangdang/ddframe/job/lite/internal/sharding/ExecutionContextService.java#L75

    Job DEFAULT.XXX threw an unhandled Exception:
java.lang.NullPointerException: null
        at com.dangdang.ddframe.job.lite.internal.sharding.ExecutionContextService.buildTaskId(ExecutionContextService.java:75) ~[conf/:?]
        at com.dangdang.ddframe.job.lite.internal.sharding.ExecutionContextService.getJobShardingContext(ExecutionContextService.java:75) ~[conf/:?]
        at com.dangdang.ddframe.job.lite.internal.schedule.LiteJobFacade.getShardingContexts(LiteJobFacade.java:121) ~[elastic-job-lite-core-2.1.5.jar:?]
        at com.dangdang.ddframe.job.executor.AbstractElasticJobExecutor.execute(AbstractElasticJobExecutor.java:103) ~[elastic-job-common-core-2.1.5.jar:?]
        at com.dangdang.ddframe.job.lite.internal.schedule.LiteJob.execute(LiteJob.java:26) ~[elastic-job-lite-core-2.1.5.jar:?]
        at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [quartz-2.2.1.jar:?]
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [quartz-2.2.1.jar:?]
    Job (DEFAULT.XXX threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception.
        at org.quartz.core.JobRunShell.run(JobRunShell.java:213) [quartz-2.2.1.jar:?]
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [quartz-2.2.1.jar:?]
Caused by: java.lang.NullPointerException
        at com.dangdang.ddframe.job.lite.internal.sharding.ExecutionContextService.buildTaskId(ExecutionContextService.java:75) ~[conf/:?]
        at com.dangdang.ddframe.job.lite.internal.sharding.ExecutionContextService.getJobShardingContext(ExecutionContextService.java:75) ~[conf/:?]
        at com.dangdang.ddframe.job.lite.internal.schedule.LiteJobFacade.getShardingContexts(LiteJobFacade.java:121) ~[elastic-job-lite-core-2.1.5.jar:?]
        at com.dangdang.ddframe.job.executor.AbstractElasticJobExecutor.execute(AbstractElasticJobExecutor.java:103) ~[elastic-job-common-core-2.1.5.jar:?]
        at com.dangdang.ddframe.job.lite.internal.schedule.LiteJob.execute(LiteJob.java:26) ~[elastic-job-lite-core-2.1.5.jar:?]
        at org.quartz.core.JobRunShell.run(JobRunShell.java:202) ~[quartz-2.2.1.jar:?]
        ... 1 more
@compilerduck
Copy link

这是job的配置没读到,根据源码逻辑,如果是zk的ConnectionLossException,NoNodeException或是NodeExistsException,会忽略这些异常,并返回null,请看下日志是否报了这些信息(debug日志)

@terrymanu
Copy link
Member

Closed because of no response anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants