<!doctype html><html lang=""en""><head><title>HTTP Status 404 โ Not Found</title><style type=""text/css"">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 404 โ Not Found</h1></body></html>
The “404 not found” error designates that the requested resource is not found on the server. This usually happens when the path or URL does not correspond to the valid address of the requested resource. Here are few solutions to address the issue:
- Check for typos, spellings ,extra spaces or missing components of the URL.
- If springBoot version is below 2.7.0 then set server.contextPath=/bookstore.
- sometimes server.contextPath does not support springBoot version below 2.7.0 so use
server.servlet.context-path=/bookstore - Ensure that when deploy Spring Boot application to a servlet container, the servlet container uses ServletInitializer which extends SpringBootServletInitializer class to configure the application context.
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(BookStoreApplication.class);
}
} - Verify that the application which is trying to access the resource, has the necessary permissions.