Reputation: 47
It's a simple web application use external tomcat-9.0.56 and spring 5.3, springboot 2.5.5 and up, which works on windows 10 but not on ubuntu 18. It always display 404 because of the ErrorFilterPage. The tomcat used Context to point to the folder where the webapp was located at, also virtual host in apache 000-default.conf I've tried set setRegisterErrorPageFilter(false); or in the application.properties as well as inject @Bean FilterRegistrationBean disableSpringBootErrorFilter with/without return new ErrorPageFilter(); in @Bean public ErrorPageFilter errorPageFilter(), no success.
I feel despair at such a framework that can not deploy to Ubuntu with delays and disappointment that cause me a lot.
It's just a simple hello: http://localhost:8080/home: https://drive.google.com/file/d/1BiJ4-E0nPjuh1YxREpOcwN4AlzdSe3Pu/view?usp=sharing
How to fix it?!
Upvotes: 0
Views: 920
Reputation: 116171
There's a typo in your application.properties
file where you have configured spring.mvc.view.prefix
. The value has a trailing space. It is /WEB-INF/views/
and should be /WEB-INF/views/
. With this change in place, the /hello
endpoint works:
$ curl localhost:8080/hello
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>SAMPLE</title>
</head>
<body>
HELLO SPRING!
</body>
</html>%
Spring Boot intentionally does not trim whitespace from property values as there's no way for it to know whether or not the whitespace is intentional.
Upvotes: 1