Browse Source

service start exception modify (#787)

* service start exception modify

* master,worker start modify

* .env update
乔占卫 5 years ago
parent
commit
0877e35efa

+ 4 - 4
escheduler-dao/src/main/java/cn/escheduler/dao/DaoFactory.java

@@ -48,10 +48,10 @@ public class DaoFactory {
     synchronized (daoMap) {
       if (!daoMap.containsKey(className)) {
         try {
-          T t = BeanContext.getBean(clazz);
-//          T t = clazz.getConstructor().newInstance();
-//          // 实例初始化
-//          t.init();
+//          T t = BeanContext.getBean(clazz);
+          T t = clazz.getConstructor().newInstance();
+          // 实例初始化
+          t.init();
           daoMap.put(className, t);
         } catch (Exception e) {
           logger.error(e.getMessage(), e);

+ 3 - 3
escheduler-server/src/main/java/cn/escheduler/server/master/MasterServer.java

@@ -33,6 +33,7 @@ import org.quartz.SchedulerException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.SpringApplication;
 import org.springframework.boot.WebApplicationType;
 import org.springframework.boot.builder.SpringApplicationBuilder;
 import org.springframework.context.annotation.ComponentScan;
@@ -90,10 +91,9 @@ public class MasterServer extends AbstractServer {
      * master server not use web service
      */
     public static void main(String[] args) {
-        SpringApplicationBuilder app = new SpringApplicationBuilder(MasterServer.class);
+        SpringApplication app = new SpringApplication(MasterServer.class);
 
-        app.web(WebApplicationType.NONE)
-                .run(args);
+        app.run(args);
     }
 
 

+ 3 - 3
escheduler-server/src/main/java/cn/escheduler/server/worker/WorkerServer.java

@@ -39,6 +39,7 @@ import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.SpringApplication;
 import org.springframework.boot.WebApplicationType;
 import org.springframework.boot.builder.SpringApplicationBuilder;
 import org.springframework.context.annotation.ComponentScan;
@@ -121,10 +122,9 @@ public class WorkerServer extends AbstractServer {
      */
     public static void main(String[] args) {
 
-        SpringApplicationBuilder app = new SpringApplicationBuilder(WorkerServer.class);
+        SpringApplication app = new SpringApplication(WorkerServer.class);
 
-        app.web(WebApplicationType.NONE)
-                .run(args);
+        app.run(args);
     }
 
 

+ 3 - 0
escheduler-server/src/main/resources/application_master.properties

@@ -1 +1,4 @@
 logging.config=classpath:master_logback.xml
+
+# server port
+server.port=5566

+ 4 - 0
escheduler-server/src/main/resources/application_worker.properties

@@ -0,0 +1,4 @@
+logging.config=classpath:master_logback.xml
+
+# server port
+server.port=7788

+ 1 - 1
script/escheduler-daemon.sh

@@ -47,7 +47,7 @@ elif [ "$command" = "master-server" ]; then
   LOG_FILE="-Dspring.config.location=conf/application_master.properties -Ddruid.mysql.usePingMethod=false"
   CLASS=cn.escheduler.server.master.MasterServer
 elif [ "$command" = "worker-server" ]; then
-  LOG_FILE="-Dlogback.configurationFile=conf/worker_logback.xml -Ddruid.mysql.usePingMethod=false"
+  LOG_FILE="-Dspring.config.location=conf/application_worker.properties -Ddruid.mysql.usePingMethod=false"
   CLASS=cn.escheduler.server.worker.WorkerServer
 elif [ "$command" = "alert-server" ]; then
   LOG_FILE="-Dlogback.configurationFile=conf/alert_logback.xml"