我运行一个微服务“客户端服务”作为 Spring 启动应用程序
这是我的applications.properties for the micro服务:
# service
spring.application.name=client-service
server.port=8082
# h2
spring.h2.console.enabled=true
spring.h2.console.path=/h2
# DATASOURCE
spring.datasource.username=sa
spring.datasource.password=
spring.datasource.driver-class-name=org.h2.Driver
spring.jpa.hibernate.ddl-auto = update
spring.datasource.url=jdbc:h2:file:./Database/Data/Client;DB_CLOSE_ON_EXIT=FALSE;AUTO_SERVER=TRUE
# EUREKA
eureka.client.serviceUrl.defaultZone:http://localhost:8761/eureka/
eureka.client.register-with-eureka= true
至于我的eureka部署应用程序:
# service
spring.application.name=Eureka-server
server.port=8761
eureka.client.serviceUrl.defaultZone:http://localhost:8761/eureka/
eureka.client.register-with-eureka = false
eureka.client.fetch-registry= false
最后是zuul。属性:
spring.application.name=Zuul-Gateway
server.port=8083
# EUREKA
eureka.client.serviceUrl.defaultZone:http://localhost:8761/eureka/
eureka.client.register-with-eureka= true
eureka.instance.preferIpAddress= true
eureka.client.fetchRegistry=true
# ZUUL
zuul.host.connect-timeout-millis=10000
zuul.host.socket-timeout-millis= 1000000
zuul.routes.client-service.path=/client-service/*
zuul.routes.client-service.id=client-service
当我登录到Eureka port:8761 my 注册了两个应用程序
客户服务不适用(1)(1)向上(1)-localhost:client-service:8082
zuul网关不适用(1)(1)向上(1)-localhost:zuul-gateway:8083
当我试图通过zuul网关访问我的客户服务应用程序时”http://192.168.180.1:8083/客户服务/“或”localhost://8083/client-service/“我得到错误:
2021-01-05 13:29:00.111 INFO 15248 --- [nio-8083-exec-5] Filters.PreFilter : PreFilter: GET request to http://192.168.180.1:8083/client-service/
2021-01-05 13:29:00.111 INFO 15248 --- [nio-8083-exec-5] Filters.RouteFilter : RouteFilter: GET request to http://192.168.180.1:8083/client-service/
2021-01-05 13:29:00.113 WARN 15248 --- [nio-8083-exec-5] o.s.c.n.z.filters.post.SendErrorFilter : Error during filtering
com.netflix.zuul.exception.ZuulException: Forwarding error
at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.handleException(RibbonRoutingFilter.java:198) ~[spring-cloud-netflix-zuul-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.forward(RibbonRoutingFilter.java:173) ~[spring-cloud-netflix-zuul-2.1.2.RELEASE.jar:2.1.2.RELEASE]
以及用于errorfilter返回状态500的postfilter
2021-01-05 13:31:39.507 INFO 15248 --- [nio-8083-exec-9] Filters.PostFilter : ErrorFilter: response status is 500
2021-01-05 13:31:39.507 INFO 15248 --- [nio-8083-exec-9] Filters.PostFilter : PostFilter: response's content type is 500
暂无答案!
目前还没有任何答案,快来回答吧!