This is an automated email from the ASF dual-hosted git repository.
jinyleechina pushed a commit to branch 2.0.1-prepare
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
The following commit(s) were added to refs/heads/2.0.1-prepare by this push:
new e9d2701 Add missing property for API and worker (#7198)
e9d2701 is described below
commit e9d27015c3596f7521f6f0bbc0f5c47ffc309b92
Author: kezhenxu94 <[email protected]>
AuthorDate: Mon Dec 6 14:44:23 2021 +0800
Add missing property for API and worker (#7198)
---
.../apache/dolphinscheduler/api/ApiApplicationServer.java | 14 ++++++++++++++
.../dolphinscheduler/server/worker/WorkerServer.java | 9 +++++++++
2 files changed, 23 insertions(+)
diff --git
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/ApiApplicationServer.java
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/ApiApplicationServer.java
index 9d04857..d622fa3 100644
---
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/ApiApplicationServer.java
+++
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/ApiApplicationServer.java
@@ -17,6 +17,13 @@
package org.apache.dolphinscheduler.api;
+import static
org.apache.dolphinscheduler.common.Constants.SPRING_DATASOURCE_DRIVER_CLASS_NAME;
+
+import org.apache.dolphinscheduler.common.utils.PropertyUtils;
+
+import javax.annotation.PostConstruct;
+
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletComponentScan;
@@ -38,4 +45,11 @@ public class ApiApplicationServer extends
SpringBootServletInitializer {
new
SpringApplicationBuilder(ApiApplicationServer.class).profiles("api").run(args);
}
+ @Value("${spring.datasource.driver-class-name}")
+ private String driverClassName;
+
+ @PostConstruct
+ public void run() {
+ PropertyUtils.setValue(SPRING_DATASOURCE_DRIVER_CLASS_NAME,
driverClassName);
+ }
}
diff --git
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java
b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java
index 0cf8088..66f4e53 100644
---
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java
+++
b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java
@@ -17,10 +17,13 @@
package org.apache.dolphinscheduler.server.worker;
+import static
org.apache.dolphinscheduler.common.Constants.SPRING_DATASOURCE_DRIVER_CLASS_NAME;
+
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.IStoppable;
import org.apache.dolphinscheduler.common.enums.NodeType;
import org.apache.dolphinscheduler.common.thread.Stopper;
+import org.apache.dolphinscheduler.common.utils.PropertyUtils;
import org.apache.dolphinscheduler.remote.NettyRemotingServer;
import org.apache.dolphinscheduler.remote.command.CommandType;
import org.apache.dolphinscheduler.remote.config.NettyServerConfig;
@@ -35,6 +38,7 @@ import
org.apache.dolphinscheduler.service.bean.SpringApplicationContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.annotation.ComponentScan;
@@ -101,6 +105,9 @@ public class WorkerServer implements IStoppable {
@Autowired
private TaskPluginManager taskPluginManager;
+ @Value("${spring.datasource.driver-class-name}")
+ private String driverClassName;
+
/**
* worker server startup, not use web service
*
@@ -119,6 +126,8 @@ public class WorkerServer implements IStoppable {
*/
@PostConstruct
public void run() {
+ PropertyUtils.setValue(SPRING_DATASOURCE_DRIVER_CLASS_NAME,
driverClassName);
+
// alert-server client registry
alertClientService = new
AlertClientService(workerConfig.getAlertListenHost(), Constants.ALERT_RPC_PORT);