首页 > 解决方案 > 在 localhost 中打开 eureka 页面时出现 404 错误

问题描述

我已经Eureka Server使用 gradle 从 intellij 开始,并且服务器已根据日志启动并运行。但是404使用以下网址在浏览器中出现错误

http://localhost:8761/eureka/

请从 intellij 控制台找到日志

2020-07-12 13:57:27.988  INFO 24624 --- [           main] c.n.eureka.DefaultEurekaServerContext    : Initializing ...
2020-07-12 13:57:27.990  INFO 24624 --- [           main] c.n.eureka.cluster.PeerEurekaNodes       : Adding new peer nodes [http://localhost:8761/eureka/]
2020-07-12 13:57:28.370  INFO 24624 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON encoding codec LegacyJacksonJson
2020-07-12 13:57:28.370  INFO 24624 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON decoding codec LegacyJacksonJson
2020-07-12 13:57:28.370  INFO 24624 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using XML encoding codec XStreamXml
2020-07-12 13:57:28.370  INFO 24624 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using XML decoding codec XStreamXml
2020-07-12 13:57:28.507  INFO 24624 --- [           main] c.n.eureka.cluster.PeerEurekaNodes       : Replica node URL:  http://localhost:8761/eureka/
2020-07-12 13:57:28.516  INFO 24624 --- [           main] c.n.e.registry.AbstractInstanceRegistry  : Finished initializing remote region registries. All known remote regions: []
2020-07-12 13:57:28.518  INFO 24624 --- [           main] c.n.eureka.DefaultEurekaServerContext    : Initialized
2020-07-12 13:57:28.531  INFO 24624 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 2 endpoint(s) beneath base path '/actuator'
2020-07-12 13:57:28.620  INFO 24624 --- [           main] o.s.c.n.e.s.EurekaServiceRegistry        : Registering application UNKNOWN with eureka with status UP
2020-07-12 13:57:28.622  INFO 24624 --- [      Thread-11] o.s.c.n.e.server.EurekaServerBootstrap   : Setting the eureka configuration..
2020-07-12 13:57:28.622  INFO 24624 --- [      Thread-11] o.s.c.n.e.server.EurekaServerBootstrap   : Eureka data center value eureka.datacenter is not set, defaulting to default
2020-07-12 13:57:28.622  INFO 24624 --- [      Thread-11] o.s.c.n.e.server.EurekaServerBootstrap   : Eureka environment value eureka.environment is not set, defaulting to test
2020-07-12 13:57:28.640  INFO 24624 --- [      Thread-11] o.s.c.n.e.server.EurekaServerBootstrap   : isAws returned false
2020-07-12 13:57:28.641  INFO 24624 --- [      Thread-11] o.s.c.n.e.server.EurekaServerBootstrap   : Initialized server context
2020-07-12 13:57:28.641  INFO 24624 --- [      Thread-11] c.n.e.r.PeerAwareInstanceRegistryImpl    : Got 1 instances from neighboring DS node
2020-07-12 13:57:28.641  INFO 24624 --- [      Thread-11] c.n.e.r.PeerAwareInstanceRegistryImpl    : Renew threshold is: 1
2020-07-12 13:57:28.641  INFO 24624 --- [      Thread-11] c.n.e.r.PeerAwareInstanceRegistryImpl    : Changing status to UP
2020-07-12 13:57:28.649  INFO 24624 --- [      Thread-11] e.s.EurekaServerInitializerConfiguration : Started Eureka Server
2020-07-12 13:57:28.661  INFO 24624 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8761 (http) with context path ''
2020-07-12 13:57:28.662  INFO 24624 --- [           main] .s.c.n.e.s.EurekaAutoServiceRegistration : Updating port to 8761
2020-07-12 13:57:28.892  INFO 24624 --- [           main] c.l.m.e.EurekaServiceApplication         : Started EurekaServiceApplication in 6.138 seconds (JVM running for 6.688)
2020-07-12 13:57:33.891  INFO 24624 --- [nio-8761-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2020-07-12 13:57:33.891  INFO 24624 --- [nio-8761-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2020-07-12 13:57:33.900  INFO 24624 --- [nio-8761-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 9 ms
2020-07-12 13:58:28.642  INFO 24624 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry  : Running the evict task with compensationTime 0ms
2020-07-12 13:59:28.642  INFO 24624 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry  : Running the evict task with compensationTime 0ms

application.properties 文件。

server.port=8761

#telling the server not to register himself in the service
eureka.client.register-with-eureka=false

#Eureka clients fetch the service registry (ServiceInstance : (URL, PORT, HOST)) from the Eureka server
eureka.client.fetch-registry=false

标签: javaspring-boot

解决方案


尝试添加@EnableEurekaServer主类。

尝试点击网址:

http://localhost:8761/

代替

http://localhost:8761/eureka/

推荐阅读