首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Eureka应用程序启动干净,但浏览器获得404 (应用程序不是托管在预期的地址)?

Eureka应用程序启动干净,但浏览器获得404 (应用程序不是托管在预期的地址)?
EN

Stack Overflow用户
提问于 2019-10-18 16:44:45
回答 2查看 1.9K关注 0票数 0

完整的启动日志如下。当我导航到:

http://localhost:8010/eureka

事件没有日志输出,因此显然地址是错误的。

..。

..。

我在POM中定义的URL是

eureka.client.serviceUrl.defaultZone = http://localhost:8010/eureka

..。

..。

请注意:我有VirtualBox和2个虚拟以太网适配器(以前还没有引起过任何springboot应用程序的问题,但这是我第一次运行Eureka)。

..。

..。

控制台日志输出在启动时:

代码语言:javascript
复制
2019-10-18 13:35:29.693  INFO 10428 --- [           main] .p.d.PhotoAppDiscoveryServiceApplication : No active profile set, falling back to default profiles: default
2019-10-18 13:35:30.195  WARN 10428 --- [           main] o.s.boot.actuate.endpoint.EndpointId     : Endpoint ID 'service-registry' contains invalid characters, please migrate to a valid format.
2019-10-18 13:35:30.356  INFO 10428 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=829b0077-09b9-383d-8219-ef5903892aeb
2019-10-18 13:35:30.415  INFO 10428 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$cee4ddf2] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-10-18 13:35:30.597  INFO 10428 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8010 (http)
2019-10-18 13:35:30.616  INFO 10428 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-10-18 13:35:30.617  INFO 10428 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.26]
2019-10-18 13:35:30.724  INFO 10428 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-10-18 13:35:30.724  INFO 10428 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1019 ms
2019-10-18 13:35:30.799  WARN 10428 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
2019-10-18 13:35:30.799  INFO 10428 --- [           main] c.n.c.sources.URLConfigurationSource     : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-10-18 13:35:30.805  INFO 10428 --- [           main] c.netflix.config.DynamicPropertyFactory  : DynamicPropertyFactory is initialized with configuration sources: com.netflix.config.ConcurrentCompositeConfiguration@166c2c17
2019-10-18 13:35:32.263  INFO 10428 --- [           main] o.s.cloud.commons.util.InetUtils         : Cannot determine local hostname
2019-10-18 13:35:32.470  INFO 10428 --- [           main] c.s.j.s.i.a.WebApplicationImpl           : Initiating Jersey application, version 'Jersey: 1.19.1 03/11/2016 02:08 PM'
2019-10-18 13:35:32.518  INFO 10428 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON encoding codec LegacyJacksonJson
2019-10-18 13:35:32.519  INFO 10428 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON decoding codec LegacyJacksonJson
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.thoughtworks.xstream.core.util.Fields (file:/C:/Users/user/.m2/repository/com/thoughtworks/xstream/xstream/1.4.10/xstream-1.4.10.jar) to field java.util.TreeMap.comparator
WARNING: Please consider reporting this to the maintainers of com.thoughtworks.xstream.core.util.Fields
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2019-10-18 13:35:32.606  INFO 10428 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using XML encoding codec XStreamXml
2019-10-18 13:35:32.606  INFO 10428 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using XML decoding codec XStreamXml
2019-10-18 13:35:32.880  WARN 10428 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
2019-10-18 13:35:32.880  INFO 10428 --- [           main] c.n.c.sources.URLConfigurationSource     : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-10-18 13:35:33.005  INFO 10428 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2019-10-18 13:35:34.458  INFO 10428 --- [           main] o.s.cloud.commons.util.InetUtils         : Cannot determine local hostname
2019-10-18 13:35:34.550  INFO 10428 --- [           main] o.s.c.n.eureka.InstanceInfoFactory       : Setting initial instance status as: STARTING
2019-10-18 13:35:34.568  INFO 10428 --- [           main] com.netflix.discovery.DiscoveryClient    : Initializing Eureka in region us-east-1
2019-10-18 13:35:34.568  INFO 10428 --- [           main] com.netflix.discovery.DiscoveryClient    : Client configured to neither register nor query for data.
2019-10-18 13:35:34.573  INFO 10428 --- [           main] com.netflix.discovery.DiscoveryClient    : Discovery Client initialized at timestamp 1571416534572 with initial instances count: 0
2019-10-18 13:35:34.595  INFO 10428 --- [           main] c.n.eureka.DefaultEurekaServerContext    : Initializing ...
2019-10-18 13:35:34.596  WARN 10428 --- [           main] c.n.eureka.cluster.PeerEurekaNodes       : The replica size seems to be empty. Check the route 53 DNS Registry
2019-10-18 13:35:34.606  INFO 10428 --- [           main] c.n.e.registry.AbstractInstanceRegistry  : Finished initializing remote region registries. All known remote regions: []
2019-10-18 13:35:34.607  INFO 10428 --- [           main] c.n.eureka.DefaultEurekaServerContext    : Initialized
2019-10-18 13:35:34.615  INFO 10428 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 2 endpoint(s) beneath base path '/actuator'
2019-10-18 13:35:34.669  INFO 10428 --- [           main] o.s.c.n.e.s.EurekaServiceRegistry        : Registering application DISCOVERYSERVICE with eureka with status UP
2019-10-18 13:35:34.671  INFO 10428 --- [      Thread-10] o.s.c.n.e.server.EurekaServerBootstrap   : Setting the eureka configuration..
2019-10-18 13:35:34.673  INFO 10428 --- [      Thread-10] o.s.c.n.e.server.EurekaServerBootstrap   : Eureka data center value eureka.datacenter is not set, defaulting to default
2019-10-18 13:35:34.673  INFO 10428 --- [      Thread-10] o.s.c.n.e.server.EurekaServerBootstrap   : Eureka environment value eureka.environment is not set, defaulting to test
2019-10-18 13:35:34.680  INFO 10428 --- [      Thread-10] o.s.c.n.e.server.EurekaServerBootstrap   : isAws returned false
2019-10-18 13:35:34.681  INFO 10428 --- [      Thread-10] o.s.c.n.e.server.EurekaServerBootstrap   : Initialized server context
2019-10-18 13:35:34.681  INFO 10428 --- [      Thread-10] c.n.e.r.PeerAwareInstanceRegistryImpl    : Got 1 instances from neighboring DS node
2019-10-18 13:35:34.681  INFO 10428 --- [      Thread-10] c.n.e.r.PeerAwareInstanceRegistryImpl    : Renew threshold is: 1
2019-10-18 13:35:34.681  INFO 10428 --- [      Thread-10] c.n.e.r.PeerAwareInstanceRegistryImpl    : Changing status to UP
2019-10-18 13:35:34.689  INFO 10428 --- [      Thread-10] e.s.EurekaServerInitializerConfiguration : Started Eureka Server
2019-10-18 13:35:34.703  INFO 10428 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8010 (http) with context path ''
2019-10-18 13:35:34.704  INFO 10428 --- [           main] .s.c.n.e.s.EurekaAutoServiceRegistration : Updating port to 8010
2019-10-18 13:35:34.706  INFO 10428 --- [           main] .p.d.PhotoAppDiscoveryServiceApplication : Started PhotoAppDiscoveryServiceApplication in 7.989 seconds (JVM running for 8.689)
2019-10-18 13:35:36.892  INFO 10428 --- [on(1)-127.0.0.1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2019-10-18 13:35:36.892  INFO 10428 --- [on(1)-127.0.0.1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2019-10-18 13:35:36.903  INFO 10428 --- [on(1)-127.0.0.1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 11 ms

我的应用程序:

代码语言:javascript
复制
@SpringBootApplication
@EnableEurekaServer // "stands up a registry that other applications can talk to" https://spring.io/guides/gs/service-registration-and-discovery/
public class PhotoAppDiscoveryServiceApplication {


    public static void main(String[] args) {
        SpringApplication.run(PhotoAppDiscoveryServiceApplication.class, args);
    }

}

我的application.properties:

代码语言:javascript
复制
server.port=8010
spring.application.name=discoveryservice
eureka.client.registerWithEureka=false
eureka.client.fetchRegistry=false
eureka.client.serviceUrl.defaultZone = http://localhost:8010/eureka
EN

回答 2

Stack Overflow用户

发布于 2019-10-18 16:49:36

defaultZone http://localhost:8010不承载仪表板。

http://localhost:8010托管仪表板。

http://localhost:8010/eureka是发现服务副本的URL。在这个例子中,只有一个Eureka实例,这就是它的地址。

https://cloud.spring.io/spring-cloud-netflix/multi/multi__service_discovery_eureka_clients.html

票数 1
EN

Stack Overflow用户

发布于 2021-05-23 19:09:48

请试试这个。因为defaultZone应该在骆驼的情况下。server-url应该加上下划线。

代码语言:javascript
复制
eureka.client.service-url.defaultZone=http://localhost:8010/eureka
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58455055

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档