{"id":1793,"date":"2023-03-27T22:35:55","date_gmt":"2023-03-27T14:35:55","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1793"},"modified":"2023-04-23T21:13:38","modified_gmt":"2023-04-23T13:13:38","slug":"elasticjob-error-job-conflict-with-register-center","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/27\/elasticjob-error-job-conflict-with-register-center\/","title":{"rendered":"ElasticJob\u62a5\u9519Job conflict with register center"},"content":{"rendered":"<pre><code>com.dangdang.ddframe.job.exception.JobConfigurationException: Job conflict with register center.\n  The job &#039;DownloadReconcileTask&#039; in register center&#039;s class is &#039;cn.appblog.mall.pay.job.alipay.task.DownloadReconcileTask&#039;, your job class is &#039;cn.appblog.mall.pay.job.wechatpay.task.DownloadReconcileTask&#039;<\/code><\/pre>\n<blockquote>\n<p>\u539f\u56e0\uff1a\u6ce8\u5165\u7684<code>SimpleJob<\/code> Bean\u540d\u79f0\u76f8\u540c\u7684\u8bdd\uff0c\u8def\u5f84\u4e0d\u80fd\u51b2\u7a81<\/p>\n<\/blockquote>\n<p><!-- more --><\/p>\n<pre><code class=\"language-java\">@Configuration\npublic class MyJobConfig {\n\n    @Resource\n    private ZookeeperRegistryCenter regCenter;\n\n    @Bean\n    public SimpleJob simpleJob() {\n        return new DownloadReconcileTask();  \/\/Bean\u540d\u79f0\u76f8\u540c\uff0c\u8def\u5f84\u51b2\u7a81\n    }\n\n    @Bean(initMethod = &quot;init&quot;)\n    public JobScheduler simpleJobScheduler(final SimpleJob simpleJob, @Value(&quot;${downloadReconcileJob.cron}&quot;) final String cron,\n                                           @Value(&quot;${downloadReconcileJob.shardingTotalCount}&quot;) final int shardingTotalCount,\n                                           @Value(&quot;${downloadReconcileJob.shardingItemParameters}&quot;) final String shardingItemParameters,\n                                           @Value(&quot;${downloadReconcileJob.description}&quot;) final String description) {\n\n        return new SpringJobScheduler(simpleJob, regCenter, getLiteJobConfiguration(simpleJob.getClass(), cron, shardingTotalCount, shardingItemParameters, description));\n    }\n\n    private LiteJobConfiguration getLiteJobConfiguration(final Class&lt;? extends SimpleJob&gt; jobClass, final String cron, final int shardingTotalCount, final String shardingItemParameters, final String description) {\n\n        return LiteJobConfiguration.newBuilder(new SimpleJobConfiguration(JobCoreConfiguration.newBuilder(\n                jobClass.getSimpleName(), cron, shardingTotalCount).shardingItemParameters(shardingItemParameters).description(description).build(), jobClass.getCanonicalName())).overwrite(true).build();\n    }\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>com.dangdang.ddframe.job.exception.JobConfigurationExce [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[350],"tags":[],"class_list":["post-1793","post","type-post","status-publish","format-standard","hentry","category-elasticjob"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1793","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1793"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1793\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1793"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1793"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1793"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}