openvidu-server: capture spring initialization error and better inform of port issues

v2
pabloFuente 2025-11-14 13:00:13 +01:00
parent 9bbe7787c7
commit 9b575bf778
2 changed files with 33 additions and 20 deletions

View File

@ -302,8 +302,21 @@ public class OpenViduServer implements JsonRpcConfigurer {
argsAux[argsAux.length - 2] = "--spring.main.banner-mode=off"; argsAux[argsAux.length - 2] = "--spring.main.banner-mode=off";
argsAux[argsAux.length - 1] = "--spring.main.allow-circular-references=true"; argsAux[argsAux.length - 1] = "--spring.main.allow-circular-references=true";
try {
SpringApplication.run(OpenViduServer.class, argsAux); SpringApplication.run(OpenViduServer.class, argsAux);
} catch (org.springframework.context.ApplicationContextException e) {
Throwable rootCause = e;
while (rootCause.getCause() != null) {
rootCause = rootCause.getCause();
}
if (rootCause instanceof java.net.BindException) {
log.error("Cannot start OpenVidu Server on port {}: {}."
+ " You can modify the port used by OpenVidu Server with the 'HTTPS_PORT' configuration property.",
System.getProperty("server.port"), rootCause.getMessage());
} else {
throw e;
}
}
} }
public static <T> Map<String, String> checkConfigProperties(Class<T> configClass) throws InterruptedException { public static <T> Map<String, String> checkConfigProperties(Class<T> configClass) throws InterruptedException {

View File

@ -677,7 +677,7 @@ public class OpenviduConfig {
try { try {
URI finalUri = new URI(this.getFinalUrl()); URI finalUri = new URI(this.getFinalUrl());
this.coturnIp = finalUri.getHost(); this.coturnIp = finalUri.getHost();
} catch (URISyntaxException e) { } catch (Exception e) {
log.error("Can't get Domain name from OpenVidu public Url: " + e.getMessage()); log.error("Can't get Domain name from OpenVidu public Url: " + e.getMessage());
} }
} }