spring-boot - 在外部tomcat上调用@GetMapping“/”会引发错误-Spring Boot
问题描述
我开发了一个spring boot应用程序并部署在外部tomcat上。我面临的是当我通过上下文路径调用应用程序时 tomcat 抛出异常。
控制器
@GetMapping(value="/", produces = "text/html;charset=UTF-8")
public String loadIndexPage() {
return "index";
}
pom.xml
<build>
<finalName>apluscontent</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
我希望应用程序在http://localhost:8080/apluscontent/上运行,但它会抛出异常
由于异常 [无法在 requestUri '/apluscontent/' 中找到 lookupPath '/index.html',从请求 [/index.html] 转发到错误页面。路径是否包含用于 characterEncoding 'UTF-8' 的无效编码字符?]
java.lang.IllegalStateException:无法在 requestUri '/apluscontent/' 中找到 lookupPath '/index.html'。路径是否包含用于 characterEncoding 'UTF-8' 的无效编码字符?
解决方案
推荐阅读
- eclipse - Eclipse photon 总是在重启时重置键绑定
- java - ConcurrentHashMap update of multiple entries
- jquery - 在数据表上获取选定的行 id
- php - 公司网络中的 PHP Composer 问题
- git - 为什么添加merge.tool和diff.tool后git paginate不起作用?
- winapi - C++ DLL中带有CreateMailslot函数的api无法被UWP调用
- php - SQL - 两个工人一次过滤
- java - RecyclerView URL 重定向到 WebView (WebScraping)
- regex - Regex lookahead part of group accepted
- django - Token Authentication with django rest framework