diff --git a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBApplication.java b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBApplication.java index e6ecc6f754..47fe130b88 100644 --- a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBApplication.java +++ b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBApplication.java @@ -93,6 +93,8 @@ public abstract class CBApplication extends BaseWebApplication implements WebAut * In configuration mode sessions expire after a week */ private static final long CONFIGURATION_MODE_SESSION_IDLE_TIME = 60 * 60 * 1000 * 24 * 7; + public static final String HOST_LOCALHOST = "localhost"; + public static final String HOST_127_0_0_1 = "127.0.0.1"; static { @@ -260,9 +262,9 @@ protected void startServer() { if (CommonUtils.isEmpty(localHostAddress)) { localHostAddress = System.getProperty(CBConstants.VAR_CB_LOCAL_HOST_ADDR); } - if (CommonUtils.isEmpty(localHostAddress) || "127.0.0.1".equals(localHostAddress) || "::0".equals( + if (CommonUtils.isEmpty(localHostAddress) || HOST_127_0_0_1.equals(localHostAddress) || "::0".equals( localHostAddress)) { - localHostAddress = "localhost"; + localHostAddress = HOST_LOCALHOST; } final Runtime runtime = Runtime.getRuntime(); @@ -561,7 +563,7 @@ protected void parseConfiguration(Map configProps) throws DBExce hostName = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { log.debug("Error resolving localhost address: " + e.getMessage()); - hostName = "localhost"; + hostName = HOST_LOCALHOST; } } serverURL = "http://" + hostName + ":" + serverPort; @@ -609,7 +611,7 @@ protected void parseConfiguration(Map configProps) throws DBExce } } parseAdditionalConfiguration(configProps); - } catch (DBException e) { + } catch (Exception e) { throw new DBException("Error parsing server configuration", e); } diff --git a/server/bundles/io.cloudbeaver.service.security/src/io/cloudbeaver/service/security/db/CBDatabase.java b/server/bundles/io.cloudbeaver.service.security/src/io/cloudbeaver/service/security/db/CBDatabase.java index 5c7f2933bf..b02eb0f698 100644 --- a/server/bundles/io.cloudbeaver.service.security/src/io/cloudbeaver/service/security/db/CBDatabase.java +++ b/server/bundles/io.cloudbeaver.service.security/src/io/cloudbeaver/service/security/db/CBDatabase.java @@ -465,6 +465,7 @@ private void checkInstanceRecord(Connection connection) throws SQLException, IOE } catch (UnknownHostException e) { hostName = "localhost"; } + byte[] hardwareAddress = RuntimeUtils.getLocalMacAddress(); String macAddress = CommonUtils.toHexString(hardwareAddress);