亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

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

 更新時間:2023年09月19日 14:52:10   作者:globalcoding  
這篇文章主要介紹了netflix.discovery.shared.transport.TransportException:Cannot execute request on any known 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)

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

這個報錯是因為使用了Eureka。Eureka會啟用服務發(fā)現(xiàn)服務治理,所以你會看到Eureka,discovery,server等關鍵詞。

Eureka之所以會報錯,是因為你配置文件沒有配置Eureka的相關配置。所以它會默認使用你本機的DNS和本機的主機名。例如我這里的是123091-NB02.yun.alibaba.com:8030(見具體報錯),123091是我的工號,yun.alibaba.com是我公司內(nèi)部的域名。

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

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

解決方法

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

方法一: 去掉maven依賴

但報了這個錯,通常是因為pom文件里有eureka的依賴。

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

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

 啟動類里,需要注釋掉

//@EnableEurekaClient
@SpringBootApplication
public class Application {}

當然,有可能你項目里用到了eureka這個包里的類。例如我項目里用到了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>

還有另外兩個偷懶辦法:

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

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

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

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

具體報錯如下:

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)容相關信息");
        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);
    }
}

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

相關文章

  • Java中IdentityHashMap與HashMap區(qū)別詳解

    Java中IdentityHashMap與HashMap區(qū)別詳解

    這篇文章主要介紹了Java中IdentityHashMap與HashMap區(qū)別詳解,很多人不曉得IdentityHashMap的存在,其中不乏工作很多年的Java開發(fā)者,他們看到就說是第三方jar包,實際上它是Jdk源碼自帶的集合類,需要的朋友可以參考下
    2023-11-11
  • 淺談java 單例模式DCL的缺陷及單例的正確寫法

    淺談java 單例模式DCL的缺陷及單例的正確寫法

    這篇文章主要介紹了淺談java 單例模式DCL的缺陷及單例的正確寫法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2020-09-09
  • Spring Boot JDBC 連接數(shù)據(jù)庫示例

    Spring Boot JDBC 連接數(shù)據(jù)庫示例

    本篇文章主要介紹了Spring Boot JDBC 連接數(shù)據(jù)庫示例,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2017-02-02
  • Spring中@PropertySource注解使用場景解析

    Spring中@PropertySource注解使用場景解析

    這篇文章主要介紹了Spring中@PropertySource注解使用場景解析,@PropertySource注解就是Spring中提供的一個可以加載配置文件的注解,并且可以將配置文件中的內(nèi)容存放到Spring的環(huán)境變量中,需要的朋友可以參考下
    2023-11-11
  • Java中JDBC的使用教程詳解

    Java中JDBC的使用教程詳解

    Java語言操作數(shù)據(jù)庫?JDBC本質(zhì):其實是官方(sun公司)定義的一套操作所有關系型數(shù)據(jù)庫的規(guī)則,即接口。本文講解了JDBC的使用方法,需要的可以參考一下
    2022-06-06
  • 使用maven一步一步構建spring mvc項目(圖文詳解)

    使用maven一步一步構建spring mvc項目(圖文詳解)

    這篇文章主要介紹了詳解使用maven一步一步構建spring mvc項目,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2017-09-09
  • Spring?Boot?ORM?框架JPA使用與連接池?Hikari詳解

    Spring?Boot?ORM?框架JPA使用與連接池?Hikari詳解

    這篇文章主要介紹了SpringBoot?ORM框架JPA與連接池Hikari,主要就是介紹JPA?的使用姿勢,本文結合實例代碼給大家介紹的非常詳細,需要的朋友可以參考下
    2023-08-08
  • java實現(xiàn)抖音代碼舞源碼

    java實現(xiàn)抖音代碼舞源碼

    這篇文章主要為大家詳細介紹了java實現(xiàn)抖音代碼舞的方法,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2019-04-04
  • eclipse啟動出現(xiàn)“failed to load the jni shared library”問題解決

    eclipse啟動出現(xiàn)“failed to load the jni shared library”問題解決

    這篇文章主要介紹了eclipse啟動出現(xiàn)“failed to load the jni shared library”問題解決,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友可以參考下
    2019-11-11
  • Java堆內(nèi)存又溢出了!教你一招必殺技(推薦)

    Java堆內(nèi)存又溢出了!教你一招必殺技(推薦)

    這篇文章主要介紹了Java內(nèi)存溢出問題,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2019-04-04

最新評論