The Whitelabel Error Page is Spring Boot's default error page that appears when an exception occurs and no custom error handling mechanism is configured. It is commonly seen for issues such as incorrect URL mappings, missing resources, or unhandled exceptions.
http://localhost:8080/products
@GetMapping("/product")
Since no matching endpoint exists, Spring Boot displays the Whitelabel Error Page with HTTP 404 status.
1. Invalid URL Mapping
@RestController
@RequestMapping("/users")
public class UserController {
@GetMapping("/{id}")
public User getUser() {
return user;
}
}2. Missing Controller Annotation
@Controller
or
@RestController3. Unhandled Exceptions
@ControllerAdvice
public class GlobalExceptionHandler {
@ExceptionHandler(Exception.class)
public ResponseEntity<String> handleException(
Exception ex) {
return ResponseEntity
.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body("Something went wrong.");
}
}4. Missing View Template
return "home";
home.html
is missing from templates folder.
5. Disable Whitelabel Error Page
server.error.whitelabel.enabled=false
This disables the default Spring Boot error page.
6. Create Custom Error Page
src/main/resources/templates/error.html
Spring Boot automatically displays this page when an error occurs.
404.html
500.html
error.html7. Check Application Logs
Logs often contain the exact reason for the failure.
/api/orders/100
OrderNotFoundException
{
"message": "Order not found",
"status": 404
}
A concise interview answer is: The Whitelabel Error Page appears when Spring Boot encounters an error and no custom error handling is configured. It is commonly caused by incorrect URL mappings, missing views, or unhandled exceptions. It can be resolved by fixing controller mappings, implementing global exception handling using @ControllerAdvice, and creating custom error pages for better user experience.
Last updated: 11 November 2026
Previous question: Can we override or replace the Embedded Tomcat server in Spring Boot?
Next question: How can you implement pagination in a Spring Boot application?