liubao68 closed pull request #567: [SCB-365]when configured ssl certificates 
not exists, startup will hang and no error messages
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/567
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/ClientVerticle.java
 
b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/ClientVerticle.java
index c0937732d..19e972bea 100644
--- 
a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/ClientVerticle.java
+++ 
b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/ClientVerticle.java
@@ -17,15 +17,25 @@
 
 package org.apache.servicecomb.foundation.vertx.client;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import io.vertx.core.AbstractVerticle;
 
 public class ClientVerticle<CLIENT_POOL> extends AbstractVerticle {
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(ClientVerticle.class);
   public static final String CLIENT_MGR = "clientMgr";
 
   @SuppressWarnings("unchecked")
   @Override
   public void start() throws Exception {
-    ClientPoolManager<CLIENT_POOL> clientMgr = 
(ClientPoolManager<CLIENT_POOL>) config().getValue(CLIENT_MGR);
-    clientMgr.createClientPool();
+    try {
+      ClientPoolManager<CLIENT_POOL> clientMgr = 
(ClientPoolManager<CLIENT_POOL>) config().getValue(CLIENT_MGR);
+      clientMgr.createClientPool();
+    } catch (Throwable e) {
+      // vert.x got some states that not print error and execute call back in 
VertexUtils.blockDeploy, we add a log our self.
+      LOGGER.error("", e);
+      throw e;
+    }
   }
 }
diff --git 
a/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayServerVerticle.java
 
b/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayServerVerticle.java
index e7a694be5..9c892b8f2 100644
--- 
a/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayServerVerticle.java
+++ 
b/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayServerVerticle.java
@@ -48,9 +48,14 @@ public void init(Vertx vertx, Context context) {
 
   @Override
   public void start(Future<Void> startFuture) throws Exception {
-    super.start();
-
-    startListen(startFuture);
+    try {
+      super.start();
+      startListen(startFuture);
+    } catch (Throwable e) {
+      // vert.x got some states that not print error and execute call back in 
VertexUtils.blockDeploy, we add a log our self.
+      LOGGER.error("", e);
+      throw e;
+    }
   }
 
   protected void startListen(Future<Void> startFuture) {
diff --git 
a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/RestServerVerticle.java
 
b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/RestServerVerticle.java
index 73eab866a..6578d725e 100644
--- 
a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/RestServerVerticle.java
+++ 
b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/RestServerVerticle.java
@@ -59,23 +59,25 @@ public void init(Vertx vertx, Context context) {
 
   @Override
   public void start(Future<Void> startFuture) throws Exception {
-    super.start();
-
-    // 如果本地未配置地址,则表示不必监听,只需要作为客户端使用即可
-    if (endpointObject == null) {
-      LOGGER.warn("rest listen address is not configured, will not start.");
-      startFuture.complete();
-      return;
+    try {
+      super.start();
+      // 如果本地未配置地址,则表示不必监听,只需要作为客户端使用即可
+      if (endpointObject == null) {
+        LOGGER.warn("rest listen address is not configured, will not start.");
+        startFuture.complete();
+        return;
+      }
+      Router mainRouter = Router.router(vertx);
+      mountAccessLogHandler(mainRouter);
+      initDispatcher(mainRouter);
+      HttpServer httpServer = createHttpServer();
+      httpServer.requestHandler(mainRouter::accept);
+      startListen(httpServer, startFuture);
+    } catch(Throwable e) {
+      // vert.x got some states that not print error and execute call back in 
VertexUtils.blockDeploy, we add a log our self.
+      LOGGER.error("", e);
+      throw e;
     }
-
-    Router mainRouter = Router.router(vertx);
-    mountAccessLogHandler(mainRouter);
-    initDispatcher(mainRouter);
-
-    HttpServer httpServer = createHttpServer();
-    httpServer.requestHandler(mainRouter::accept);
-
-    startListen(httpServer, startFuture);
   }
 
   private void mountAccessLogHandler(Router mainRouter) {


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to