From 34e2f346170321484213c5f1daa10d384cdbe04f Mon Sep 17 00:00:00 2001 From: fredrikliu Date: Mon, 24 Jun 2024 10:10:08 +0800 Subject: [PATCH 1/6] ban nacos registry and config --- .../agent/core/bootstrap/PolarisAgentBootStrap.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/polaris-agent-core/polaris-agent-core-bootstrap-common/src/main/java/cn/polarismesh/agent/core/bootstrap/PolarisAgentBootStrap.java b/polaris-agent-core/polaris-agent-core-bootstrap-common/src/main/java/cn/polarismesh/agent/core/bootstrap/PolarisAgentBootStrap.java index 9f0ed504..d6174aea 100644 --- a/polaris-agent-core/polaris-agent-core-bootstrap-common/src/main/java/cn/polarismesh/agent/core/bootstrap/PolarisAgentBootStrap.java +++ b/polaris-agent-core/polaris-agent-core-bootstrap-common/src/main/java/cn/polarismesh/agent/core/bootstrap/PolarisAgentBootStrap.java @@ -40,6 +40,9 @@ public static void premain(String agentArgs, Instrumentation instrumentation, St return; } + System.setProperty("spring.cloud.nacos.config.enabled", "false"); + System.setProperty("spring.cloud.nacos.discovery.enabled", "false"); + logger.info("[Bootstrap] polaris-agent agentArgs:" + agentArgs); logger.info("[Bootstrap] polarisAgentBootStrap.ClassLoader:" + PolarisAgentBootStrap.class.getClassLoader()); logger.info("[Bootstrap] contextClassLoader:" + Thread.currentThread().getContextClassLoader()); From c0064e4469e2c5a5355734a251313cadefd81c93 Mon Sep 17 00:00:00 2001 From: fredrikliu Date: Mon, 24 Jun 2024 10:35:04 +0800 Subject: [PATCH 2/6] ban nacos registry and config --- .../agent/core/bootstrap/SetProperties.java | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 polaris-agent-core/polaris-agent-core-bootstrap-common/src/main/java/cn/polarismesh/agent/core/bootstrap/SetProperties.java diff --git a/polaris-agent-core/polaris-agent-core-bootstrap-common/src/main/java/cn/polarismesh/agent/core/bootstrap/SetProperties.java b/polaris-agent-core/polaris-agent-core-bootstrap-common/src/main/java/cn/polarismesh/agent/core/bootstrap/SetProperties.java new file mode 100644 index 00000000..402aa8c3 --- /dev/null +++ b/polaris-agent-core/polaris-agent-core-bootstrap-common/src/main/java/cn/polarismesh/agent/core/bootstrap/SetProperties.java @@ -0,0 +1,11 @@ +package cn.polarismesh.agent.core.bootstrap; + +public class SetProperties { + + public void initialize() { + + System.setProperty("spring.cloud.nacos.config.enabled", "false"); + System.setProperty("spring.cloud.nacos.discovery.enabled", "false"); + + } +} From 352328b6cb0d0fcf66509c92960c2c8da7ec4bcc Mon Sep 17 00:00:00 2001 From: fredrikliu Date: Mon, 24 Jun 2024 10:35:20 +0800 Subject: [PATCH 3/6] ban nacos registry and config --- .../agent/core/bootstrap/PolarisAgentBootStrap.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/polaris-agent-core/polaris-agent-core-bootstrap-common/src/main/java/cn/polarismesh/agent/core/bootstrap/PolarisAgentBootStrap.java b/polaris-agent-core/polaris-agent-core-bootstrap-common/src/main/java/cn/polarismesh/agent/core/bootstrap/PolarisAgentBootStrap.java index d6174aea..c5f7d3aa 100644 --- a/polaris-agent-core/polaris-agent-core-bootstrap-common/src/main/java/cn/polarismesh/agent/core/bootstrap/PolarisAgentBootStrap.java +++ b/polaris-agent-core/polaris-agent-core-bootstrap-common/src/main/java/cn/polarismesh/agent/core/bootstrap/PolarisAgentBootStrap.java @@ -20,6 +20,7 @@ import cn.polarismesh.agent.core.bootstrap.starter.BootStrapStarter; import cn.polarismesh.agent.core.bootstrap.util.AgentDirUtils; import cn.polarismesh.agent.core.common.utils.JarFileUtils; +import cn.polarismesh.agent.core.bootstrap.SetProperties; import java.lang.instrument.Instrumentation; import java.util.List; @@ -40,8 +41,8 @@ public static void premain(String agentArgs, Instrumentation instrumentation, St return; } - System.setProperty("spring.cloud.nacos.config.enabled", "false"); - System.setProperty("spring.cloud.nacos.discovery.enabled", "false"); + SetProperties setProperties = new SetProperties(); + setProperties.initialize(); logger.info("[Bootstrap] polaris-agent agentArgs:" + agentArgs); logger.info("[Bootstrap] polarisAgentBootStrap.ClassLoader:" + PolarisAgentBootStrap.class.getClassLoader()); From f10abb5b5f9ca97a009a512280905c7d7c44791b Mon Sep 17 00:00:00 2001 From: fredrikliu Date: Mon, 24 Jun 2024 10:48:55 +0800 Subject: [PATCH 4/6] ban nacos registry and config --- .../{SetProperties.java => PolarisInitProperties.java} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename polaris-agent-core/polaris-agent-core-bootstrap-common/src/main/java/cn/polarismesh/agent/core/bootstrap/{SetProperties.java => PolarisInitProperties.java} (86%) diff --git a/polaris-agent-core/polaris-agent-core-bootstrap-common/src/main/java/cn/polarismesh/agent/core/bootstrap/SetProperties.java b/polaris-agent-core/polaris-agent-core-bootstrap-common/src/main/java/cn/polarismesh/agent/core/bootstrap/PolarisInitProperties.java similarity index 86% rename from polaris-agent-core/polaris-agent-core-bootstrap-common/src/main/java/cn/polarismesh/agent/core/bootstrap/SetProperties.java rename to polaris-agent-core/polaris-agent-core-bootstrap-common/src/main/java/cn/polarismesh/agent/core/bootstrap/PolarisInitProperties.java index 402aa8c3..57464645 100644 --- a/polaris-agent-core/polaris-agent-core-bootstrap-common/src/main/java/cn/polarismesh/agent/core/bootstrap/SetProperties.java +++ b/polaris-agent-core/polaris-agent-core-bootstrap-common/src/main/java/cn/polarismesh/agent/core/bootstrap/PolarisInitProperties.java @@ -1,6 +1,6 @@ package cn.polarismesh.agent.core.bootstrap; -public class SetProperties { +public class PolarisInitProperties { public void initialize() { From e9520c3717bc7cee9ebf5de43f56ac9e29326ba3 Mon Sep 17 00:00:00 2001 From: fredrikliu Date: Mon, 24 Jun 2024 10:49:07 +0800 Subject: [PATCH 5/6] ban nacos registry and config --- .../agent/core/bootstrap/PolarisAgentBootStrap.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/polaris-agent-core/polaris-agent-core-bootstrap-common/src/main/java/cn/polarismesh/agent/core/bootstrap/PolarisAgentBootStrap.java b/polaris-agent-core/polaris-agent-core-bootstrap-common/src/main/java/cn/polarismesh/agent/core/bootstrap/PolarisAgentBootStrap.java index c5f7d3aa..849701b2 100644 --- a/polaris-agent-core/polaris-agent-core-bootstrap-common/src/main/java/cn/polarismesh/agent/core/bootstrap/PolarisAgentBootStrap.java +++ b/polaris-agent-core/polaris-agent-core-bootstrap-common/src/main/java/cn/polarismesh/agent/core/bootstrap/PolarisAgentBootStrap.java @@ -20,7 +20,7 @@ import cn.polarismesh.agent.core.bootstrap.starter.BootStrapStarter; import cn.polarismesh.agent.core.bootstrap.util.AgentDirUtils; import cn.polarismesh.agent.core.common.utils.JarFileUtils; -import cn.polarismesh.agent.core.bootstrap.SetProperties; +import cn.polarismesh.agent.core.bootstrap.PolarisInitProperties; import java.lang.instrument.Instrumentation; import java.util.List; @@ -41,8 +41,8 @@ public static void premain(String agentArgs, Instrumentation instrumentation, St return; } - SetProperties setProperties = new SetProperties(); - setProperties.initialize(); + PolarisInitProperties polarisInitProperties = new PolarisInitProperties(); + polarisInitProperties.initialize(); logger.info("[Bootstrap] polaris-agent agentArgs:" + agentArgs); logger.info("[Bootstrap] polarisAgentBootStrap.ClassLoader:" + PolarisAgentBootStrap.class.getClassLoader()); From e8d21e8e3c60e3d9aa398fa651f5ac59f5f5c300 Mon Sep 17 00:00:00 2001 From: fredrikliu Date: Mon, 24 Jun 2024 11:18:37 +0800 Subject: [PATCH 6/6] add annotation --- .../polarismesh/agent/core/bootstrap/PolarisInitProperties.java | 1 + 1 file changed, 1 insertion(+) diff --git a/polaris-agent-core/polaris-agent-core-bootstrap-common/src/main/java/cn/polarismesh/agent/core/bootstrap/PolarisInitProperties.java b/polaris-agent-core/polaris-agent-core-bootstrap-common/src/main/java/cn/polarismesh/agent/core/bootstrap/PolarisInitProperties.java index 57464645..6c05c357 100644 --- a/polaris-agent-core/polaris-agent-core-bootstrap-common/src/main/java/cn/polarismesh/agent/core/bootstrap/PolarisInitProperties.java +++ b/polaris-agent-core/polaris-agent-core-bootstrap-common/src/main/java/cn/polarismesh/agent/core/bootstrap/PolarisInitProperties.java @@ -4,6 +4,7 @@ public class PolarisInitProperties { public void initialize() { + // ban nacos as sct currently does not support double registration System.setProperty("spring.cloud.nacos.config.enabled", "false"); System.setProperty("spring.cloud.nacos.discovery.enabled", "false");