SpringCloud启动eureka server后,没报错却不能访问管理页面(404问题)

 更新时间:2023年11月20日 08:58:48   作者:小楊同学的笔记本  
这篇文章主要介绍了SpringCloud启动eureka server后,没报错却不能访问管理页面(404问题),具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教

SpringCloud启动eureka server,没报错却不能访问管理页面

application.yml:

server:
  port: 8761  #服务器端口

eureka:
  instance:
    hostname: eureka-server #eureka实例的主机名
  client:
    register-with-eureka: false #不把自己(eureka-server)注册到eureka上(不做高可用的情况下)
    fetch-registry: false #不从eureka上来获取服务的注册信息(因为本身就是注册中心,消费者就需要获取提供者的信息)
    service-url:
      defaultZone: http://localhost:8761/eureka/  #不指定默认为http://localhost:8761/eureka.client/

主配置类:

pom.xml

	<dependencies>
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
			<exclusions>
				<exclusion>
					<artifactId>woodstox-core</artifactId>
					<groupId>com.fasterxml.woodstox</groupId>
				</exclusion>
				<exclusion>
					<artifactId>jsr305</artifactId>
					<groupId>com.google.code.findbugs</groupId>
				</exclusion>
				<exclusion>
					<artifactId>HdrHistogram</artifactId>
					<groupId>org.hdrhistogram</groupId>
				</exclusion>
			</exclusions>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
			<exclusions>
				<exclusion>
					<groupId>org.junit.vintage</groupId>
					<artifactId>junit-vintage-engine</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
	</dependencies>

启动项目后,控制台:(正常启动,没报错)

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.3.0.RELEASE)

2020-05-30 20:35:27.633  INFO 98337 --- [           main] c.a.e.EurekaServerApplication            : No active profile set, falling back to default profiles: default
2020-05-30 20:35:28.652  WARN 98337 --- [           main] o.s.boot.actuate.endpoint.EndpointId     : Endpoint ID 'service-registry' contains invalid characters, please migrate to a valid format.
2020-05-30 20:35:28.813  INFO 98337 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=eb24c9f6-b729-33b9-9f69-7305cd06e02b
2020-05-30 20:35:29.154  INFO 98337 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8761 (http)
2020-05-30 20:35:29.163  INFO 98337 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2020-05-30 20:35:29.163  INFO 98337 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.35]
2020-05-30 20:35:29.271  INFO 98337 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2020-05-30 20:35:29.271  INFO 98337 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1614 ms
2020-05-30 20:35:29.370  WARN 98337 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
2020-05-30 20:35:29.371  INFO 98337 --- [           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.
2020-05-30 20:35:29.386  INFO 98337 --- [           main] c.netflix.config.DynamicPropertyFactory  : DynamicPropertyFactory is initialized with configuration sources: com.netflix.config.ConcurrentCompositeConfiguration@56f521c6
2020-05-30 20:35:29.779  INFO 98337 --- [           main] c.s.j.s.i.a.WebApplicationImpl           : Initiating Jersey application, version 'Jersey: 1.19.1 03/11/2016 02:08 PM'
2020-05-30 20:35:29.855  INFO 98337 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON encoding codec LegacyJacksonJson
2020-05-30 20:35:29.856  INFO 98337 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON decoding codec LegacyJacksonJson
2020-05-30 20:35:29.980  INFO 98337 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using XML encoding codec XStreamXml
2020-05-30 20:35:29.980  INFO 98337 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using XML decoding codec XStreamXml
2020-05-30 20:35:30.477  WARN 98337 --- [           main] o.s.c.n.a.ArchaiusAutoConfiguration      : No spring.application.name found, defaulting to 'application'
2020-05-30 20:35:30.477  WARN 98337 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
2020-05-30 20:35:30.478  INFO 98337 --- [           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.
2020-05-30 20:35:30.636  INFO 98337 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2020-05-30 20:35:31.153  WARN 98337 --- [           main] ockingLoadBalancerClientRibbonWarnLogger : 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.
2020-05-30 20:35:31.199  INFO 98337 --- [           main] o.s.c.n.eureka.InstanceInfoFactory       : Setting initial instance status as: STARTING
2020-05-30 20:35:31.221  INFO 98337 --- [           main] com.netflix.discovery.DiscoveryClient    : Initializing Eureka in region us-east-1
2020-05-30 20:35:31.221  INFO 98337 --- [           main] com.netflix.discovery.DiscoveryClient    : Client configured to neither register nor query for data.
2020-05-30 20:35:31.226  INFO 98337 --- [           main] com.netflix.discovery.DiscoveryClient    : Discovery Client initialized at timestamp 1590842131225 with initial instances count: 0
2020-05-30 20:35:31.257  INFO 98337 --- [           main] c.n.eureka.DefaultEurekaServerContext    : Initializing ...
2020-05-30 20:35:31.259  INFO 98337 --- [           main] c.n.eureka.cluster.PeerEurekaNodes       : Adding new peer nodes [http://localhost:8761/eureka/]
2020-05-30 20:35:31.467  INFO 98337 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON encoding codec LegacyJacksonJson
2020-05-30 20:35:31.467  INFO 98337 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON decoding codec LegacyJacksonJson
2020-05-30 20:35:31.467  INFO 98337 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using XML encoding codec XStreamXml
2020-05-30 20:35:31.467  INFO 98337 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using XML decoding codec XStreamXml
2020-05-30 20:35:36.591  INFO 98337 --- [           main] c.n.eureka.cluster.PeerEurekaNodes       : Replica node URL:  http://localhost:8761/eureka/
2020-05-30 20:35:36.603  INFO 98337 --- [           main] c.n.e.registry.AbstractInstanceRegistry  : Finished initializing remote region registries. All known remote regions: []
2020-05-30 20:35:36.604  INFO 98337 --- [           main] c.n.eureka.DefaultEurekaServerContext    : Initialized
2020-05-30 20:35:36.620  INFO 98337 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 2 endpoint(s) beneath base path '/actuator'
2020-05-30 20:35:36.710  INFO 98337 --- [           main] o.s.c.n.e.s.EurekaServiceRegistry        : Registering application UNKNOWN with eureka with status UP
2020-05-30 20:35:36.713  INFO 98337 --- [     Thread-438] o.s.c.n.e.server.EurekaServerBootstrap   : Setting the eureka configuration..
2020-05-30 20:35:36.714  INFO 98337 --- [     Thread-438] o.s.c.n.e.server.EurekaServerBootstrap   : Eureka data center value eureka.datacenter is not set, defaulting to default
2020-05-30 20:35:36.714  INFO 98337 --- [     Thread-438] o.s.c.n.e.server.EurekaServerBootstrap   : Eureka environment value eureka.environment is not set, defaulting to test
2020-05-30 20:35:36.730  INFO 98337 --- [     Thread-438] o.s.c.n.e.server.EurekaServerBootstrap   : isAws returned false
2020-05-30 20:35:36.731  INFO 98337 --- [     Thread-438] o.s.c.n.e.server.EurekaServerBootstrap   : Initialized server context
2020-05-30 20:35:36.731  INFO 98337 --- [     Thread-438] c.n.e.r.PeerAwareInstanceRegistryImpl    : Got 1 instances from neighboring DS node
2020-05-30 20:35:36.731  INFO 98337 --- [     Thread-438] c.n.e.r.PeerAwareInstanceRegistryImpl    : Renew threshold is: 1
2020-05-30 20:35:36.731  INFO 98337 --- [     Thread-438] c.n.e.r.PeerAwareInstanceRegistryImpl    : Changing status to UP
2020-05-30 20:35:36.747  INFO 98337 --- [     Thread-438] e.s.EurekaServerInitializerConfiguration : Started Eureka Server
2020-05-30 20:35:36.773  INFO 98337 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8761 (http) with context path ''
2020-05-30 20:35:36.774  INFO 98337 --- [           main] .s.c.n.e.s.EurekaAutoServiceRegistration : Updating port to 8761
2020-05-30 20:35:36.812  INFO 98337 --- [           main] c.a.e.EurekaServerApplication            : Started EurekaServerApplication in 20.996 seconds (JVM running for 26.947)
2020-05-30 20:35:37.190  INFO 98337 --- [)-192.168.0.106] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2020-05-30 20:35:37.191  INFO 98337 --- [)-192.168.0.106] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2020-05-30 20:35:37.203  INFO 98337 --- [)-192.168.0.106] o.s.web.servlet.DispatcherServlet        : Completed initialization in 12 ms
2020-05-30 20:36:36.737  INFO 98337 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry  : Running the evict task with compensationTime 0ms
2020-05-30 20:37:36.742  INFO 98337 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry  : Running the evict task with compensationTime 3ms
2020-05-30 20:38:36.749  INFO 98337 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry  : Running the evict task with compensationTime 4ms
2020-05-30 20:39:36.754  INFO 98337 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry  : Running the evict task with compensationTime 3ms
2020-05-30 20:40:36.761  INFO 98337 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry  : Running the evict task with compensationTime 5ms
2020-05-30 20:41:36.768  INFO 98337 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry  : Running the evict task with compensationTime 5ms
 

访问http://localhost:8761/eureka/(404错误)

解决办法

去掉eureka/,直接访问http://localhost:8761/

如果还不行,在application.yml里添加

spring.freemarker.prefer-file-system-access: false

试试看。

总结

以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。

相关文章

  • 通过实例解析synchronized和lock区别

    通过实例解析synchronized和lock区别

    这篇文章主要介绍了通过实例解析synchronized和lock区别,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
    2020-12-12
  • java使用udp实现简单多人聊天功能

    java使用udp实现简单多人聊天功能

    这篇文章主要为大家详细介绍了java使用udp实现简单多人聊天功能,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
    2022-02-02
  • Java使用Apache POI库读取Excel表格文档的示例

    Java使用Apache POI库读取Excel表格文档的示例

    POI库是Apache提供的用于在Windows下读写各类微软Office文档的Java库,这里我们就来看一下Java使用Apache POI库读取Excel表格文档的示例:
    2016-06-06
  • Redisson分布式信号量RSemaphore的使用超详细讲解

    Redisson分布式信号量RSemaphore的使用超详细讲解

    这篇文章主要介绍了Redisson分布式信号量RSemaphore的使用,基于Redis的Redisson的分布式信号量RSemaphore采用了与java.util.concurrent.Semaphore相似的接口和用法
    2023-02-02
  • SpringBoot3集成MapstructPlus的实现

    SpringBoot3集成MapstructPlus的实现

    本文主要介绍了SpringBoot3集成MapstructPlus的实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
    2025-08-08
  • java拼接字符串时去掉最后一个多余逗号的方法

    java拼接字符串时去掉最后一个多余逗号的方法

    这篇文章主要介绍了java拼接字符串时去掉最后一个多余逗号的方法,实例分析了java操作字符串的技巧,具有一定参考借鉴价值,需要的朋友可以参考下
    2015-03-03
  • 基于SpringBoot+Avue实现短信通知功能

    基于SpringBoot+Avue实现短信通知功能

    Avue是基于vue和element-ui的快速开发框架 ,它的核心是数据驱动UI的思想,让我们从繁琐的crud开发中解脱出来,本文将给大家介绍一下使用SpringBoot+Avue实现短信通知功能,文中有详细的代码示例,需要的朋友可以参考下
    2023-09-09
  • 快速了解Java中NIO核心组件

    快速了解Java中NIO核心组件

    这篇文章主要介绍了快速了解Java中NIO核心组件,涉及相关介绍及完整实例,具有一定借鉴价值,需要的朋友可以参考下。
    2017-12-12
  • 利用java获取某个文件夹下的所有文件

    利用java获取某个文件夹下的所有文件

    这篇文章主要给大家介绍了关于如何利用java获取某个文件夹下的所有文件的相关资料,在从事web开发工作中,经常需要对本地某一个目录下的文件进行处理,需要的朋友可以参考下
    2023-07-07
  • Java实现简单局域网聊天室

    Java实现简单局域网聊天室

    这篇文章主要为大家详细介绍了Java实现简单局域网聊天室,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
    2021-06-06

最新评论