The default for server.tomcat.basedir is located in temporary directory of OS. This may cause a functional issue in the application using JSP/Tags.

Source code for a sample application on GitHub.

@SpringBootApplication
public class JspApplication extends SpringBootServletInitializer {

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(JspApplication.class);
    }

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

}
@Controller
class JspController {

    @GetMapping("/")
    public String hello() {
        return "hello";
    }

    @GetMapping("/2")
    public String hello2() {
        return "hello2";
    }

}

... with the properties:

spring.mvc.view.prefix: /WEB-INF/jsp/
spring.mvc.view.suffix: .jsp
logging.level.root=DEBUG

Two JSP pages hello.jsp and hello2.jsp with the same content:

<!DOCTYPE html>
<%@taglib prefix="inc" tagdir="/WEB-INF/tags" %>

<html lang="en">
<head>
    <meta charset="UTF-8">
</head>
<body>
Hello
<inc:included/>
</body>
</html>

... and one tag file included.tag:

<%@tag pageEncoding="UTF-8" %>
<b>Included hello</b>

Step to reproduce an issue: * Start the application * Open http://localhost:8080/ * Remove work directory: rm -fr /tmp/tomcat* * Open http://localhost:8080/2

That will cause an error:

An error occurred at line: [10] in the jsp file: [/WEB-INF/jsp/hello2.jsp]
org.apache.jsp.tag.web.included_tag cannot be resolved to a type
7: </head>
8: <body>
9: Hello
10: <inc:included/>
11: </body>
12: </html>

Tomcat will not recompile deleted tag.

Temporary directory can be cleaned anytime, for example in CentOS it is cleaned by tmpfiles.d

Comment From: wilkinsona

Thanks for the report. Using something other than /tmp has been reconsidered before. I don't think anything's changed since then so we're unlikely to change the default.

That said, we used to have a note in the documentation about configuring tmpwatch, but it was removed. Judging by what you have described above, that removal may have been rather hasty. We should explore if it's possible to configure Tomcat to recompile the deleted tag or if we need to reinstate the warning in a modified form.

Comment From: wilkinsona

We’re cleaning out the issue tracker and closing issues that we’ve not seen much demand to fix. Feel free to comment with additional justifications if you feel that this one should not have been closed.