SpringCloud-Finchley.SR2尤里卡注册中心页面状态404

时间:2019-04-17 03:07:45

标签: spring-boot spring-cloud netflix-eureka

我导入了一个Finchley.SR2版本的springcloud演示,启动该应用程序后,我无法访问Eureka注册中心页面,状态404。 我还没有控制器,只有@SpringBootApplication 日食和创意上的相同问题

Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.

Wed Apr 17 10:46:08 CST 2019
There was an unexpected error (type=Not Found, status=404).
No message available

如果我使用版本Finchley.SR1和jersey-bundle 1.19依赖项,则一切正常。 这是pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.4.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>groupId</groupId>
    <artifactId>register-center</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>register-center</name>
    <properties>
        <java.version>1.8</java.version>
        <spring-cloud.version>Finchley.SR2</spring-cloud.version>
    </properties>

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

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <!-- 
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-bundle</artifactId>
            <version>1.19</version>
        </dependency>
         -->
    </dependencies>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

这是控制台输出的起始日志:


2019-04-17 10:45:55.070  INFO 6608 --- [           main] c.g.c.h.HubRegisterCenterApplication     : No active profile set, falling back to default profiles: default
2019-04-17 10:45:55.930  WARN 6608 --- [           main] o.s.boot.actuate.endpoint.EndpointId     : Endpoint ID 'service-registry' contains invalid characters, please migrate to a valid format.
2019-04-17 10:45:56.189  INFO 6608 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=b735a91d-6156-3751-9e56-6f2bcdd0ff57
2019-04-17 10:45:56.294  INFO 6608 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$e5276a08] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-04-17 10:45:56.982  INFO 6608 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8761 (http)
2019-04-17 10:45:57.007  INFO 6608 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-04-17 10:45:57.007  INFO 6608 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.17]
2019-04-17 10:45:57.277  INFO 6608 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-04-17 10:45:57.277  INFO 6608 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2190 ms
2019-04-17 10:45:57.390  WARN 6608 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
2019-04-17 10:45:57.390  INFO 6608 --- [           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-04-17 10:45:57.408  INFO 6608 --- [           main] c.netflix.config.DynamicPropertyFactory  : DynamicPropertyFactory is initialized with configuration sources: com.netflix.config.ConcurrentCompositeConfiguration@4af70944
2019-04-17 10:45:58.631  WARN 6608 --- [           main] o.s.c.n.a.ArchaiusAutoConfiguration      : No spring.application.name found, defaulting to 'application'
2019-04-17 10:45:58.632  WARN 6608 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
2019-04-17 10:45:58.632  INFO 6608 --- [           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-04-17 10:45:58.854  INFO 6608 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2019-04-17 10:45:59.276  WARN 6608 --- [           main] o.s.b.a.f.FreeMarkerAutoConfiguration    : Cannot find template location(s): [classpath:/templates/] (please add some templates, check your FreeMarker configuration, or set spring.freemarker.checkTemplateLocation=false)
2019-04-17 10:45:59.470  INFO 6608 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 2 endpoint(s) beneath base path '/actuator'
2019-04-17 10:45:59.716  INFO 6608 --- [           main] o.s.c.n.eureka.InstanceInfoFactory       : Setting initial instance status as: STARTING
2019-04-17 10:45:59.756  INFO 6608 --- [           main] com.netflix.discovery.DiscoveryClient    : Initializing Eureka in region us-east-1
2019-04-17 10:45:59.758  INFO 6608 --- [           main] com.netflix.discovery.DiscoveryClient    : Client configured to neither register nor query for data.
2019-04-17 10:45:59.775  INFO 6608 --- [           main] com.netflix.discovery.DiscoveryClient    : Discovery Client initialized at timestamp 1555469159773 with initial instances count: 0
2019-04-17 10:45:59.781  INFO 6608 --- [           main] o.s.c.n.e.s.EurekaServiceRegistry        : Registering application UNKNOWN with eureka with status UP
2019-04-17 10:45:59.840  INFO 6608 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8761 (http) with context path ''
2019-04-17 10:45:59.844  INFO 6608 --- [           main] c.g.c.h.HubRegisterCenterApplication     : Started HubRegisterCenterApplication in 6.441 seconds (JVM running for 7.261)
2019-04-17 10:46:08.612  INFO 6608 --- [nio-8761-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2019-04-17 10:46:08.612  INFO 6608 --- [nio-8761-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2019-04-17 10:46:08.618  INFO 6608 --- [nio-8761-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 6 ms

这是我的应用程序。yml:

server:
  port: 8761
eureka:
  client:
    register-with-eureka: false
    fetch-registry: false

这是我的应用程序类:

@SpringBootApplication
@EnableEurekaServer
public class HubRegisterCenterApplication {

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

}

2 个答案:

答案 0 :(得分:0)

问题解决了。 使用mvn install命令,我发现maven依赖项jar文件存在一些问题。删除并重新下载,问题解决了

答案 1 :(得分:0)

使用 application.properties 文件而不是 application.yml 文件。 喜欢

spring.application.name=cart-service

server.port=8082

它对我有用。