vincentjames501 commented on issue #2002:
URL:
https://github.com/apache/shardingsphere-elasticjob/issues/2002#issuecomment-947989641
I'm running into the same issue. Here is a super simple example:
```java
package com.myjobs;
import org.apache.shardingsphere.elasticjob.api.JobConfiguration;
import org.apache.shardingsphere.elasticjob.api.ShardingContext;
import
org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.ScheduleJobBootstrap;
import
org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter;
import
org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperConfiguration;
import
org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperRegistryCenter;
import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob;
public class Main {
public static class MyJob implements SimpleJob {
@Override
public void execute(ShardingContext context) {
System.out.printf("Here! %s", context);
}
}
public static void main(String[] args) {
System.out.println("here!");
CoordinatorRegistryCenter registryCenter = createRegistryCenter();
new ScheduleJobBootstrap(registryCenter, new MyJob(),
createScheduledJobConfiguration()).schedule();
}
private static CoordinatorRegistryCenter createRegistryCenter() {
CoordinatorRegistryCenter regCenter = new
ZookeeperRegistryCenter(new ZookeeperConfiguration("localhost:2181",
"my-jobs"));
regCenter.init();
return regCenter;
}
private static JobConfiguration createScheduledJobConfiguration() {
return JobConfiguration.newBuilder("MyJob", 1).cron("0 0/1 * 1/1 * ?
*").build();
}
}
```
Produces:
```
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further
details.
SLF4J: Failed to load class "org.slf4j.impl.StaticMDCBinder".
SLF4J: Defaulting to no-operation MDCAdapter implementation.
SLF4J: See http://www.slf4j.org/codes.html#no_static_mdc_binder for further
details.
```
The job never fires as seen my the missing `Here!`
I can see in zookeeper though the job being registered...
```
/my-jobs/MyJob = com.myjobs.Main$MyJob
```
```
/my-jobs/MyJob/config =
cron: 0 0/1 * 1/1 * ? *
description: ''
disabled: false
failover: false
jobName: MyJob
jobParameter: ''
maxTimeDiffSeconds: -1
misfire: true
monitorExecution: true
overwrite: false
reconcileIntervalMinutes: 10
shardingItemParameters: ''
shardingTotalCount: 1
staticSharding: false
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]