最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

netflix.discovery.shared.transport.TransportException:Cannot execute request on any known server

 更新時(shí)間:2023年09月19日 14:52:10   作者:globalcoding  
這篇文章主要介紹了netflix.discovery.shared.transport.TransportException:Cannot execute request on any known server報(bào)錯(cuò)問題及解決方法,感興趣的朋友一起看看吧

報(bào)錯(cuò)

 當(dāng)我們啟動(dòng)項(xiàng)目報(bào)錯(cuò):

2023-09-13 16:25:47.875 [] [] [main] ERROR com.netflix.discovery.shared.transport.decorator.RedirectingEurekaHttpClient -Request execution error. endpoint=DefaultEndpoint{ serviceUrl='http://localhost:8761/eureka/}
com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused: connect
    at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:187)
    at com.sun.jersey.api.client.filter.GZIPContentEncodingFilter.handle(GZIPContentEncodingFilter.java:123)
    at com.netflix.discovery.EurekaIdentityHeaderFilter.handle(EurekaIdentityHeaderFilter.java:27)

com.netflix.discovery.shared.transport.TransportException: 
Cannot execute request on any known server

這個(gè)報(bào)錯(cuò)是因?yàn)槭褂昧薊ureka。Eureka會(huì)啟用服務(wù)發(fā)現(xiàn)服務(wù)治理,所以你會(huì)看到Eureka,discovery,server等關(guān)鍵詞。

Eureka之所以會(huì)報(bào)錯(cuò),是因?yàn)槟闩渲梦募]有配置Eureka的相關(guān)配置。所以它會(huì)默認(rèn)使用你本機(jī)的DNS和本機(jī)的主機(jī)名。例如我這里的是123091-NB02.yun.alibaba.com:8030(見具體報(bào)錯(cuò)),123091是我的工號(hào),yun.alibaba.com是我公司內(nèi)部的域名

windows系統(tǒng)下,cmd使用命令 ipconfig /all 查看網(wǎng)絡(luò)配置信息可以看到:

D:\>ipconfig /all
Windows IP 配置
   主機(jī)名  . . . . . . . . . . . . . : 123091-NB02
   主 DNS 后綴 . . . . . . . . . . . : yun.alibaba.com
   節(jié)點(diǎn)類型  . . . . . . . . . . . . : 混合
   IP 路由已啟用 . . . . . . . . . . : 否
   WINS 代理已啟用 . . . . . . . . . : 否

解決方法

這種問題通常會(huì)出現(xiàn)在我們接手了別人的項(xiàng)目里,如果該項(xiàng)目只是一個(gè)簡單的springboot,不需要微服務(wù),不需要cloud。

方法一: 去掉maven依賴

但報(bào)了這個(gè)錯(cuò),通常是因?yàn)閜om文件里有eureka的依賴。

pom.xml里,需要注釋掉(注釋完記得reload一下maven,右上角會(huì)出現(xiàn)刷新圖標(biāo))

         <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
        </dependency>

 啟動(dòng)類里,需要注釋掉

//@EnableEurekaClient
@SpringBootApplication
public class Application {}

當(dāng)然,有可能你項(xiàng)目里用到了eureka這個(gè)包里的類。例如我項(xiàng)目里用到了aop的aspectj。

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
@Aspect
@Pointcut(value = "execution(public * com.alibaba.yun.controller..*Controller.*(..))")

需要引入springboot的aop依賴。這里不需要引入aspectjweaver(其包含aspectjrt),springboot的aop包有aspectjweaver

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-aop</artifactId>
        </dependency>

還有另外兩個(gè)偷懶辦法:

方法二:直接在application配置文件里禁用eureka

# 是否將自己注冊到 Eureka-Server 中,默認(rèn)true
eureka.client.register-with-eureka=false
# 是否需要拉取服務(wù)信息,默認(rèn)true
eureka.client.fetch-registry=false

方法三:檢查eureka配置的地址是否正確

# 則在Eureka服務(wù)發(fā)現(xiàn)應(yīng)該配置為:
# http://127.0.0.1:8080/eureka/
server.port: 8080
eureka.client.serviceUrl.defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/

具體報(bào)錯(cuò)如下:

2023-09-13 16:25:41.167 [] [] [main] WARN  org.springframework.cloud.loadbalancer.config.BlockingLoadBalancerClientAutoConfiguration$BlockingLoadBalancerClientRibbonWarnLogger -You already have RibbonLoadBalancerClient on your classpath. It will be used by default. As Spring Cloud Ribbon is in maintenance mode. We recommend switching to BlockingLoadBalancerClient instead. In order to use it, set the value of `spring.cloud.loadbalancer.ribbon.enabled` to `false` or remove spring-cloud-starter-netflix-ribbon from your project.
2023-09-13 16:25:41.440 [] [] [main] INFO  org.springframework.cloud.netflix.eureka.InstanceInfoFactory -Setting initial instance status as: STARTING
2023-09-13 16:25:41.548 [] [] [main] INFO  com.netflix.discovery.DiscoveryClient -Initializing Eureka in region us-east-1
2023-09-13 16:25:41.789 [] [] [main] INFO  com.netflix.discovery.provider.DiscoveryJerseyProvider -Using JSON encoding codec LegacyJacksonJson
2023-09-13 16:25:41.789 [] [] [main] INFO  com.netflix.discovery.provider.DiscoveryJerseyProvider -Using JSON decoding codec LegacyJacksonJson
2023-09-13 16:25:42.281 [] [] [main] INFO  com.netflix.discovery.provider.DiscoveryJerseyProvider -Using XML encoding codec XStreamXml
2023-09-13 16:25:42.281 [] [] [main] INFO  com.netflix.discovery.provider.DiscoveryJerseyProvider -Using XML decoding codec XStreamXml
2023-09-13 16:25:43.310 [] [] [main] INFO  com.netflix.discovery.shared.resolver.aws.ConfigClusterResolver -Resolving eureka endpoints via configuration
2023-09-13 16:25:43.572 [] [] [main] INFO  com.netflix.discovery.DiscoveryClient -Disable delta property : false
2023-09-13 16:25:43.573 [] [] [main] INFO  com.netflix.discovery.DiscoveryClient -Single vip registry refresh property : null
2023-09-13 16:25:43.573 [] [] [main] INFO  com.netflix.discovery.DiscoveryClient -Force full registry fetch : false
2023-09-13 16:25:43.573 [] [] [main] INFO  com.netflix.discovery.DiscoveryClient -Application is null : false
2023-09-13 16:25:43.573 [] [] [main] INFO  com.netflix.discovery.DiscoveryClient -Registered Applications size is zero : true
2023-09-13 16:25:43.573 [] [] [main] INFO  com.netflix.discovery.DiscoveryClient -Application version is -1: true
2023-09-13 16:25:43.573 [] [] [main] INFO  com.netflix.discovery.DiscoveryClient -Getting all instance registry info from the eureka server
2023-09-13 16:25:47.875 [] [] [main] ERROR com.netflix.discovery.shared.transport.decorator.RedirectingEurekaHttpClient -Request execution error. endpoint=DefaultEndpoint{ serviceUrl='http://localhost:8761/eureka/}
com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused: connect
    at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:187)
    at com.sun.jersey.api.client.filter.GZIPContentEncodingFilter.handle(GZIPContentEncodingFilter.java:123)
    at com.netflix.discovery.EurekaIdentityHeaderFilter.handle(EurekaIdentityHeaderFilter.java:27)
    at com.sun.jersey.api.client.Client.handle(Client.java:652)
    at com.sun.jersey.api.client.WebResource.handle(WebResource.java:682)
    at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
    at com.sun.jersey.api.client.WebResource$Builder.get(WebResource.java:509)
    at com.netflix.discovery.shared.transport.jersey.AbstractJerseyEurekaHttpClient.getApplicationsInternal(AbstractJerseyEurekaHttpClient.java:196)
    at com.netflix.discovery.shared.transport.jersey.AbstractJerseyEurekaHttpClient.getApplications(AbstractJerseyEurekaHttpClient.java:167)
    at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$6.execute(EurekaHttpClientDecorator.java:137)
    at com.netflix.discovery.shared.transport.decorator.MetricsCollectingEurekaHttpClient.execute(MetricsCollectingEurekaHttpClient.java:73)
    at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.java:134)
    at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$6.execute(EurekaHttpClientDecorator.java:137)
    at com.netflix.discovery.shared.transport.decorator.RedirectingEurekaHttpClient.executeOnNewServer(RedirectingEurekaHttpClient.java:118)
    at com.netflix.discovery.shared.transport.decorator.RedirectingEurekaHttpClient.execute(RedirectingEurekaHttpClient.java:79)
    at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.java:134)
    at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$6.execute(EurekaHttpClientDecorator.java:137)
    at com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient.execute(RetryableEurekaHttpClient.java:120)
    at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.java:134)
    at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$6.execute(EurekaHttpClientDecorator.java:137)
    at com.netflix.discovery.shared.transport.decorator.SessionedEurekaHttpClient.execute(SessionedEurekaHttpClient.java:77)
    at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.java:134)
    at com.netflix.discovery.DiscoveryClient.getAndStoreFullRegistry(DiscoveryClient.java:1074)
    at com.netflix.discovery.DiscoveryClient.fetchRegistry(DiscoveryClient.java:988)
    at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:433)
    at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:279)
    at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:275)
    at org.springframework.cloud.netflix.eureka.CloudEurekaClient.<init>(CloudEurekaClient.java:67)
    at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration.eurekaClient(EurekaClientAutoConfiguration.java:324)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:651)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:636)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$1(AbstractBeanFactory.java:359)
    at org.springframework.cloud.context.scope.GenericScope$BeanLifecycleWrapper.getBean(GenericScope.java:389)
    at org.springframework.cloud.context.scope.GenericScope.get(GenericScope.java:186)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:356)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
    at org.springframework.aop.target.SimpleBeanTargetSource.getTarget(SimpleBeanTargetSource.java:35)
    at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaRegistration.getTargetObject(EurekaRegistration.java:129)
    at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaRegistration.getEurekaClient(EurekaRegistration.java:117)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:282)
    at org.springframework.cloud.context.scope.GenericScope$LockedScopedProxyFactoryBean.invoke(GenericScope.java:499)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:747)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689)
    at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaRegistration$$EnhancerBySpringCGLIB$$1.getEurekaClient(<generated>)
    at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaServiceRegistry.maybeInitializeClient(EurekaServiceRegistry.java:57)
    at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaServiceRegistry.register(EurekaServiceRegistry.java:38)
    at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaAutoServiceRegistration.start(EurekaAutoServiceRegistration.java:83)
    at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:182)
    at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:53)
    at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:360)
    at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:158)
    at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:122)
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:894)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:162)
    at org.springframework.context.support.AbstractApplicationContext.__refresh(AbstractApplicationContext.java:553)
    at org.springframework.context.support.AbstractApplicationContext.jrLockAndRefresh(AbstractApplicationContext.java:41002)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:42008)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
    at com.ali.xxx.Application.main(Application.java:15)
Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:589)
    at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:121)
    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180)
    at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144)
    at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:134)
    at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:605)
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:440)
    at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:835)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:118)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
    at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:173)
    ... 77 common frames omitted
2023-09-13 16:25:47.895 [] [] [main] WARN  com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient -Request execution failed with message: java.net.ConnectException: Connection refused: connect
2023-09-13 16:25:47.897 [] [] [main] ERROR com.netflix.discovery.DiscoveryClient -DiscoveryClient_UNKNOWN/123091-NB02.yun.alibaba.com:8030 - was unable to refresh its cache! status = Cannot execute request on any known server
com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
    at com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient.execute(RetryableEurekaHttpClient.java:112)
    at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.java:134)
    at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$6.execute(EurekaHttpClientDecorator.java:137)
    at com.netflix.discovery.shared.transport.decorator.SessionedEurekaHttpClient.execute(SessionedEurekaHttpClient.java:77)
    at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.java:134)
    at com.netflix.discovery.DiscoveryClient.getAndStoreFullRegistry(DiscoveryClient.java:1074)
    at com.netflix.discovery.DiscoveryClient.fetchRegistry(DiscoveryClient.java:988)
    at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:433)
    at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:279)
    at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:275)
    at org.springframework.cloud.netflix.eureka.CloudEurekaClient.<init>(CloudEurekaClient.java:67)
    at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration.eurekaClient(EurekaClientAutoConfiguration.java:324)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:651)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:636)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$1(AbstractBeanFactory.java:359)
    at org.springframework.cloud.context.scope.GenericScope$BeanLifecycleWrapper.getBean(GenericScope.java:389)
    at org.springframework.cloud.context.scope.GenericScope.get(GenericScope.java:186)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:356)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
    at org.springframework.aop.target.SimpleBeanTargetSource.getTarget(SimpleBeanTargetSource.java:35)
    at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaRegistration.getTargetObject(EurekaRegistration.java:129)
    at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaRegistration.getEurekaClient(EurekaRegistration.java:117)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:282)
    at org.springframework.cloud.context.scope.GenericScope$LockedScopedProxyFactoryBean.invoke(GenericScope.java:499)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:747)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689)
    at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaRegistration$$EnhancerBySpringCGLIB$$1.getEurekaClient(<generated>)
    at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaServiceRegistry.maybeInitializeClient(EurekaServiceRegistry.java:57)
    at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaServiceRegistry.register(EurekaServiceRegistry.java:38)
    at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaAutoServiceRegistration.start(EurekaAutoServiceRegistration.java:83)
    at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:182)
    at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:53)
    at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:360)
    at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:158)
    at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:122)
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:894)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:162)
    at org.springframework.context.support.AbstractApplicationContext.__refresh(AbstractApplicationContext.java:553)
    at org.springframework.context.support.AbstractApplicationContext.jrLockAndRefresh(AbstractApplicationContext.java:41002)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:42008)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
    at com.ali.xxx.Application.main(Application.java:15)
2023-09-13 16:25:47.898 [] [] [main] WARN  com.netflix.discovery.DiscoveryClient -Using default backup registry implementation which does not do anything.
2023-09-13 16:25:47.901 [] [] [main] INFO  com.netflix.discovery.DiscoveryClient -Starting heartbeat executor: renew interval is: 30
2023-09-13 16:25:47.908 [] [] [main] INFO  com.netflix.discovery.InstanceInfoReplicator -InstanceInfoReplicator onDemand update allowed rate per min is 4
2023-09-13 16:25:47.919 [] [] [main] INFO  com.netflix.discovery.DiscoveryClient -Discovery Client initialized at timestamp 1694593547915 with initial instances count: 0
2023-09-13 16:25:47.926 [] [] [main] INFO  org.springframework.cloud.netflix.eureka.serviceregistry.EurekaServiceRegistry -Registering application UNKNOWN with eureka with status UP
2023-09-13 16:25:47.929 [] [] [main] INFO  com.netflix.discovery.DiscoveryClient -Saw local status change event StatusChangeEvent [timestamp=1694593547929, current=UP, previous=STARTING]
2023-09-13 16:25:47.933 [] [] [main] INFO  springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper -Context refreshed
2023-09-13 16:25:47.935 [] [] [DiscoveryClient-InstanceInfoReplicator-0] INFO  com.netflix.discovery.DiscoveryClient -DiscoveryClient_UNKNOWN/123091-NB02.yun.alibaba.com:8030: registering service...
2023-09-13 16:25:47.975 [] [] [main] INFO  springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper -Found 1 custom documentation plugin(s)
2023-09-13 16:25:48.089 [] [] [main] INFO  springfox.documentation.spring.web.scanners.ApiListingReferenceScanner -Scanning for api listing references
2023-09-13 16:25:48.643 [] [] [main] INFO  org.apache.coyote.http11.Http11NioProtocol -Starting ProtocolHandler ["http-nio-8030"]
2023-09-13 16:25:48.728 [] [] [main] INFO  org.springframework.boot.web.embedded.tomcat.TomcatWebServer -Tomcat started on port(s): 8030 (http) with context path '/api/ali-persistence'
2023-09-13 16:25:48.731 [] [] [main] INFO  org.springframework.cloud.netflix.eureka.serviceregistry.EurekaAutoServiceRegistration -Updating port to 8030
2023-09-13 16:25:49.067 [] [] [main] INFO  com.ali.xxx.Application -Started Application in 24.542 seconds (JVM running for 32.209)

aop代碼:

package com.alibaba.yun.aspect;
import lombok.extern.slf4j.Slf4j;
import org.apache.lucene.util.RamUsageEstimator;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.Date;
@Aspect
@Component
@Order(8)
@Slf4j
public class ControllerAspect {
    @Autowired
    private TrackService trackService;
    private final static String POINT_CUT = "execution(public * com.alibaba.yun.controller..*Controller.*(..))";
    @Pointcut(value = POINT_CUT)
    public void pointcut() {
    }
    @Before("pointcut()")
    public void doBefore(JoinPoint joinPoint) {
        log.info("===========>Controller請求內(nèi)容相關(guān)信息");
        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
        HttpServletRequest request = attributes.getRequest();
        log.info("url={}", request.getRequestURL());
        log.info("method={}", request.getMethod());
        log.info("ip={}", IpUtil.getIpAddress(request));
        // 獲取處理請求的類方法
        log.info("Controller請求的類方法={}", joinPoint.getSignature().getDeclaringTypeName() + "." + joinPoint.getSignature().getName() + "()");
        // 獲取請求方法傳入的參數(shù)
        log.info("Controller請求方法傳入的參數(shù)={}", Arrays.toString(joinPoint.getArgs()));
    }
    @AfterReturning(returning="object",pointcut="pointcut()")
    public void saveRequestInfo(JoinPoint joinPoint, Object object) {
        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
        HttpServletRequest request = attributes.getRequest();
        TrackRecordDO record = new TrackRecordDO();
        record.setInterfaceTime(new Date());
        record.setRealAddress(IpUtil.getIpAddress(request));
        String size = RamUsageEstimator.humanSizeOf(object);
        record.setResponseSize(size);
        record.setRequestPath(joinPoint.getSignature().getDeclaringTypeName() + "." + joinPoint.getSignature().getName());
        trackService.insert(record);
    }
}

到此這篇關(guān)于netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server的文章就介紹到這了,更多相關(guān)netflix.discovery.shared.transport.TransportException內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • 面試總結(jié):秒殺設(shè)計(jì)、AQS 、synchronized相關(guān)問題

    面試總結(jié):秒殺設(shè)計(jì)、AQS 、synchronized相關(guān)問題

    Java語言的關(guān)鍵字,當(dāng)它用來修飾一個(gè)方法或者一個(gè)代碼塊的時(shí)候,能夠保證在同一時(shí)刻最多只有一個(gè)線程執(zhí)行該段代碼。本文給大家介紹java中 synchronized的用法,對本文感興趣的朋友一起看看吧
    2021-06-06
  • Java數(shù)據(jù)結(jié)構(gòu)之實(shí)現(xiàn)跳表

    Java數(shù)據(jù)結(jié)構(gòu)之實(shí)現(xiàn)跳表

    今天帶大家來學(xué)習(xí)Java數(shù)據(jù)結(jié)構(gòu)的相關(guān)知識(shí),文中對用Java實(shí)現(xiàn)跳表作了非常詳細(xì)的圖文解說及代碼示例,對正在學(xué)習(xí)java的小伙伴們有很好地幫助,需要的朋友可以參考下
    2021-05-05
  • Java創(chuàng)建隨機(jī)數(shù)的四種方式總結(jié)

    Java創(chuàng)建隨機(jī)數(shù)的四種方式總結(jié)

    這篇文章主要介紹了java的四種隨機(jī)數(shù)生成方式的實(shí)現(xiàn)方法,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,,需要的朋友可以參考下
    2022-07-07
  • Java中this調(diào)用會(huì)導(dǎo)致事務(wù)失效的深入分析

    Java中this調(diào)用會(huì)導(dǎo)致事務(wù)失效的深入分析

    在Java中this是一個(gè)非常重要的關(guān)鍵字,它表示當(dāng)前對象的引用,也就是說,當(dāng)你在某個(gè)類的實(shí)例方法或構(gòu)造器中時(shí),this指向調(diào)用該方法或創(chuàng)建的當(dāng)前對象實(shí)例,這篇文章主要介紹了Java中this調(diào)用會(huì)導(dǎo)致事務(wù)失效的相關(guān)資料,需要的朋友可以參考下
    2026-04-04
  • Zookeeper全局唯一ID生成方案解析

    Zookeeper全局唯一ID生成方案解析

    這篇文章主要介紹了Zookeeper全局唯一ID生成方案解析,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2020-12-12
  • Java實(shí)現(xiàn)父子線程共享數(shù)據(jù)的幾種方法

    Java實(shí)現(xiàn)父子線程共享數(shù)據(jù)的幾種方法

    本文主要介紹了Java實(shí)現(xiàn)父子線程共享數(shù)據(jù)的幾種方法,包括直接共享變量、使用?ThreadLocal、同步機(jī)制、線程安全的數(shù)據(jù)結(jié)構(gòu)以及ExecutorService,文中通過示例代碼介紹的非常詳細(xì),需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2025-04-04
  • Spring Boot自定義Banner實(shí)現(xiàn)代碼

    Spring Boot自定義Banner實(shí)現(xiàn)代碼

    這篇文章主要介紹了Spring Boot自定義Banner實(shí)現(xiàn)代碼,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2020-01-01
  • Java中Object類的理解和使用

    Java中Object類的理解和使用

    Object類是java.lang包下的核心類,Object類是所有類的父類,何一個(gè)類時(shí)候如果沒有明確的繼承一個(gè)父類的話,那么它就是Object的子類,本文將通過代碼示例詳細(xì)介紹一下Java中Object類的理解和使用,需要的朋友可以參考下
    2023-06-06
  • Java生成和解析XML格式文件和字符串的實(shí)例代碼

    Java生成和解析XML格式文件和字符串的實(shí)例代碼

    這篇文章主要介紹了Java生成和解析XML格式文件和字符串的實(shí)例代碼,需要的朋友可以參考下
    2014-02-02
  • Java中輸入被跳過情況的深入探究

    Java中輸入被跳過情況的深入探究

    這篇文章主要給大家介紹了關(guān)于Java中輸入被跳過情況的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2021-04-04

最新評(píng)論

西丰县| 年辖:市辖区| 曲周县| 新邵县| 徐闻县| 南木林县| 定州市| 西贡区| 府谷县| 北流市| 浏阳市| 多伦县| 潼关县| 泌阳县| 肃宁县| 白朗县| 西峡县| 乌兰县| 炎陵县| 高陵县| 苏尼特右旗| 唐山市| 宽甸| 三明市| 宁晋县| 会昌县| 万盛区| 萨迦县| 扶余县| 鄄城县| 汉寿县| 浪卡子县| 武清区| 陈巴尔虎旗| 郧西县| 改则县| 巴青县| 保定市| 昌平区| 哈巴河县| 南阳市|