title: Spring boot error 404
body: <p>I am studying Spring Mvc and Spring Boot and came across the following problem that until now could not identify. After running my main method I get the following message.</p>
  
  <p><strong>Whitelabel Error Page</strong></p>
  
  <p><strong>This application has no explicit mapping for /error, so you are seeing</strong> <strong>this as a fallback. Tue Jul 20 21:22:43 BRT 2016 There was an unexpected</strong> <strong>error (type=Not Found, status=404). No message available</strong></p>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>@Controller
  @RequestMapping(value="/restauranteWeb")
  public class HomeController {
  
      @RequestMapping(method=RequestMethod.GET)
      public String redirect() {
          return "login/login";
      }
  }
  </code></pre>
  
  <p><strong>Method Main</strong></p>
  
  <pre><code>@SpringBootApplication()
  public class Application {
      public static void main(String[] args) {
          SpringApplication.run(Application.class, args);
      }
  }
  </code></pre>
  
  <p><strong>Configuration</strong></p>
  
  <pre><code>@Configuration
  @EnableWebMvc
  @ComponentScan(basePackages = "com.gervasios.rsw")
  public class ApplicationConfiguration extends WebMvcConfigurerAdapter {
  
      @Override
      public void addResourceHandlers(ResourceHandlerRegistry registry) {
          registry.addResourceHandler("/resources/**").addResourceLocations("/resources/");
      }
  
      @Override
      public void configureViewResolvers(ViewResolverRegistry registry) {
          InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
          viewResolver.setViewClass(JstlView.class);
          viewResolver.setPrefix("/WEB-INF/pages/");
          viewResolver.setSuffix(".jsp");
          registry.viewResolver(viewResolver);
      }
  }
  
  @Bean
      public TilesConfigurer tilesConfigurer() {
          TilesConfigurer tilesConfigurer = new TilesConfigurer();
          tilesConfigurer.setDefinitions(new String[] {"/**/WEB-INF/**/tiles-config.xml"});
          tilesConfigurer.setCheckRefresh(true);
          return tilesConfigurer;
      }
  </code></pre>
  
  <p><strong>AppInitializer</strong></p>
  
  <pre><code>public class AppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
  
      @Override
      protected Class&lt;?&gt;[] getRootConfigClasses() {
          return new Class[] {ApplicationConfiguration.class};
      }
  
      @Override
      protected Class&lt;?&gt;[] getServletConfigClasses() {
          return new Class[0];
      }
  
      @Override
      protected String[] getServletMappings() {
          return new String[] {"/"};
      }
  
  }
  </code></pre>
  
  <p><strong>POM</strong></p>
  
  <pre><code>&lt;!-- Spring BOOT--&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;1.3.5.RELEASE&lt;/version&gt;
      &lt;/parent&gt;
  
      &lt;repositories&gt;
          &lt;repository&gt;
              &lt;id&gt;spring-snapshots&lt;/id&gt;
              &lt;url&gt;http://repo.spring.io/snapshot&lt;/url&gt;
              &lt;snapshots&gt;&lt;enabled&gt;true&lt;/enabled&gt;&lt;/snapshots&gt;
          &lt;/repository&gt;
          &lt;repository&gt;
              &lt;id&gt;spring-milestones&lt;/id&gt;
              &lt;url&gt;http://repo.spring.io/milestone&lt;/url&gt;
          &lt;/repository&gt;
      &lt;/repositories&gt;
  
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;spring.version&gt;4.2.5.RELEASE&lt;/spring.version&gt;          
          &lt;java.version&gt;1.8&lt;/java.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;!-- Spring --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter&lt;/artifactId&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-data-jpa&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-jdbc&lt;/artifactId&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-jdbc&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Javax - Jsf --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;jstl&lt;/artifactId&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;
  </code></pre>
  
  <p><strong>LOG localhost:8080/restauranteWeb</strong></p>
  
  <pre><code>  .   ____          _            __ _ _
   /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
  ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
   \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
    '  |____| .__|_| |_|_| |_\__, | / / / /
   =========|_|==============|___/=/_/_/_/
   :: Spring Boot ::        (v1.3.5.RELEASE)
  
  2016-07-21 22:24:17.632  INFO 4576 --- [           main] c.g.r.configuration.ApplicationExecute   : Starting ApplicationExecute on Helio-PC with PID 4576 (C:\Users\Helio\git\restauranteWeb\restauranteWeb\target\classes started by Helio in C:\Users\Helio\git\restauranteWeb\restauranteWeb)
  2016-07-21 22:24:17.632  INFO 4576 --- [           main] c.g.r.configuration.ApplicationExecute   : No active profile set, falling back to default profiles: default
  2016-07-21 22:24:17.695  INFO 4576 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@1f32bf7: startup date [Thu Jul 21 22:24:17 BRT 2016]; root of context hierarchy
  2016-07-21 22:24:19.433  INFO 4576 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$1e356ee6] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
  2016-07-21 22:24:20.124  INFO 4576 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
  2016-07-21 22:24:20.139  INFO 4576 --- [           main] o.apache.catalina.core.StandardService   : Starting service Tomcat
  2016-07-21 22:24:20.155  INFO 4576 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.0.33
  2016-07-21 22:24:20.358  INFO 4576 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
  2016-07-21 22:24:20.358  INFO 4576 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2663 ms
  2016-07-21 22:24:20.514  INFO 4576 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean        : Mapping servlet: 'dispatcherServlet' to [/]
  2016-07-21 22:24:20.530  INFO 4576 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'characterEncodingFilter' to: [/*]
  2016-07-21 22:24:20.612  INFO 4576 --- [           main] o.s.j.d.DriverManagerDataSource          : Loaded JDBC driver: com.mysql.jdbc.Driver
  2016-07-21 22:24:21.020  INFO 4576 --- [           main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
  2016-07-21 22:24:21.036  INFO 4576 --- [           main] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [
      name: default
      ...]
  2016-07-21 22:24:21.129  INFO 4576 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate Core {4.3.11.Final}
  2016-07-21 22:24:21.129  INFO 4576 --- [           main] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
  2016-07-21 22:24:21.129  INFO 4576 --- [           main] org.hibernate.cfg.Environment            : HHH000021: Bytecode provider name : javassist
  2016-07-21 22:24:21.348  INFO 4576 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
  2016-07-21 22:24:21.426  INFO 4576 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
  2016-07-21 22:24:21.489  INFO 4576 --- [           main] o.h.h.i.ast.ASTQueryTranslatorFactory    : HHH000397: Using ASTQueryTranslatorFactory
  2016-07-21 22:24:21.801  INFO 4576 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
  2016-07-21 22:24:21.913  INFO 4576 --- [           main] o.h.e.t.i.TransactionFactoryInitiator    : HHH000399: Using default transaction strategy (direct JDBC transactions)
  2016-07-21 22:24:21.913  INFO 4576 --- [           main] o.h.h.i.ast.ASTQueryTranslatorFactory    : HHH000397: Using ASTQueryTranslatorFactory
  2016-07-21 22:24:22.100  INFO 4576 --- [           main] org.hibernate.tool.hbm2ddl.SchemaUpdate  : HHH000228: Running hbm2ddl schema update
  2016-07-21 22:24:22.100  INFO 4576 --- [           main] org.hibernate.tool.hbm2ddl.SchemaUpdate  : HHH000102: Fetching database metadata
  2016-07-21 22:24:22.116  INFO 4576 --- [           main] org.hibernate.tool.hbm2ddl.SchemaUpdate  : HHH000396: Updating schema
  2016-07-21 22:24:22.116  INFO 4576 --- [           main] java.sql.DatabaseMetaData                : HHH000262: Table not found: RESADM.TUSUARIO
  2016-07-21 22:24:22.116  INFO 4576 --- [           main] java.sql.DatabaseMetaData                : HHH000262: Table not found: RESADM.TUSUARIO
  2016-07-21 22:24:22.116  INFO 4576 --- [           main] java.sql.DatabaseMetaData                : HHH000262: Table not found: RESADM.TUSUARIO
  2016-07-21 22:24:22.131 ERROR 4576 --- [           main] org.hibernate.tool.hbm2ddl.SchemaUpdate  : HHH000388: Unsuccessful: create table RESADM.TUSUARIO (CODUSUARIO bigint not null auto_increment, DATCAD datetime, LOGIN varchar(255), SENHA varchar(255), SITUACAO varchar(255), primary key (CODUSUARIO))
  2016-07-21 22:24:22.131 ERROR 4576 --- [           main] org.hibernate.tool.hbm2ddl.SchemaUpdate  : Table 'tusuario' already exists
  2016-07-21 22:24:22.131  INFO 4576 --- [           main] org.hibernate.tool.hbm2ddl.SchemaUpdate  : HHH000232: Schema update complete
  2016-07-21 22:24:22.392  INFO 4576 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/restauranteWeb],methods=[GET]}" onto public java.lang.String com.gervasios.rsw.controller.HomeController.redirect()
  2016-07-21 22:24:22.408  INFO 4576 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/principal],methods=[GET]}" onto public java.lang.String com.gervasios.rsw.controller.PrincipalController.principal()
  2016-07-21 22:24:22.408  INFO 4576 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/cadastroUsuario],methods=[GET]}" onto public java.lang.String com.gervasios.rsw.controller.UsuarioController.newUser(org.springframework.ui.Model)
  2016-07-21 22:24:22.408  INFO 4576 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/cadastrarUsuario],methods=[POST]}" onto public java.lang.String com.gervasios.rsw.controller.UsuarioController.salvar(com.gervasios.rsw.model.Usuario,org.springframework.ui.ModelMap)
  2016-07-21 22:24:22.408  INFO 4576 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/usuariosSearch],methods=[GET]}" onto public void com.gervasios.rsw.controller.UsuarioController.buscarUsuarios(org.springframework.ui.Model)
  2016-07-21 22:24:22.408  INFO 4576 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity&lt;java.util.Map&lt;java.lang.String, java.lang.Object&gt;&gt; org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
  2016-07-21 22:24:22.408  INFO 4576 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
  2016-07-21 22:24:22.439  INFO 4576 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/resources/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
  2016-07-21 22:24:22.533  INFO 4576 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@1f32bf7: startup date [Thu Jul 21 22:24:17 BRT 2016]; root of context hierarchy
  2016-07-21 22:24:22.611  INFO 4576 --- [           main] o.s.o.h.HibernateTransactionManager      : Using DataSource [org.springframework.jdbc.datasource.DriverManagerDataSource@1edc703] of Hibernate SessionFactory for HibernateTransactionManager
  2016-07-21 22:24:23.048  INFO 4576 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
  2016-07-21 22:24:23.159  INFO 4576 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
  2016-07-21 22:24:23.159  INFO 4576 --- [           main] c.g.r.configuration.ApplicationExecute   : Started ApplicationExecute in 5.949 seconds (JVM running for 6.325)
  2016-07-21 22:24:54.039  INFO 4576 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring FrameworkServlet 'dispatcherServlet'
  2016-07-21 22:24:54.039  INFO 4576 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization started
  2016-07-21 22:24:54.073  INFO 4576 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization completed in 34 ms
  2016-07-21 22:24:54.198  WARN 4576 --- [nio-8080-exec-1] o.s.web.servlet.PageNotFound             : No mapping found for HTTP request with URI [/WEB-INF/pages/login/login.jsp] in DispatcherServlet with name 'dispatcherServlet'
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/jX2nL.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jX2nL.jpg" alt="Structure my page"></a></p>