0
I am having problems with the Spring configuration of my Maven project, in which to test if everything was working, a simple hello world did not work and apparently there are no explicit errors, someone please save me there !
web xml.
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>yum-poc</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name> Spring MVC Dispatcher Servlet</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>5</session-timeout>
</session-config>
</web-app>
spring-context.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-4.0.xsd">
<context:component-scan base-package="br.com.poc.yum.controller" />
<mvc:annotation-driven />
<mvc:default-servlet-handler/>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/" />
<property name="suffix" value=".jsp" />
</bean>
</beans>
Olamundocontroller
package br.com.poc.yum.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class OlaMundoController {
@RequestMapping("/olaMundo")
public String olaMundo() {
System.out.println("Esta merda deu certo");
return "index";
}
}
tomcat log
out 02, 2018 1:12:22 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
ADVERTÊNCIA: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:yum-poc' did not find a matching property.
out 02, 2018 1:12:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Server version: Apache Tomcat/9.0.12
out 02, 2018 1:12:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Server built: Sep 4 2018 22:13:41 UTC
out 02, 2018 1:12:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Server number: 9.0.12.0
out 02, 2018 1:12:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: OS Name: Windows 10
out 02, 2018 1:12:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: OS Version: 10.0
out 02, 2018 1:12:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Architecture: amd64
out 02, 2018 1:12:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Java Home: C:\Program Files\Java\jre1.8.0_181
out 02, 2018 1:12:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: JVM Version: 1.8.0_181-b13
out 02, 2018 1:12:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: JVM Vendor: Oracle Corporation
out 02, 2018 1:12:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: CATALINA_BASE: C:\Users\guilh\Downloads\apache-tomcat-9.0.12
out 02, 2018 1:12:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: CATALINA_HOME: C:\Users\guilh\Downloads\apache-tomcat-9.0.12
out 02, 2018 1:12:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dcatalina.base=C:\Users\guilh\Downloads\apache-tomcat-9.0.12
out 02, 2018 1:12:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dcatalina.home=C:\Users\guilh\Downloads\apache-tomcat-9.0.12
out 02, 2018 1:12:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dwtp.deploy=C:\Users\guilh\Downloads\apache-tomcat-9.0.12\wtpwebapps
out 02, 2018 1:12:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Djava.endorsed.dirs=C:\Users\guilh\Downloads\apache-tomcat-9.0.12\endorsed
out 02, 2018 1:12:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dfile.encoding=Cp1252
out 02, 2018 1:12:23 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFORMAÇÕES: Loaded APR based Apache Tomcat Native library [1.2.17] using APR version [1.6.3].
out 02, 2018 1:12:23 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFORMAÇÕES: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
out 02, 2018 1:12:23 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFORMAÇÕES: APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
out 02, 2018 1:12:24 PM org.apache.catalina.core.AprLifecycleListener initializeSSL
INFORMAÇÕES: OpenSSL successfully initialized [OpenSSL 1.0.2o 27 Mar 2018]
out 02, 2018 1:12:24 PM org.apache.coyote.AbstractProtocol init
INFORMAÇÕES: Initializing ProtocolHandler ["http-nio-8080"]
out 02, 2018 1:12:24 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFORMAÇÕES: Using a shared selector for servlet write/read
out 02, 2018 1:12:24 PM org.apache.coyote.AbstractProtocol init
INFORMAÇÕES: Initializing ProtocolHandler ["ajp-nio-8009"]
out 02, 2018 1:12:24 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFORMAÇÕES: Using a shared selector for servlet write/read
out 02, 2018 1:12:24 PM org.apache.catalina.startup.Catalina load
INFORMAÇÕES: Initialization processed in 2885 ms
out 02, 2018 1:12:24 PM org.apache.catalina.core.StandardService startInternal
INFORMAÇÕES: Starting service [Catalina]
out 02, 2018 1:12:24 PM org.apache.catalina.core.StandardEngine startInternal
INFORMAÇÕES: Starting Servlet Engine: Apache Tomcat/9.0.12
out 02, 2018 1:12:37 PM org.apache.jasper.servlet.TldScanner scanJars
INFORMAÇÕES: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
out 02, 2018 1:12:37 PM org.apache.catalina.core.ApplicationContext log
INFORMAÇÕES: No Spring WebApplicationInitializer types detected on classpath
out 02, 2018 1:12:38 PM org.apache.catalina.core.ApplicationContext log
INFORMAÇÕES: Initializing Spring FrameworkServlet 'Spring MVC Dispatcher Servlet'
out 02, 2018 1:12:38 PM org.springframework.web.servlet.DispatcherServlet initServletBean
INFORMAÇÕES: FrameworkServlet 'Spring MVC Dispatcher Servlet': initialization started
out 02, 2018 1:12:38 PM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
INFORMAÇÕES: Refreshing WebApplicationContext for namespace 'Spring MVC Dispatcher Servlet-servlet': startup date [Tue Oct 02 13:12:38 BRT 2018]; root of context hierarchy
out 02, 2018 1:12:38 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFORMAÇÕES: Loading XML bean definitions from ServletContext resource [/WEB-INF/spring-context.xml]
out 02, 2018 1:12:40 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping register
INFORMAÇÕES: Mapped "{[/olaMundo]}" onto public java.lang.String br.com.poc.yum.controller.OlaMundoController.olaMundo()
out 02, 2018 1:12:40 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache
INFORMAÇÕES: Looking for @ControllerAdvice: WebApplicationContext for namespace 'Spring MVC Dispatcher Servlet-servlet': startup date [Tue Oct 02 13:12:38 BRT 2018]; root of context hierarchy
out 02, 2018 1:12:41 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache
INFORMAÇÕES: Looking for @ControllerAdvice: WebApplicationContext for namespace 'Spring MVC Dispatcher Servlet-servlet': startup date [Tue Oct 02 13:12:38 BRT 2018]; root of context hierarchy
out 02, 2018 1:12:41 PM org.springframework.web.servlet.handler.SimpleUrlHandlerMapping registerHandler
INFORMAÇÕES: Mapped URL path [/**] onto handler 'org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler#0'
out 02, 2018 1:12:41 PM org.springframework.web.servlet.DispatcherServlet initServletBean
INFORMAÇÕES: FrameworkServlet 'Spring MVC Dispatcher Servlet': initialization completed in 3265 ms
out 02, 2018 1:12:41 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deploying web application directory [C:\Users\guilh\Downloads\apache-tomcat-9.0.12\webapps\docs]
out 02, 2018 1:12:50 PM org.apache.jasper.servlet.TldScanner scanJars
INFORMAÇÕES: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
out 02, 2018 1:12:50 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deployment of web application directory [C:\Users\guilh\Downloads\apache-tomcat-9.0.12\webapps\docs] has finished in [8,977] ms
out 02, 2018 1:12:50 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deploying web application directory [C:\Users\guilh\Downloads\apache-tomcat-9.0.12\webapps\examples]
out 02, 2018 1:12:59 PM org.apache.jasper.servlet.TldScanner scanJars
INFORMAÇÕES: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
out 02, 2018 1:12:59 PM org.apache.catalina.core.ApplicationContext log
INFORMAÇÕES: ContextListener: contextInitialized()
out 02, 2018 1:12:59 PM org.apache.catalina.core.ApplicationContext log
INFORMAÇÕES: SessionListener: contextInitialized()
out 02, 2018 1:12:59 PM org.apache.catalina.core.ApplicationContext log
INFORMAÇÕES: ContextListener: attributeAdded('StockTicker', 'async.Stockticker@15a55f69')
out 02, 2018 1:12:59 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deployment of web application directory [C:\Users\guilh\Downloads\apache-tomcat-9.0.12\webapps\examples] has finished in [8,799] ms
out 02, 2018 1:12:59 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deploying web application directory [C:\Users\guilh\Downloads\apache-tomcat-9.0.12\webapps\host-manager]
out 02, 2018 1:13:06 PM org.apache.jasper.servlet.TldScanner scanJars
INFORMAÇÕES: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
out 02, 2018 1:13:06 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deployment of web application directory [C:\Users\guilh\Downloads\apache-tomcat-9.0.12\webapps\host-manager] has finished in [7,283] ms
out 02, 2018 1:13:06 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deploying web application directory [C:\Users\guilh\Downloads\apache-tomcat-9.0.12\webapps\manager]
out 02, 2018 1:13:13 PM org.apache.jasper.servlet.TldScanner scanJars
INFORMAÇÕES: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
out 02, 2018 1:13:13 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deployment of web application directory [C:\Users\guilh\Downloads\apache-tomcat-9.0.12\webapps\manager] has finished in [7,190] ms
out 02, 2018 1:13:13 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deploying web application directory [C:\Users\guilh\Downloads\apache-tomcat-9.0.12\webapps\ROOT]
out 02, 2018 1:13:21 PM org.apache.jasper.servlet.TldScanner scanJars
INFORMAÇÕES: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
out 02, 2018 1:13:21 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deployment of web application directory [C:\Users\guilh\Downloads\apache-tomcat-9.0.12\webapps\ROOT] has finished in [7,558] ms
out 02, 2018 1:13:21 PM org.apache.coyote.AbstractProtocol start
INFORMAÇÕES: Starting ProtocolHandler ["http-nio-8080"]
out 02, 2018 1:13:21 PM org.apache.coyote.AbstractProtocol start
INFORMAÇÕES: Starting ProtocolHandler ["ajp-nio-8009"]
out 02, 2018 1:13:21 PM org.apache.catalina.startup.Catalina start
INFORMAÇÕES: Server startup in 56626 ms
Some solutions have been tested as clean through the server, Maven and the project itself, also none of these worked, so I’m kind of lost.
Which url are you trying to access to test your Hello World?
– Giuliana Bezerra
http://localhost:8080/olaMundo
– Guilherme Raulino de Faria