liyfi opened a new issue, #2120:
URL: https://github.com/apache/shardingsphere-elasticjob/issues/2120
### Which version of ElasticJob did you use?
<dependency>
<groupId>org.apache.shardingsphere.elasticjob</groupId>
<artifactId>elasticjob-lite-spring-boot-starter</artifactId>
<version>3.0.1</version>
</dependency>
### Which project did you use? ElasticJob-Lite or ElasticJob-Cloud?
ElasticJob-Lite
### Expected behavior
### Actual behavior
1. execute() can't work
2. The "Job dimension" menu of UI displays: SHARDING_FLAG
3. spring boot logs:
```
11:10:56.950 [PLC-Async-1] INFO o.apache.curator.utils.Compatibility -
Using org.apache.zookeeper.server.quorum.MultipleAddresses
11:10:57.152 [PLC-Async-1] INFO org.quartz.impl.StdSchedulerFactory - Using
default implementation for ThreadExecutor
11:10:57.153 [PLC-Async-1] INFO o.quartz.core.SchedulerSignalerImpl -
Initialized Scheduler Signaller of type: class
org.quartz.core.SchedulerSignalerImpl
11:10:57.153 [PLC-Async-1] INFO org.quartz.core.QuartzScheduler - Quartz
Scheduler v.2.3.2 created.
11:10:57.153 [PLC-Async-1] INFO o.a.s.e.l.i.s.JobShutdownHookPlugin -
Registering Quartz shutdown hook. device-D0001-point-DM0
11:10:57.153 [PLC-Async-1] INFO org.quartz.simpl.RAMJobStore - RAMJobStore
initialized.
11:10:57.153 [PLC-Async-1] INFO org.quartz.core.QuartzScheduler - Scheduler
meta-data: Quartz Scheduler (v2.3.2) 'device-D0001-point-DM0' 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.
11:10:57.153 [PLC-Async-1] INFO org.quartz.impl.StdSchedulerFactory -
Quartz scheduler 'device-D0001-point-DM0' initialized from an externally
provided properties instance.
11:10:57.153 [PLC-Async-1] INFO org.quartz.impl.StdSchedulerFactory -
Quartz scheduler version: 2.3.2
```
### Reason analyze (If you can)
### Steps to reproduce the behavior.
### Example codes for reproduce this issue (such as a github link).
dependency:
```
<dependency>
<groupId>org.apache.shardingsphere.elasticjob</groupId>
<artifactId>elasticjob-lite-spring-boot-starter</artifactId>
<version>3.0.1</version>
</dependency>
```
application.yml:
```
server:
port: 8080
spring:
application:
name: elasticJob-lite-demo
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url:
jdbc:mysql://x.x.x.x:3306/elasticJob-lite-demo?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=true
username: root
password: ******
elasticjob:
regCenter:
serverLists: x.x.x.x:2181
namespace: ${spring.application.name}
```
SimpleJob:
```
@Slf4j
@Component
public class DeviceSimpleJob implements SimpleJob {
@Override
public void execute(ShardingContext shardingContext) {
log.info("Item: {} | Time: {} | Thread: {} | {}",
shardingContext.getShardingItem(), LocalDateTime.now(),
Thread.currentThread().getId(), "SIMPLE");
...
}
}
```
JobManage:
```
@Slf4j
@Component
public class DynamicJobManage {
@Autowired
private ZookeeperRegistryCenter zookeeperRegistryCenter;
@Autowired
private DeviceSimpleJob simpleJob;
public void create(String jobName, String cron, int shardingTotalCount,
String parameters) {
JobConfiguration jobConfiguration = JobConfiguration
.newBuilder(jobName, shardingTotalCount)
.cron(cron)
.jobParameter(parameters)
.overwrite(true)
.build();
new ScheduleJobBootstrap(zookeeperRegistryCenter, simpleJob,
jobConfiguration);
}
}
```
Service:
```
@Slf4j
@Service
public class JobService {
@Autowired
private DynamicJobManage dynamicJobManage;
public void scanAddJob() {
String jobName = "device-D0001-point-CR1001";
String cron = "0/" + 10 + " * * * * ?";
String params = "cmdb-device-D0001";
dynamicJobManage.create(jobName, cron, 3, params);
}
}
```
Application:
```
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
```
--
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]