Why does not tomcat throw an exception when `server.start` failed with a socket 
binding error.

https://github.com/apache/incubator-dubbo/blob/master/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/tomcat/TomcatHttpServer.java#L71

I do see the exception stack printed on the Console, whereas no exception was 
thrown in here:
```java
try {
            tomcat.start();
        } catch (LifecycleException e) {
            throw new IllegalStateException("Failed to start tomcat server at " 
+ url.getAddress(), e);
        } catch (Exception ee) {
            throw new IllegalStateException(e);
        }

```

This behavior will cause a tomcat based HTTP service being registered 
unexpectedly to the Registry even after the binding has failed.

```java
@Override
    public <T> Exporter<T> export(final Invoker<T> originInvoker) throws 
RpcException {
         ... ...
        // socket binding exception extected
        final ExporterChangeableWrapper<T> exporter = 
doLocalExport(originInvoker, providerUrl);
        ... ... 
        // url to registry
        final Registry registry = getRegistry(originInvoker);
        register(registryUrl, registeredProviderUrl);
         
        return new DestroyableExporter<>(exporter);
    }
```

[ Full content available at: 
https://github.com/apache/incubator-dubbo/issues/3236 ]
This message was relayed via gitbox.apache.org for 
[email protected]

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to