Страница ошибки Whitelabel, Тип: Не найдено Статус: 404 - PullRequest
0 голосов
/ 16 апреля 2019

Мы недавно обновили нашу весеннюю загрузочную версию с 1.5.10 до 2.1.2, и я столкнулся с проблемой.Когда служба развернута на сервере j boss, она говорит, что служба не найдена, и выдает сообщение об ошибке «Белая метка», когда я вызываю службу в чванстве на https://host:port/serviceName/swagger-ui.html, но если я звоню https://host:port/swagger-ui.html Iможет получить доступ к службе, и все работает нормально.Может кто-нибудь дать мне знать, в чем будет проблемаБлагодарим за помощь.

В pom.xml или bootstrap.yml ничего не изменилось, я только что обновил версии весенней загрузки.Все остальное такое же, как и в предыдущем.

Ниже приведен POM.Xml

<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>
    <groupId>com.goo.foo</groupId>
    <artifactId>security-service</artifactId>
    <version>1.2.3</version>
    <properties>
        <dep.scope>compile</dep.scope>
        <java.version>1.8</java.version>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.source>1.8</maven.compiler.source>
        <ojdbc.version>12.1.0.2</ojdbc.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <springfox-version>2.6.1</springfox-version>
        <config.version>2.1.0.RELEASE</config.version>
        <admin.version>2.1.0</admin.version>
        <consul-starter.version>2.1.0.RELEASE</consul-starter.version>
        <cloud-consul.version>2.1.0.RELEASE</cloud-consul.version>
    </properties>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.2.RELEASE</version>
        <relativePath />
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-consul-dependencies</artifactId>
            <version>${cloud-consul.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
        </dependency>
        <!--SpringFox dependencies -->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>${springfox-version}</version>
            <scope>${dep.scope}</scope>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>${springfox-version}</version>
            <scope>${dep.scope}</scope>
        </dependency>
        <dependency>
            <groupId>org.owasp.esapi</groupId>
            <artifactId>esapi</artifactId>
            <version>2.1.0</version>
        </dependency>
        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt</artifactId>
            <version>0.7.0</version>
        </dependency>
        <!-- Oracle JDBC driver -->
        <dependency>
            <groupId>com.oracle.jdbc</groupId>
            <artifactId>ojdbc7</artifactId>
            <version>${ojdbc.version}</version>
            <scope>${dep.scope}</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
        </dependency>
        <!-- Consul properties -->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-consul-all</artifactId>
            <version>${consul-starter.version}</version>
        </dependency>
        <!-- Spring config server - external properties -->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-config-client</artifactId>
            <version>${config.version}</version>
        </dependency>

        <!-- Spring boot admin client - monitoring the purpose -->
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-client</artifactId>
            <version>${admin.version}</version>
        </dependency>

    <!--  jedis cache  -->
        <dependency>
            <groupId>redis.clients</groupId>
            <artifactId>jedis</artifactId>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

1 Ответ

0 голосов
/ 16 апреля 2019

Похоже, вы "потеряли" свой context-path.Я предполагаю, что вы ранее указали это, используя устаревший server.contextPath=/serviceName в некоторой форме.Есть несколько способов установить его, но я настраиваю его в application.yaml

server:
  servlet:
    context-path: serviceName

или application.properties

server.servlet.context-path=/serviceName

, или вы можете установить контекст-path, указав его в качестве аргумента командной строки

java -jar app.jar --server.servlet.context-path=/serviceName

Это только некоторые из доступных параметров.Выясните, как вы установили его ранее, и замените его на server.servlet.context-path

...