2
Does not find the uris that I type, always gives the same error, I have remade and still the error persists.
Follows the relevant classes and files.
relevant part of pom.xml
<build>
<finalName>Milicia</finalName>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.1.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jstl-impl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-servlet-api</artifactId>
<version>7.0.30</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-orm -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.6.2</version><!--$NO-MVN-MAN-VER$ -->
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-validator -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-annotations -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.5.6-Final</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.hibernate.javax.persistence/hibernate-jpa-2.0-api -->
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.0.final</version>
</dependency>
<!-- https://mvnrepository.com/artifact/jstl/jstl -->
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
Class that configures scan packets
package br.com.finger.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
@Configuration
@EnableWebMvc
@ComponentScan(basePackages = { "br.com.finger.controller.*", "br.com.finger.utils.*" })
public class AppWebApplication{
@Bean
public ViewResolver viewResolver() {
InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
return viewResolver;
}
}
Class that configures Servlet
package br.com.finger.config;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
public class ServletSpringMVC extends AbstractAnnotationConfigDispatcherServletInitializer{
@Override
protected Class<?>[] getRootConfigClasses() {
return new Class[] {};
}
@Override
protected Class<?>[] getServletConfigClasses() {
return new Class[] {
AppWebApplication.class,
JPAConfiguration.class
};
}
@Override
protected String[] getServletMappings() {
return new String[]{"/*"};
}
}
When I raise Tomcat no error, when I call any Address the following warn
16:31:47.562 [http-nio-8080-exec-4] DEBUG org.springframework.web.servlet.DispatcherServlet - DispatcherServlet with name 'dispatcher' processing GET request for [/Milicia]
16:31:47.568 [http-nio-8080-exec-4] DEBUG org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Looking up handler method for path /
16:31:47.569 [http-nio-8080-exec-4] DEBUG org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Did not find handler method for [/]
16:31:47.571 [http-nio-8080-exec-4] WARN org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/Milicia] in DispatcherServlet with name 'dispatcher'
16:31:47.571 [http-nio-8080-exec-4] DEBUG org.springframework.web.servlet.DispatcherServlet - Successfully completed request
Login Controller Class... That States Mentioned
@Controller
@Transactional
public class LoginController {
private LoginHelper helper;
@Autowired
public LoginController(LoginHelper loginHelper) {
this.helper = loginHelper;
}
//MAPEIA A ENTRADA PRINCIPAL DO SITE, TODOS AS PAGINAS
//QUE NÃO TIVER SESSÃO LOGADA, VAI REDIRECIONAR PARA AQUI.
@RequestMapping("/login")
public String pageLogin(ErroLogin erro, HttpSession session){
// se já tiver uma session rolando, vai para o dashboard
if(session.getAttribute("user") != null){
return "dashboard";
}
if(erro.isPassword()){
//pinta o campo de senha de vermelho
}
if(erro.isUsername()){
//pinta o campo de usuario de vermelho
}
//depois de tudo SEMPRE retorna a pagina de login
return "/WEB-INF/VIEWS/pages-login.jsp";
}
yes, more where is the error? the settings are all right... I think, this is the doubt
– Renato Vieira Dantas
In fact he is finding the "joker" mapping of "/*. but has no method to do the treatment. 16:31:47.569 [http-nio-8080-exec-4] DEBUG org.springframework.web.servlet.mvc.method.Annotation.Requestmappinghandlermapping - Did not find Handler method for [/] Where are you mapping the method to do the treatment?
– Vinicius Falcão
I put in the post the controller class.
– Renato Vieira Dantas
I know it’s the "/login", but even doing /login it still gives exactly the same error.
– Renato Vieira Dantas
Dude, is there a guy to handle the /Milicia or "/*" request? Because the code you posted only has the /Login mapping
– Vinicius Falcão
I took it, but there, the "/Milicia" is the name of the project...
– Renato Vieira Dantas