title: How to resolve : "There was an unexpected error (type=Not Found, status=404)"
body: <p>I am launching a spring boot application with this controller</p>
  
  <pre><code>@RestController
  @RequestMapping({"/api"})
  public class ProduitImmobilierController {
  
      Logger logger = LoggerFactory.getLogger(ProduitImmobilierController.class);
  
      @Autowired
      private ProduitImmobilierService produitImmobilierService;
  
      @RequestMapping(value = "/produitimmobilier/all/{pageSize}/{page}",
      method = RequestMethod.GET,
      produces = {"text/plain;charset=UTF-8", MediaType.APPLICATION_JSON_VALUE},
      consumes = {"text/plain;charset=UTF-8", MediaType.APPLICATION_JSON_VALUE})
      public @ResponseBody List&lt;ProduitImmobilierDTO&gt; findAll(@PathVariable("pageSize") int pageSize, @PathVariable("page") int page){
          logger.info("CONTROLLER PRODUITIMMOBILIERSERVICE CA PASSE");
          return produitImmobilierService.findAll(pageSize, page);
      }
  </code></pre>
  
  <p>I check that the application is listening on port 8080
  I try to access this controller with this URL on firefox</p>
  
  <p><a href="http://localhost:8080/api/produitimmobilier/all/5/1" rel="nofollow noreferrer">http://localhost:8080/api/produitimmobilier/all/5/1</a></p>
  
  <p>And I get this error</p>
  
  <pre><code>Whitelabel Error Page
  
  This application has no explicit mapping for /error, so you are seeing this as a fallback.
  Wed Nov 13 20:48:53 CET 2019
  There was an unexpected error (type=Not Found, status=404).
  No message available
  </code></pre>
  
  <p>Here is the project tree</p>
  
  <p><a href="https://i.stack.imgur.com/iNBzP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iNBzP.png" alt="enter image description here"></a></p>
  
  <p>How can I resolve it?</p>
  
  <p>I add the pom.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;parent&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
          &lt;version&gt;2.1.9.RELEASE&lt;/version&gt;
          &lt;relativePath/&gt; &lt;!-- lookup parent from repository --&gt;
      &lt;/parent&gt;
      &lt;groupId&gt;com.example&lt;/groupId&gt;
      &lt;artifactId&gt;demoImmobilierBack&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;name&gt;demoImmobilierBack&lt;/name&gt;
      &lt;description&gt;Demo project for Spring Boot&lt;/description&gt;
  
      &lt;properties&gt;
          &lt;java.version&gt;1.8&lt;/java.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;mysql&lt;/groupId&gt;
              &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
              &lt;version&gt;8.0.17&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate.hql&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-hql-parser&lt;/artifactId&gt;
              &lt;version&gt;1.5.0.Final&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;!-- https://mvnrepository.com/artifact/javax.persistence/javax.persistence-api --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.persistence&lt;/groupId&gt;
              &lt;artifactId&gt;javax.persistence-api&lt;/artifactId&gt;
              &lt;version&gt;2.2&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-thymeleaf&lt;/artifactId&gt;
          &lt;/dependency&gt;   
          &lt;dependency&gt;
              &lt;groupId&gt;com.h2database&lt;/groupId&gt;
              &lt;artifactId&gt;h2&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
  &lt;!--            &lt;version&gt;1.4.194&lt;/version&gt; --&gt;
          &lt;/dependency&gt;   
          &lt;dependency&gt;
              &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;
              &lt;artifactId&gt;lombok&lt;/artifactId&gt;
              &lt;version&gt;1.18.10&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;       
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
      &lt;repositories&gt;
          &lt;repository&gt;
              &lt;id&gt;spring-releases&lt;/id&gt;
              &lt;name&gt;Spring Releases&lt;/name&gt;
              &lt;url&gt;https://repo.spring.io/libs-release&lt;/url&gt;
          &lt;/repository&gt;
          &lt;repository&gt;
              &lt;id&gt;org.jboss.repository.releases&lt;/id&gt;
              &lt;name&gt;JBoss Maven Release Repository&lt;/name&gt;
              &lt;url&gt;https://repository.jboss.org/nexus/content/repositories/releases&lt;/url&gt;
          &lt;/repository&gt;
      &lt;/repositories&gt;
  
      &lt;pluginRepositories&gt;
          &lt;pluginRepository&gt;
              &lt;id&gt;spring-releases&lt;/id&gt;
              &lt;name&gt;Spring Releases&lt;/name&gt;
              &lt;url&gt;https://repo.spring.io/libs-release&lt;/url&gt;
          &lt;/pluginRepository&gt;
      &lt;/pluginRepositories&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>When I hit the application with the url : <a href="http://localhost:8080/api/produitimmobilier/all/5/1" rel="nofollow noreferrer">http://localhost:8080/api/produitimmobilier/all/5/1</a></p>
  
  <pre><code>2019-11-14 12:20:58.770  INFO 2998 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
  2019-11-14 12:20:58.770  INFO 2998 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
  2019-11-14 12:20:58.787  INFO 2998 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 17 ms
  </code></pre>