HTTP状态404 –部署在远程Tomcat服务器上时找不到

时间:2019-05-12 02:48:50

标签: java spring spring-boot tomcat tomcat9

我有一个像这样的主类的Spring Boot应用程序

@SpringBootApplication
@EnableEmailTools
@EnableScheduling
@EnableJpaAuditing
public class SimApplication extends SpringBootServletInitializer {


    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(SimApplication.class);
    }

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

    }

    @Bean
    public BCryptPasswordEncoder bCryptPasswordEncoder() {
        return new BCryptPasswordEncoder();
    }

    @Bean
    public JsonViewSupportFactoryBean views() {
        return new JsonViewSupportFactoryBean();
    }
}

我也有/这样的控制器

@Controller
public class WebController {
    @GetMapping("/")
    public String login(){
        return "login";
    }
}

在本地运行会显示login页。但是当我生成war文件并将其部署在Tomcat远程服务器上时,它总是会给我这个错误

HTTP Status 404 – Not Found
Type Status Report

Message /

Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

Apache Tomcat/9.0.19

本地主机的URL为http://localhost:8080/,这将我重定向到Login。现在,在远程服务器上部署到Tomcat之后,每当我按下http://remoteurl:8080/artifact-id/时,它都会将我发送到错误页面。 我想念什么?任何帮助,将不胜感激。谢谢

0 个答案:

没有答案