Skip to content

Commit

Permalink
fix:fix agent 2023/2022 could not start by double registry
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikliu authored and SkyeBeFreeman committed Jun 25, 2024
1 parent f3c8196 commit a066de2
Show file tree
Hide file tree
Showing 26 changed files with 221 additions and 220 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.PolarisInitProperties;

import java.lang.instrument.Instrumentation;
import java.util.List;
Expand All @@ -40,6 +41,9 @@ public static void premain(String agentArgs, Instrumentation instrumentation, St
return;
}

PolarisInitProperties polarisInitProperties = new PolarisInitProperties();
polarisInitProperties.initialize();

logger.info("[Bootstrap] polaris-agent agentArgs:" + agentArgs);
logger.info("[Bootstrap] polarisAgentBootStrap.ClassLoader:" + PolarisAgentBootStrap.class.getClassLoader());
logger.info("[Bootstrap] contextClassLoader:" + Thread.currentThread().getContextClassLoader());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package cn.polarismesh.agent.core.bootstrap;

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");

}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
server.port=65002
spring.application.name=service-consumer-2022
management.endpoints.web.exposure.include=*
spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
spring.cloud.nacos.discovery.enabled=false
spring.cloud.nacos.config.enabled=false
spring.main.allow-bean-definition-overriding=true
spring.cloud.nacos.config.server-addr=127.0.0.1:8848
spring.cloud.nacos.discovery.enabled=true
spring.cloud.nacos.config.enabled=true
spring.cloud.nacos.username=nacos
spring.cloud.nacos.password=nacos
spring.cloud.nacos.discovery.fail-fast=true

spring.cloud.loadbalancer.nacos.enabled=true
# use feign client in GraalVM environment need to set below config
spring.cloud.refresh.enabled=false
spring.main.allow-circular-references=true
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
server.port=65001
spring.application.name=service-provider-2022
spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
spring.cloud.nacos.config.server-addr=127.0.0.1:8848
spring.cloud.nacos.config.enabled=false
spring.cloud.nacos.discovery.enabled=false
spring.cloud.nacos.config.enabled=true
spring.cloud.nacos.discovery.enabled=true
#spring.cloud.nacos.discovery.instance-enabled=true
#only register IPv4 instance
#spring.cloud.nacos.discovery.ip-type=IPv4
#only register IPv6 instance
#spring.cloud.nacos.discovery.ip-type=IPv6

spring.cloud.nacos.username=nacos
spring.cloud.nacos.password=nacos

management.endpoints.web.exposure.include=*
management.endpoint.health.show-details=always
spring.main.allow-bean-definition-overriding=true
spring.main.allow-circular-references=true
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#server.port=65002
#spring.application.name=service-consumer-2023
#management.endpoints.web.exposure.include=*
#spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
#spring.cloud.nacos.config.server-addr=127.0.0.1:8848
#spring.cloud.nacos.discovery.fail-fast=true
#spring.cloud.nacos.discovery.enabled=true
#spring.cloud.nacos.config.enabled=true
#spring.cloud.nacos.username=nacos
#spring.cloud.nacos.password=nacos
#
#feign.sentinel.enabled=true
#
#spring.cloud.sentinel.transport.dashboard=localhost:8080
#spring.cloud.sentinel.eager=true
#
#spring.cloud.sentinel.datasource.ds1.file.file=classpath: flowrule.json
#spring.cloud.sentinel.datasource.ds1.file.data-type=json
#spring.cloud.sentinel.datasource.ds1.file.rule-type=flow
#
#spring.cloud.sentinel.datasource.ds2.file.file=classpath: degraderule.json
#spring.cloud.sentinel.datasource.ds2.file.data-type=json
#spring.cloud.sentinel.datasource.ds2.file.rule-type=degrade
#spring.cloud.loadbalancer.nacos.enabled=true
## use feign client in GraalVM environment need to set below config
#spring.cloud.refresh.enabled=false
#spring.main.allow-circular-references=true

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
server.port=65002
spring.application.name=service-consumer-2023
management.endpoints.web.exposure.include=*
spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
spring.cloud.nacos.config.server-addr=127.0.0.1:8848
spring.cloud.nacos.discovery.fail-fast=true
spring.cloud.nacos.discovery.enabled=true
spring.cloud.nacos.config.enabled=true
spring.cloud.nacos.username=nacos
spring.cloud.nacos.password=nacos

spring.cloud.loadbalancer.nacos.enabled=true
# use feign client in GraalVM environment need to set below config
spring.cloud.refresh.enabled=false
spring.main.allow-circular-references=true

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
server.port=65001
spring.application.name=service-provider-2022
spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
spring.cloud.nacos.config.server-addr=127.0.0.1:8848
spring.cloud.nacos.config.enabled=true
spring.cloud.nacos.discovery.enabled=true
#spring.cloud.nacos.discovery.instance-enabled=true
#only register IPv4 instance
#spring.cloud.nacos.discovery.ip-type=IPv4
#only register IPv6 instance
#spring.cloud.nacos.discovery.ip-type=IPv6

spring.cloud.nacos.username=nacos
spring.cloud.nacos.password=nacos

management.endpoints.web.exposure.include=*
management.endpoint.health.show-details=always
spring.main.allow-circular-references=true

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#server.port=65001
#spring.application.name=service-provider-2022
#spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
#spring.cloud.nacos.config.server-addr=127.0.0.1:8848
#spring.cloud.nacos.config.enabled=true
#spring.cloud.nacos.discovery.enabled=true
##spring.cloud.nacos.discovery.instance-enabled=true
##only register IPv4 instance
##spring.cloud.nacos.discovery.ip-type=IPv4
##only register IPv6 instance
##spring.cloud.nacos.discovery.ip-type=IPv6
#
#spring.cloud.nacos.username=nacos
#spring.cloud.nacos.password=nacos
#
#management.endpoints.web.exposure.include=*
#management.endpoint.health.show-details=always
#spring.main.allow-circular-references=true

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
server.port=65002
spring.application.name=service-consumer-hoxton
server.port=18083
management.endpoints.web.exposure.include=*
spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
spring.cloud.nacos.discovery.enabled=false
spring.cloud.nacos.config.enabled=false
spring.cloud.nacos.config.server-addr=127.0.0.1:8848
spring.cloud.nacos.discovery.fail-fast=true
spring.cloud.nacos.config.enabled=true
spring.cloud.nacos.discovery.enabled=true
spring.cloud.nacos.username=nacos
spring.cloud.nacos.password=nacos


# use feign client in GraalVM environment need to set below config
spring.cloud.refresh.enabled=false
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
server.port=65001
server.port=0
spring.application.name=service-provider-hoxton
spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
spring.cloud.nacos.config.server-addr=127.0.0.1:8848
spring.cloud.nacos.config.enabled=false
spring.cloud.nacos.discovery.enabled=false
spring.cloud.nacos.config.enabled=true
spring.cloud.nacos.discovery.enabled=true
#spring.cloud.nacos.discovery.instance-enabled=true
#only register IPv4 instance
#spring.cloud.nacos.discovery.ip-type=IPv4
#only register IPv6 instance
#spring.cloud.nacos.discovery.ip-type=IPv6

spring.cloud.nacos.username=nacos
spring.cloud.nacos.password=nacos

management.endpoints.web.exposure.include=*
management.endpoint.health.show-details=always
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,10 @@
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-loadbalancer</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,10 @@
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-loadbalancer</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,10 @@
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-loadbalancer</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
Expand Down
Loading

0 comments on commit a066de2

Please sign in to comment.