在使用 Spring Boot(v2) 创建 Zipkin 服务器时,我面临着 Whitelabel 错误页面。
"
Whitelabel 错误页面
此应用程序没有 /error 的显式映射,因此您将此视为后备
。Wed Oct 30 11:21:35 IST 2019 出现意外错误(类型=未找到,状态=404)。否消息可用
“
当我在 Spring Boot 中运行应用程序时,我得到:
“找不到模板位置:classpath:/templates/(请添加一些模板或检查您的 Thymeleaf 配置)”
POM 文件:
<?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 https://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.2.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>edu.rohit</groupId>
<artifactId>ZipkinServer</artifactId>
<version>1</version>
<name>ZipkinServer</name>
<description>Demo project for Spring Boot Slueth-Zipkin</description>
<properties>
<java.version>1.8</java.version>
<!-- <spring-cloud.version>Hoxton.RC1</spring-cloud.version> -->
<spring-cloud.version>2.1.3.RELEASE</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<!-- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web-services</artifactId>
</dependency> -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- <dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-rest-hal-browser</artifactId>
</dependency> -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
<version>${spring-cloud.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
<version>${spring-cloud.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
<version>${spring-cloud.version}</version>
</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>
<!-- <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>
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</repository>
</repositories>
</project>
应用程序属性
server.port=9411
#spring.zipkin.baseUrl= http://localhost:9411
#server.error.whitelabel.enabled=false
#server.error.path=/error-spring
# spring.autoconfigure.exclude= org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration
#spring.freemarker.template-loader-path=classpath:/templates/
#spring.freemarker.prefer-file-system-access=false
management.security.enabled=false
ZipkinServerApplication
package edu.rohit.ZipkinServer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
SpringBootApplication(scanBasePackages={"edu.rohit.ZipkinServer"})
public class ZipkinServerApplication {
/*@Bean
public AlwaysSampler defaultSampler() {
return new AlwaysSampler();
}*/
public static void main(String[] args) {
SpringApplication.run(ZipkinServerApplication.class, args);
}
}
请帮我解决这个问题