I'm aware there are a bunch of topics with same issues, but after 3 days researching I couldn't solve my problem.
If anyone spot the answer somewhere else, please feel free to mark this as duplicate and lead me there.
I'm trying to map a request in my Controller and then redirect to a subfolder under my default view folder. However, I'm getting a 404 error.
My web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name>SIGCOM</display-name>
<servlet>
<servlet-name>springController</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springController</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/springController.xml</param-value>
</context-param>
<filter>
<filter-name>SpringFilter</filter-name>
<filter-class>br.com.sigcom.filter.SpringFilter</filter-class>
<init-param>
<param-name>requestEncoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>SpringFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!--
<listener>
<listener-class>br.com.sigcom.listener.SpringListener</listener-class>
</listener>
-->
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/WebContent/WEB-INF/views/errorHandling/errorPage.jsp</location>
</error-page>
<error-page>
<!-- Missing resource -->
<error-code>404</error-code>
<location>/WebContent/WEB-INF/views/errorHandling/error404.jsp</location>
</error-page>
</web-app>
My servlet 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:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task.xsd">
<context:component-scan base-package="br.com.sigcom.controller" />
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/" />
<property name="suffix" value=".jsp" />
</bean>
<mvc:annotation-driven />
<mvc:resources mapping="/resources/**" location="/resources/" cache-period="31556926" />
</beans>
As you see, my default views folder is WEB-INF/views. So far so good. I made a subfolder like this:
WEB-INF/
|-views/
|-admin/
|-default.jsp
In my Controller, I can't access WEB-INF/views/admin/default.jsp, for I get this 404 error.
My Controller:
package br.com.sigcom.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
#Controller
public class SpringController {
#RequestMapping(value = {"", "/", "home", "default", "index"})
public String redirectDefaultPage() {
return "default";
}
#RequestMapping("admin")
public String redirectAdminPage() {
return "admin/default";
}
}
I tried a lot, searched a lot, however without success. I know this must be a simple detail, but I'm exhausted. Thank you in advance!
PS.: my console:
mai 02, 2017 9:36:23 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:SIGCOM' did not find a matching property.
mai 02, 2017 9:36:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Server version: Apache Tomcat/8.0.43
mai 02, 2017 9:36:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Server built: Mar 28 2017 14:42:59 UTC
mai 02, 2017 9:36:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Server number: 8.0.43.0
mai 02, 2017 9:36:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: OS Name: Windows 8.1
mai 02, 2017 9:36:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: OS Version: 6.3
mai 02, 2017 9:36:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Architecture: amd64
mai 02, 2017 9:36:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Java Home: C:\Program Files (x86)\Java
mai 02, 2017 9:36:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: JVM Version: 1.8.0_131-b11
mai 02, 2017 9:36:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: JVM Vendor: Oracle Corporation
mai 02, 2017 9:36:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: CATALINA_BASE: C:\morais_san\Development\Tomcat\apache-tomcat-8.0.43
mai 02, 2017 9:36:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: CATALINA_HOME: C:\morais_san\Development\Tomcat\apache-tomcat-8.0.43
mai 02, 2017 9:36:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dcatalina.base=C:\morais_san\Development\Tomcat\apache-tomcat-8.0.43
mai 02, 2017 9:36:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dcatalina.home=C:\morais_san\Development\Tomcat\apache-tomcat-8.0.43
mai 02, 2017 9:36:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dwtp.deploy=C:\morais_san\Development\Tomcat\apache-tomcat-8.0.43\wtpwebapps
mai 02, 2017 9:36:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Djava.endorsed.dirs=C:\morais_san\Development\Tomcat\apache-tomcat-8.0.43\endorsed
mai 02, 2017 9:36:23 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dfile.encoding=Cp1252
mai 02, 2017 9:36:23 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFORMAÇÕES: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files (x86)\Java\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files (x86)/Java/bin/server;C:/Program Files (x86)/Java/bin;C:/Program Files (x86)/Java/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\Intel\Shared Files\cpp\bin\Intel64;C:\Program Files (x86)\Borland\Delphi7\Bin;C:\Program Files (x86)\Borland\Delphi7\Projects\Bpl\;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;c:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\MySQL\MySQL Utilities 1.6\;C:\Arquivos de programas\Borland\Delphi7\Projects\Bpl;C:\morais_san\Development\Delphi\Repository\Components\JVCL3.33\jcl;C:\morais_san\Development\Java\Maven\apache-maven-3.5.0\bin;C:\morais_san\Development\Eclipse\eclipse-jee-neon-R-win32-x86_64\eclipse;;.
mai 02, 2017 9:36:23 PM org.apache.coyote.AbstractProtocol init
INFORMAÇÕES: Initializing ProtocolHandler ["http-nio-8080"]
mai 02, 2017 9:36:23 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFORMAÇÕES: Using a shared selector for servlet write/read
mai 02, 2017 9:36:23 PM org.apache.coyote.AbstractProtocol init
INFORMAÇÕES: Initializing ProtocolHandler ["ajp-nio-8009"]
mai 02, 2017 9:36:23 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFORMAÇÕES: Using a shared selector for servlet write/read
mai 02, 2017 9:36:23 PM org.apache.catalina.startup.Catalina load
INFORMAÇÕES: Initialization processed in 982 ms
mai 02, 2017 9:36:23 PM org.apache.catalina.core.StandardService startInternal
INFORMAÇÕES: Starting service Catalina
mai 02, 2017 9:36:23 PM org.apache.catalina.core.StandardEngine startInternal
INFORMAÇÕES: Starting Servlet Engine: Apache Tomcat/8.0.43
mai 02, 2017 9:36:25 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.
mai 02, 2017 9:36:26 PM org.apache.catalina.core.ApplicationContext log
INFORMAÇÕES: No Spring WebApplicationInitializer types detected on classpath
mai 02, 2017 9:36:26 PM org.apache.catalina.core.ApplicationContext log
INFORMAÇÕES: Initializing Spring FrameworkServlet 'springController'
mai 02, 2017 9:36:26 PM org.springframework.web.servlet.DispatcherServlet initServletBean
INFORMAÇÕES: FrameworkServlet 'springController': initialization started
mai 02, 2017 9:36:26 PM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
INFORMAÇÕES: Refreshing WebApplicationContext for namespace 'springController-servlet': startup date [Tue May 02 21:36:26 BRT 2017]; root of context hierarchy
mai 02, 2017 9:36:26 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFORMAÇÕES: Loading XML bean definitions from ServletContext resource [/WEB-INF/springController-servlet.xml]
mai 02, 2017 9:36:28 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping register
INFORMAÇÕES: Mapped "{[/search],methods=[GET]}" onto public java.lang.String br.com.sigcom.controller.SearchController.redirectSearchPage()
mai 02, 2017 9:36:28 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping register
INFORMAÇÕES: Mapped "{[/admin]}" onto public java.lang.String br.com.sigcom.controller.SpringController.redirectAdminPage()
mai 02, 2017 9:36:28 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping register
INFORMAÇÕES: Mapped "{[ || / || /home || /default || /index]}" onto public java.lang.String br.com.sigcom.controller.SpringController.redirectDefaultPage()
mai 02, 2017 9:36:28 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache
INFORMAÇÕES: Looking for #ControllerAdvice: WebApplicationContext for namespace 'springController-servlet': startup date [Tue May 02 21:36:26 BRT 2017]; root of context hierarchy
mai 02, 2017 9:36:28 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache
INFORMAÇÕES: Looking for #ControllerAdvice: WebApplicationContext for namespace 'springController-servlet': startup date [Tue May 02 21:36:26 BRT 2017]; root of context hierarchy
mai 02, 2017 9:36:28 PM org.springframework.web.servlet.handler.SimpleUrlHandlerMapping registerHandler
INFORMAÇÕES: Mapped URL path [/resources/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0'
mai 02, 2017 9:36:28 PM org.springframework.web.servlet.DispatcherServlet initServletBean
INFORMAÇÕES: FrameworkServlet 'springController': initialization completed in 2250 ms
mai 02, 2017 9:36:28 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deploying web application directory C:\morais_san\Development\Tomcat\apache-tomcat-8.0.43\webapps\docs
mai 02, 2017 9:36:28 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deployment of web application directory C:\morais_san\Development\Tomcat\apache-tomcat-8.0.43\webapps\docs has finished in 35 ms
mai 02, 2017 9:36:28 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deploying web application directory C:\morais_san\Development\Tomcat\apache-tomcat-8.0.43\webapps\examples
mai 02, 2017 9:36:29 PM org.apache.catalina.core.ApplicationContext log
INFORMAÇÕES: ContextListener: contextInitialized()
mai 02, 2017 9:36:29 PM org.apache.catalina.core.ApplicationContext log
INFORMAÇÕES: SessionListener: contextInitialized()
mai 02, 2017 9:36:29 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deployment of web application directory C:\morais_san\Development\Tomcat\apache-tomcat-8.0.43\webapps\examples has finished in 456 ms
mai 02, 2017 9:36:29 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deploying web application directory C:\morais_san\Development\Tomcat\apache-tomcat-8.0.43\webapps\host-manager
mai 02, 2017 9:36:29 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deployment of web application directory C:\morais_san\Development\Tomcat\apache-tomcat-8.0.43\webapps\host-manager has finished in 45 ms
mai 02, 2017 9:36:29 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deploying web application directory C:\morais_san\Development\Tomcat\apache-tomcat-8.0.43\webapps\manager
mai 02, 2017 9:36:29 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deployment of web application directory C:\morais_san\Development\Tomcat\apache-tomcat-8.0.43\webapps\manager has finished in 44 ms
mai 02, 2017 9:36:29 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deploying web application directory C:\morais_san\Development\Tomcat\apache-tomcat-8.0.43\webapps\ROOT
mai 02, 2017 9:36:29 PM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAÇÕES: Deployment of web application directory C:\morais_san\Development\Tomcat\apache-tomcat-8.0.43\webapps\ROOT has finished in 32 ms
mai 02, 2017 9:36:29 PM org.apache.coyote.AbstractProtocol start
INFORMAÇÕES: Starting ProtocolHandler ["http-nio-8080"]
mai 02, 2017 9:36:29 PM org.apache.coyote.AbstractProtocol start
INFORMAÇÕES: Starting ProtocolHandler ["ajp-nio-8009"]
mai 02, 2017 9:36:29 PM org.apache.catalina.startup.Catalina start
INFORMAÇÕES: Server startup in 5763 ms
mai 02, 2017 9:59:25 PM org.apache.catalina.core.StandardContext reload
INFORMAÇÕES: Reloading Context with name [/SIGCOM] has started
mai 02, 2017 9:59:25 PM org.apache.catalina.core.ApplicationContext log
INFORMAÇÕES: Destroying Spring FrameworkServlet 'springController'
mai 02, 2017 9:59:25 PM org.springframework.web.context.support.XmlWebApplicationContext doClose
INFORMAÇÕES: Closing WebApplicationContext for namespace 'springController-servlet': startup date [Tue May 02 21:36:26 BRT 2017]; root of context hierarchy
mai 02, 2017 9:59:27 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.
mai 02, 2017 9:59:27 PM org.apache.catalina.core.ApplicationContext log
INFORMAÇÕES: No Spring WebApplicationInitializer types detected on classpath
mai 02, 2017 9:59:27 PM org.apache.catalina.core.ApplicationContext log
INFORMAÇÕES: Initializing Spring FrameworkServlet 'springController'
mai 02, 2017 9:59:27 PM org.springframework.web.servlet.DispatcherServlet initServletBean
INFORMAÇÕES: FrameworkServlet 'springController': initialization started
mai 02, 2017 9:59:27 PM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
INFORMAÇÕES: Refreshing WebApplicationContext for namespace 'springController-servlet': startup date [Tue May 02 21:59:27 BRT 2017]; root of context hierarchy
mai 02, 2017 9:59:27 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFORMAÇÕES: Loading XML bean definitions from ServletContext resource [/WEB-INF/springController-servlet.xml]
mai 02, 2017 9:59:28 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping register
INFORMAÇÕES: Mapped "{[/search],methods=[GET]}" onto public java.lang.String br.com.sigcom.controller.SearchController.redirectSearchPage()
mai 02, 2017 9:59:28 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping register
INFORMAÇÕES: Mapped "{[/admin]}" onto public java.lang.String br.com.sigcom.controller.SpringController.redirectAdminPage()
mai 02, 2017 9:59:28 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping register
INFORMAÇÕES: Mapped "{[ || / || /home || /default || /index]}" onto public java.lang.String br.com.sigcom.controller.SpringController.redirectDefaultPage()
mai 02, 2017 9:59:28 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache
INFORMAÇÕES: Looking for #ControllerAdvice: WebApplicationContext for namespace 'springController-servlet': startup date [Tue May 02 21:59:27 BRT 2017]; root of context hierarchy
mai 02, 2017 9:59:28 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache
INFORMAÇÕES: Looking for #ControllerAdvice: WebApplicationContext for namespace 'springController-servlet': startup date [Tue May 02 21:59:27 BRT 2017]; root of context hierarchy
mai 02, 2017 9:59:28 PM org.springframework.web.servlet.handler.SimpleUrlHandlerMapping registerHandler
INFORMAÇÕES: Mapped URL path [/resources/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0'
mai 02, 2017 9:59:28 PM org.springframework.web.servlet.DispatcherServlet initServletBean
INFORMAÇÕES: FrameworkServlet 'springController': initialization completed in 1456 ms
mai 02, 2017 9:59:28 PM org.apache.catalina.core.StandardContext reload
INFORMAÇÕES: Reloading Context with name [/SIGCOM] is completed
I've tried setup a project with the same setting you had except there is no filter, filter-mapping, error-page, listener in the web.xml and I'm able to access the access the URL without 404.
The controller is able to resolve the template as well.
Did you enter your URL correctly with the context path as well?
e.g. http://localhost:8080/SIGCOM/admin
I've create a new project with your code. But at last, i get the right thing. Maybe you can check you url like first floor says.
SOLVED. As you guys runned without filter, I've commented mine and worked. Now I know what to do. Appreciate your your help, guys!
Related
dynamic web module version
StackTrace:
Nov 30, 2015 8:44:53 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:QuoteBuilderAdmin' did not find a matching property.
Nov 30, 2015 8:44:53 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/8.0.28
Nov 30, 2015 8:44:53 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Oct 7 2015 18:25:21 UTC
Nov 30, 2015 8:44:53 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 8.0.28.0
Nov 30, 2015 8:44:53 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 8.1
Nov 30, 2015 8:44:53 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 6.3
Nov 30, 2015 8:44:53 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
Nov 30, 2015 8:44:53 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: C:\Program Files\Java\jre1.8.0_51
Nov 30, 2015 8:44:53 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.8.0_51-b16
Nov 30, 2015 8:44:53 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
Nov 30, 2015 8:44:53 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: D:\Balvinder\balvinder\Quote builder\apache-tomcat-8.0.28
Nov 30, 2015 8:44:53 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: D:\Balvinder\balvinder\Quote builder\apache-tomcat-8.0.28
Nov 30, 2015 8:44:53 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=D:\Balvinder\balvinder\Quote builder\apache-tomcat-8.0.28
Nov 30, 2015 8:44:53 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=D:\Balvinder\balvinder\Quote builder\apache-tomcat-8.0.28
Nov 30, 2015 8:44:53 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=D:\Balvinder\balvinder\Quote builder\apache-tomcat-8.0.28\wtpwebapps
Nov 30, 2015 8:44:53 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=D:\Balvinder\balvinder\Quote builder\apache-tomcat-8.0.28\endorsed
Nov 30, 2015 8:44:53 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1252
Nov 30, 2015 8:44:53 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.8.0_51\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre1.8.0_51/bin/server;C:/Program Files/Java/jre1.8.0_51/bin;C:/Program Files/Java/jre1.8.0_51/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Broadcom\Broadcom 802.11;;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Hewlett-Packard\SimplePass\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\TortoiseSVN\bin;D:\Balvinder\software\eclipse;;.
Nov 30, 2015 8:44:54 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
Nov 30, 2015 8:44:54 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Nov 30, 2015 8:44:54 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
Nov 30, 2015 8:44:54 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Nov 30, 2015 8:44:54 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1111 ms
Nov 30, 2015 8:44:54 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Nov 30, 2015 8:44:54 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.0.28
Nov 30, 2015 8:44:57 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: 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.
Nov 30, 2015 8:44:57 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Nov 30, 2015 8:44:57 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
Nov 30, 2015 8:44:57 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Mon Nov 30 20:44:57 IST 2015]; root of context hierarchy
Nov 30, 2015 8:44:57 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/spring-dispatcher-servlet.xml]
Nov 30, 2015 8:44:58 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#3cd78871: defining beans [login,user,messageSource,viewResolver]; root of factory hierarchy
Nov 30, 2015 8:44:58 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 619 ms
Nov 30, 2015 8:44:58 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory D:\Balvinder\balvinder\Quote builder\apache-tomcat-8.0.28\webapps\docs
Nov 30, 2015 8:44:58 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory D:\Balvinder\balvinder\Quote builder\apache-tomcat-8.0.28\webapps\docs has finished in 30 ms
Nov 30, 2015 8:44:58 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory D:\Balvinder\balvinder\Quote builder\apache-tomcat-8.0.28\webapps\examples
Nov 30, 2015 8:44:58 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Nov 30, 2015 8:44:58 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Nov 30, 2015 8:44:58 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory D:\Balvinder\balvinder\Quote builder\apache-tomcat-8.0.28\webapps\examples has finished in 345 ms
Nov 30, 2015 8:44:58 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory D:\Balvinder\balvinder\Quote builder\apache-tomcat-8.0.28\webapps\host-manager
Nov 30, 2015 8:44:58 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory D:\Balvinder\balvinder\Quote builder\apache-tomcat-8.0.28\webapps\host-manager has finished in 40 ms
Nov 30, 2015 8:44:58 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory D:\Balvinder\balvinder\Quote builder\apache-tomcat-8.0.28\webapps\manager
Nov 30, 2015 8:44:58 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory D:\Balvinder\balvinder\Quote builder\apache-tomcat-8.0.28\webapps\manager has finished in 33 ms
Nov 30, 2015 8:44:58 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory D:\Balvinder\balvinder\Quote builder\apache-tomcat-8.0.28\webapps\ROOT
Nov 30, 2015 8:44:58 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory D:\Balvinder\balvinder\Quote builder\apache-tomcat-8.0.28\webapps\ROOT has finished in 23 ms
Nov 30, 2015 8:44:58 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
Nov 30, 2015 8:44:58 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8009"]
Nov 30, 2015 8:44:58 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 4546 ms
Nov 30, 2015 8:45:06 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'spring-dispatcher'
Nov 30, 2015 8:45:06 PM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet 'spring-dispatcher': initialization started
Nov 30, 2015 8:45:06 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing WebApplicationContext for namespace 'spring-dispatcher-servlet': startup date [Mon Nov 30 20:45:06 IST 2015]; parent: Root WebApplicationContext
Nov 30, 2015 8:45:06 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/spring-dispatcher-servlet.xml]
Nov 30, 2015 8:45:06 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#3ac24067: defining beans [login,user,messageSource,viewResolver]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory#3cd78871
Nov 30, 2015 8:45:06 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/login] onto handler 'login'
Nov 30, 2015 8:45:06 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/login.*] onto handler 'login'
Nov 30, 2015 8:45:06 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/login/] onto handler 'login'
Nov 30, 2015 8:45:06 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/changePasswordRequest] onto handler 'login'
Nov 30, 2015 8:45:06 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/changePasswordRequest.*] onto handler 'login'
Nov 30, 2015 8:45:06 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/changePasswordRequest/] onto handler 'login'
Nov 30, 2015 8:45:06 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/resetPasswordSendMail] onto handler 'login'
Nov 30, 2015 8:45:06 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/resetPasswordSendMail.*] onto handler 'login'
Nov 30, 2015 8:45:06 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/resetPasswordSendMail/] onto handler 'login'
Nov 30, 2015 8:45:06 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/changePassword] onto handler 'login'
Nov 30, 2015 8:45:06 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/changePassword.*] onto handler 'login'
Nov 30, 2015 8:45:06 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/changePassword/] onto handler 'login'
Nov 30, 2015 8:45:06 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/logOutPage] onto handler 'login'
Nov 30, 2015 8:45:06 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/logOutPage.*] onto handler 'login'
Nov 30, 2015 8:45:06 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/logOutPage/] onto handler 'login'
Nov 30, 2015 8:45:06 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/resetPassword] onto handler 'login'
Nov 30, 2015 8:45:06 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/resetPassword.*] onto handler 'login'
Nov 30, 2015 8:45:06 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/resetPassword/] onto handler 'login'
Nov 30, 2015 8:45:06 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/editUser] onto handler 'user'
Nov 30, 2015 8:45:06 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/editUser.*] onto handler 'user'
Nov 30, 2015 8:45:06 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/editUser/] onto handler 'user'
Nov 30, 2015 8:45:06 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/CreateUser] onto handler 'user'
Nov 30, 2015 8:45:06 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/CreateUser.*] onto handler 'user'
Nov 30, 2015 8:45:06 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/CreateUser/] onto handler 'user'
Nov 30, 2015 8:45:06 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/saveUser] onto handler 'user'
Nov 30, 2015 8:45:06 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/saveUser.*] onto handler 'user'
Nov 30, 2015 8:45:06 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/saveUser/] onto handler 'user'
Nov 30, 2015 8:45:06 PM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet 'spring-dispatcher': initialization completed in 177 ms
Nov 30, 2015 8:45:06 PM org.springframework.web.servlet.DispatcherServlet noHandlerFound
WARNING: No mapping found for HTTP request with URI [/QuoteBuilderAdmin/] in DispatcherServlet with name 'spring-dispatcher'
My code is
Web.xml:
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<display-name>Archetype Created Web Application</display-name>
<servlet>
<servlet-name>spring-dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
</servlet>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-dispatcher-servlet.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet-mapping>
<servlet-name>spring-dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.css</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.js</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.gif</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.jpg</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.png</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>/WEB-INF/index.jsp</welcome-file>
</welcome-file-list>
And pom.xml is
<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 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.logiquebrain</groupId>
<artifactId>QuoteBuilderAdmin</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>QuoteBuilderAdmin Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.0.7.RELEASE</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.37</version>
</dependency>
<!-- Hibernate core -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.0.2.Final</version>
</dependency>
<!-- optional -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-osgi</artifactId>
<version>5.0.2.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-envers</artifactId>
<version>5.0.2.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>5.0.2.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-proxool</artifactId>
<version>5.0.2.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-infinispan</artifactId>
<version>5.0.2.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>5.0.2.Final</version>
</dependency>
</dependencies>
<build>
<finalName>QuoteBuilderAdmin</finalName>
</build>
And spring-servlet.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"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="login" class="controller.LoginController" />
<bean id="user" class="controller.UserController" />
<bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basenames" value="WEB-INF/properties/messages" />
</bean>
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/jsp/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
I am using tomcat 8.0.
while compiling i am getting the following error:
I am getting error as(In problems: 2 error)enter image description here:
- Description Resource Path Location Type JavaServer Faces 1.2 can not
be installed : One or more constraints have not been
satisfied. QuoteBuilderAdmin line 1 Maven Java EE Configuration
Problem
- Description Resource Path Location Type JavaServer Faces 1.2 requires
Dynamic Web Module 2.5 or newer. QuoteBuilderAdmin line 1 Maven Java
EE Configuration Problem
Please help me to run my project.
Thanks in advance.
I know there are millions of possible solutions to this, and I tried many of them, but still no benefit at all.
I am trying to map a basic controller to a url and returning a JSP view. Its showing HTTP Status 404 with description The requested resource is not available. Please help.
Controller
package controllers;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
#Controller
public class HomePageController {
#RequestMapping(value = "/twenty-eight/index", method = RequestMethod.GET)
public ModelAndView homePage(HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse){
ModelAndView mav = new ModelAndView("HomePage");
System.out.println("Going to index page...");
return mav;
}
}
web.xml
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Spring Web MVC Application</display-name>
<servlet>
<servlet-name>dispatcher-servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher-servlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
servlet-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:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:component-scan base-package="controllers" />
<mvc:annotation-driven />
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/views/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
JSP View
<!DOCTYPE html>
<html>
<head>
<title>HTML5 Login</title>
<link rel="stylesheet" href="CSS/normalize.css">
<link rel="stylesheet" href="CSS/style.css">
</head>
<body>
<h1>Working Fine</h1>
</body>
</html>
Tomcat logs
Aug 02, 2015 7:16:04 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:Twenty Eight' did not find a matching property.
Aug 02, 2015 7:16:04 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/8.0.21
Aug 02, 2015 7:16:04 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Mar 23 2015 14:11:21 UTC
Aug 02, 2015 7:16:04 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 8.0.21.0
Aug 02, 2015 7:16:04 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Linux
Aug 02, 2015 7:16:04 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 3.16.0-44-generic
Aug 02, 2015 7:16:04 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
Aug 02, 2015 7:16:04 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: /usr/local/java/jdk1.8.0_40/jre
Aug 02, 2015 7:16:04 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.8.0_40-b26
Aug 02, 2015 7:16:04 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
Aug 02, 2015 7:16:04 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: /home/kaustubh/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0
Aug 02, 2015 7:16:04 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: /var/local/apache-tomcat-8.0.21
Aug 02, 2015 7:16:04 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=/home/kaustubh/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0
Aug 02, 2015 7:16:04 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=/var/local/apache-tomcat-8.0.21
Aug 02, 2015 7:16:04 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=/home/kaustubh/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps
Aug 02, 2015 7:16:04 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=/var/local/apache-tomcat-8.0.21/endorsed
Aug 02, 2015 7:16:04 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=UTF-8
Aug 02, 2015 7:16:04 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
Aug 02, 2015 7:16:04 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
Aug 02, 2015 7:16:04 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Aug 02, 2015 7:16:04 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
Aug 02, 2015 7:16:04 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Aug 02, 2015 7:16:04 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 989 ms
Aug 02, 2015 7:16:04 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Aug 02, 2015 7:16:04 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.0.21
Aug 02, 2015 7:16:06 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: 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.
Aug 02, 2015 7:16:06 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Aug 02, 2015 7:16:07 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'dispatcher-servlet'
Aug 02, 2015 7:16:07 PM org.springframework.web.servlet.DispatcherServlet initServletBean
INFO: FrameworkServlet 'dispatcher-servlet': initialization started
Aug 02, 2015 7:16:07 PM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
INFO: Refreshing WebApplicationContext for namespace 'dispatcher-servlet-servlet': startup date [Sun Aug 02 19:16:07 IST 2015]; root of context hierarchy
Aug 02, 2015 7:16:07 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/servlet-context.xml]
Aug 02, 2015 7:16:08 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping register
INFO: Mapped "{[/twenty-eight/index],methods=[GET]}" onto public org.springframework.web.servlet.ModelAndView controllers.HomePageController.homePage(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
Aug 02, 2015 7:16:09 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache
INFO: Looking for #ControllerAdvice: WebApplicationContext for namespace 'dispatcher-servlet-servlet': startup date [Sun Aug 02 19:16:07 IST 2015]; root of context hierarchy
Aug 02, 2015 7:16:09 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache
INFO: Looking for #ControllerAdvice: WebApplicationContext for namespace 'dispatcher-servlet-servlet': startup date [Sun Aug 02 19:16:07 IST 2015]; root of context hierarchy
Aug 02, 2015 7:16:09 PM org.springframework.web.servlet.DispatcherServlet initServletBean
INFO: FrameworkServlet 'dispatcher-servlet': initialization completed in 1772 ms
Aug 02, 2015 7:16:09 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
Aug 02, 2015 7:16:09 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8009"]
Aug 02, 2015 7:16:09 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 4680 ms
Project Structure
https://drive.google.com/open?id=0B2s3KIDgKxy8RlVqZmdneW9WV1U
My basic Spring MVC web application doesn't work. I created Simple Spring Web Maven Project and deleted unnecessary code to simplify it. Then, I added Controller implementation and annotated it like in book I have read recently. I deployed a sample application from book and an app I have just created. The sample app works properly - mine not. When i try to acces the URL ...localhost.../app-name/start/basic/show Tomcat Server shows 404 Error. There's my code:
BasicController in spring.app package
#Controller
#RequestMapping("/basic")
public class BasicController{
#RequestMapping("/show")
public ModelAndView handleRequest(HttpServletRequest arg0,
HttpServletResponse arg1) throws Exception {
Map < String, String > modelData = new HashMap < String, String >();
modelData.put("message", "Hello World!");
return new ModelAndView("showMessage", modelData);
}
}
App/src/main/webapp/WEB-INF/mvc-config.xml file:
<?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:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<mvc:annotation-driven />
<context:component-scan base-package="spring.app"/>
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/view/"/>
<property name="suffix" value=".jsp"/>
</bean>
</beans>
App/src/main/webapp/WEB-INF/web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<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">
<servlet>
<servlet-name>dispatcherServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/mvc-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcherServlet</servlet-name>
<url-pattern>/start/*</url-pattern>
</servlet-mapping>
</web-app>
showMessage.jsp in WEB-INF/view directory:
<!DOCTYPE html>
<%# page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html>
<head>
<meta charset="utf-8">
<title>Welcome</title>
</head>
<body>
<h2>${message}</h2>
</body>
</html>
I was trying to solve this problem, but everything is implemented like in sample app so i don't know why it fails.
My traces, when i choose "run on server" and i have dployed only this app:
cze 29, 2015 6:44:27 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:App' did not find a matching property.
cze 29, 2015 6:44:27 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/8.0.23
cze 29, 2015 6:44:27 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: May 19 2015 14:58:38 UTC
cze 29, 2015 6:44:27 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 8.0.23.0
cze 29, 2015 6:44:27 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 8.1
cze 29, 2015 6:44:27 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 6.3
cze 29, 2015 6:44:27 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
cze 29, 2015 6:44:27 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: C:\Program Files\Java\jre1.8.0_45
cze 29, 2015 6:44:27 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.8.0_45-b15
cze 29, 2015 6:44:27 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
cze 29, 2015 6:44:27 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: C:\Users\Adrian\Desktop\apache-tomcat-8.0.23-windows-x64\apache-tomcat-8.0.23
cze 29, 2015 6:44:27 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: C:\Users\Adrian\Desktop\apache-tomcat-8.0.23-windows-x64\apache-tomcat-8.0.23
cze 29, 2015 6:44:27 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:60768
cze 29, 2015 6:44:27 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=C:\Users\Adrian\Desktop\apache-tomcat-8.0.23-windows-x64\apache-tomcat-8.0.23
cze 29, 2015 6:44:27 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=C:\Users\Adrian\Desktop\apache-tomcat-8.0.23-windows-x64\apache-tomcat-8.0.23
cze 29, 2015 6:44:27 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=C:\Users\Adrian\Desktop\apache-tomcat-8.0.23-windows-x64\apache-tomcat-8.0.23\wtpwebapps
cze 29, 2015 6:44:27 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=C:\Users\Adrian\Desktop\apache-tomcat-8.0.23-windows-x64\apache-tomcat-8.0.23\endorsed
cze 29, 2015 6:44:27 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1250
cze 29, 2015 6:44:27 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.8.0_45\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre1.8.0_45/bin/server;C:/Program Files/Java/jre1.8.0_45/bin;C:/Program Files/Java/jre1.8.0_45/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\xampp\php;C:\Program Files\MySQL\MySQL Server 5.1\bin;C:\Program Files (x86)\MySQL\MySQL Server 5.1\bin;C:\Users\Adrian\Desktop\eclipse;;.
cze 29, 2015 6:44:27 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8081"]
cze 29, 2015 6:44:28 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
cze 29, 2015 6:44:28 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8010"]
cze 29, 2015 6:44:28 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
cze 29, 2015 6:44:28 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1648 ms
cze 29, 2015 6:44:28 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
cze 29, 2015 6:44:28 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.0.23
cze 29, 2015 6:44:28 PM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [125] milliseconds.
cze 29, 2015 6:44:28 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Users\Adrian\Desktop\apache-tomcat-8.0.23-windows-x64\apache-tomcat-8.0.23\webapps\docs
cze 29, 2015 6:44:28 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory C:\Users\Adrian\Desktop\apache-tomcat-8.0.23-windows-x64\apache-tomcat-8.0.23\webapps\docs has finished in 63 ms
cze 29, 2015 6:44:28 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Users\Adrian\Desktop\apache-tomcat-8.0.23-windows-x64\apache-tomcat-8.0.23\webapps\examples
cze 29, 2015 6:44:29 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
cze 29, 2015 6:44:29 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
cze 29, 2015 6:44:29 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory C:\Users\Adrian\Desktop\apache-tomcat-8.0.23-windows-x64\apache-tomcat-8.0.23\webapps\examples has finished in 962 ms
cze 29, 2015 6:44:29 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Users\Adrian\Desktop\apache-tomcat-8.0.23-windows-x64\apache-tomcat-8.0.23\webapps\host-manager
cze 29, 2015 6:44:29 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory C:\Users\Adrian\Desktop\apache-tomcat-8.0.23-windows-x64\apache-tomcat-8.0.23\webapps\host-manager has finished in 78 ms
cze 29, 2015 6:44:29 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Users\Adrian\Desktop\apache-tomcat-8.0.23-windows-x64\apache-tomcat-8.0.23\webapps\manager
cze 29, 2015 6:44:30 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory C:\Users\Adrian\Desktop\apache-tomcat-8.0.23-windows-x64\apache-tomcat-8.0.23\webapps\manager has finished in 110 ms
cze 29, 2015 6:44:30 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Users\Adrian\Desktop\apache-tomcat-8.0.23-windows-x64\apache-tomcat-8.0.23\webapps\ROOT
cze 29, 2015 6:44:30 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory C:\Users\Adrian\Desktop\apache-tomcat-8.0.23-windows-x64\apache-tomcat-8.0.23\webapps\ROOT has finished in 47 ms
cze 29, 2015 6:44:30 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8081"]
cze 29, 2015 6:44:30 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8010"]
cze 29, 2015 6:44:30 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 2149 ms
Ok, Let's say that I solve this problem by creating Spring MVC Project instead of Simple Spring Web Maven Project. Everything works, now.
According to your log
your app does not get deploy.I got a clue from your log
INFO: Deploying
when you read about INFO: Deploying
It does not say anything about your app which is "/App"
I have already had help with this program and got it to work. I then decided I would do it again my scratch to make sure I understood but I got the same issues. The hard part is the console is not printing out any errors.
console:
Mar 22, 2015 9:07:09 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:LearnSpringMVC' did not find a matching property.
Mar 22, 2015 9:07:09 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/8.0.17
Mar 22, 2015 9:07:09 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Jan 9 2015 15:58:59 UTC
Mar 22, 2015 9:07:09 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 8.0.17.0
Mar 22, 2015 9:07:09 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Mac OS X
Mar 22, 2015 9:07:09 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 10.10.2
Mar 22, 2015 9:07:09 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: x86_64
Mar 22, 2015 9:07:09 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JAVA_HOME: /Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/jre
Mar 22, 2015 9:07:09 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.8.0_31-b13
Mar 22, 2015 9:07:09 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
Mar 22, 2015 9:07:09 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: /apache-tomcat-8.0.17
Mar 22, 2015 9:07:09 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: /apache-tomcat-8.0.17
Mar 22, 2015 9:07:09 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=/apache-tomcat-8.0.17
Mar 22, 2015 9:07:09 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=/apache-tomcat-8.0.17
Mar 22, 2015 9:07:09 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=/apache-tomcat-8.0.17/wtpwebapps
Mar 22, 2015 9:07:09 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=/apache-tomcat-8.0.17/endorsed
Mar 22, 2015 9:07:09 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=UTF-8
Mar 22, 2015 9:07:09 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /Users/DrewJocham/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
Mar 22, 2015 9:07:09 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
Mar 22, 2015 9:07:09 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Mar 22, 2015 9:07:09 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
Mar 22, 2015 9:07:09 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Mar 22, 2015 9:07:09 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1890 ms
Mar 22, 2015 9:07:09 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Mar 22, 2015 9:07:09 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.0.17
Mar 22, 2015 9:07:11 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Mar 22, 2015 9:07:12 PM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [216] milliseconds.
Mar 22, 2015 9:07:12 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /apache-tomcat-8.0.17/webapps/docs
Mar 22, 2015 9:07:12 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: 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.
Mar 22, 2015 9:07:12 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory /apache-tomcat-8.0.17/webapps/docs has finished in 194 ms
Mar 22, 2015 9:07:12 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /apache-tomcat-8.0.17/webapps/examples
Mar 22, 2015 9:07:13 PM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Mar 22, 2015 9:07:13 PM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Mar 22, 2015 9:07:13 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory /apache-tomcat-8.0.17/webapps/examples has finished in 750 ms
Mar 22, 2015 9:07:13 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /apache-tomcat-8.0.17/webapps/host-manager
Mar 22, 2015 9:07:13 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: 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.
Mar 22, 2015 9:07:13 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory /apache-tomcat-8.0.17/webapps/host-manager has finished in 164 ms
Mar 22, 2015 9:07:13 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /apache-tomcat-8.0.17/webapps/manager
Mar 22, 2015 9:07:13 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: 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.
Mar 22, 2015 9:07:13 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory /apache-tomcat-8.0.17/webapps/manager has finished in 172 ms
Mar 22, 2015 9:07:13 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /apache-tomcat-8.0.17/webapps/ROOT
Mar 22, 2015 9:07:13 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: 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.
Mar 22, 2015 9:07:13 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory /apache-tomcat-8.0.17/webapps/ROOT has finished in 147 ms
Mar 22, 2015 9:07:13 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
Mar 22, 2015 9:07:13 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8009"]
Mar 22, 2015 9:07:13 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 4068 ms
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
id="WebApp_ID"
version="3.1">
<display-name>SpringJSP</display-name>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:offers-servlet.xml</param-value>
</context-param>
<servlet>
<servlet-name>offers</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>offers</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
home.jsp file
<%# page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
Hello from JSP...
</body>
</html>
OffersController.java
package com.learnspring.controller;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
#Controller
#RequestMapping(value = "/")
public class OffersController {
#RequestMapping(method = RequestMethod.GET)
public ModelAndView homeGet(HttpServletRequest request) {
System.out.println("Check mapping");
ModelAndView model = new ModelAndView("home");
return model;
}
}
offers-servlet.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"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd">
<context:component-scan base-package="com.learnspring.controller"></context:component-scan>
<mvc:annotation-driven></mvc:annotation-driven>
<mvc:default-servlet-handler />
<bean
id="jspViewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property
name="prefix"
value="/WEB-INF/jsps/"></property>
<property
name="suffix"
value=".jsp"></property>
</bean>
</beans>
I do not know why this keeps happening to me. Can anyone help out? I checked the working code line by line and it was correct and it still works.
your application context xml file name should be offers-servlet.xml in stead of offers.xml
Jersey/Spring application debugged inside Netbeans and deployed to Netbean's Tomcat server has its application context loaded twice. It is loaded, unloaded, and loaded again.
BLOODY WHY?!?!
EDIT: It looks like if I comment out the servlet and servlet-mapping in web.xml, the application context is still loaded twice! If I delete /conf/web.xml file, it is STILL loaded twice. ###$#! Netbeans/Tomcat
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<servlet>
<servlet-name>ServletAdaptor</servlet-name>
<servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>
<init-param>
<param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>
<param-value>com.sun.jersey.api.container.filter.PostReplaceFilter</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>ServletAdaptor</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
</web-app>
Tomcat output:
Using CATALINA_BASE: "C:\Users\adubi_000\AppData\Roaming\NetBeans\7.2\apache-tomcat-7.0.27.0_base"
Using CATALINA_HOME: "C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.27"
Using CATALINA_TMPDIR: "C:\Users\adubi_000\AppData\Roaming\NetBeans\7.2\apache-tomcat-7.0.27.0_base\temp"
Using JRE_HOME: "C:\Program Files\Java\jdk1.7.0_07"
Using CLASSPATH: "C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.27\bin\bootstrap.jar;C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.27\bin\tomcat-juli.jar"
Listening for transport dt_shmem at address: tomcat_shared_memory_id
Sep 15, 2012 9:19:22 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path:
Sep 15, 2012 9:19:22 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-80"]
Sep 15, 2012 9:19:22 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Sep 15, 2012 9:19:22 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 821 ms
Sep 15, 2012 9:19:22 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Sep 15, 2012 9:19:22 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.27
Sep 15, 2012 9:19:22 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor C:\Users\adubi_000\AppData\Roaming\NetBeans\7.2\apache-tomcat-7.0.27.0_base\conf\Catalina\localhost\manager.xml
Sep 15, 2012 9:19:23 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor C:\Users\adubi_000\AppData\Roaming\NetBeans\7.2\apache-tomcat-7.0.27.0_base\conf\Catalina\localhost\ROOT.xml
Sep 15, 2012 9:19:26 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
Sep 15, 2012 9:19:26 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Sat Sep 15 21:19:26 EST 2012]; root of context hierarchy
Sep 15, 2012 9:19:26 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
Sep 15, 2012 9:19:27 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#2829abfd: defining beans [...]; root of factory hierarchy
Sep 15, 2012 9:19:28 PM org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
Sep 15, 2012 9:19:28 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.1.6.Final}
Sep 15, 2012 9:19:28 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Sep 15, 2012 9:19:28 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
Sep 15, 2012 9:19:28 PM org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator instantiateExplicitConnectionProvider
INFO: HHH000130: Instantiating explicit connection provider: org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider
Sep 15, 2012 9:19:28 PM org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider configure
INFO: HHH010002: C3P0 using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://127.0.0.1:3306/...
Sep 15, 2012 9:19:28 PM org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider configure
INFO: HHH000046: Connection properties: {user=root, autocommit=true, release_mode=auto}
Sep 15, 2012 9:19:28 PM org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider configure
INFO: HHH000006: Autocommit mode: true
Sep 15, 2012 9:19:28 PM com.mchange.v2.log.MLog <clinit>
INFO: MLog clients using java 1.4+ standard logging.
Sep 15, 2012 9:19:28 PM com.mchange.v2.c3p0.C3P0Registry banner
INFO: Initializing c3p0-0.9.1 [built 16-January-2007 14:46:42; debug? true; trace: 10]
Sep 15, 2012 9:19:29 PM com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager
INFO: Initializing c3p0 pool...
Sep 15, 2012 9:19:29 PM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
Sep 15, 2012 9:19:29 PM org.hibernate.engine.jdbc.internal.LobCreatorBuilder useContextualLobCreation
INFO: HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
Sep 15, 2012 9:19:29 PM org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService
INFO: HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jdbc.JdbcTransactionFactory
Sep 15, 2012 9:19:29 PM org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init>
INFO: HHH000397: Using ASTQueryTranslatorFactory
Sep 15, 2012 9:19:29 PM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: HHH000228: Running hbm2ddl schema update
...
Sep 15, 2012 9:19:31 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 4806 ms
Sep 15, 2012 9:19:31 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-80"]
Sep 15, 2012 9:19:31 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Sep 15, 2012 9:19:31 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 8866 ms
Sep 15, 2012 9:19:31 PM com.sun.jersey.spi.spring.container.servlet.SpringServlet getContext
INFO: Using default applicationContext
Sep 15, 2012 9:19:31 PM com.sun.jersey.spi.spring.container.SpringComponentProviderFactory registerSpringBeans
INFO: Registering Spring bean, ...
Sep 15, 2012 9:19:31 PM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
INFO: Initiating Jersey application, version 'Jersey: 1.13 06/29/2012 05:14 PM'
Sep 15, 2012 9:19:32 PM org.springframework.context.support.AbstractApplicationContext doClose
INFO: Closing Root WebApplicationContext: startup date [Sat Sep 15 21:19:26 EST 2012]; root of context hierarchy
Sep 15, 2012 9:19:32 PM org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#2829abfd: defining beans [...]; root of factory hierarchy
Sep 15, 2012 9:19:32 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: The web application [] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
Sep 15, 2012 9:19:32 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak.
Sep 15, 2012 9:19:32 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [java-sdk-http-connection-reaper] but has failed to stop it. This is very likely to create a memory leak.
Sep 15, 2012 9:19:32 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [] created a ThreadLocal with key of type [com.sun.xml.bind.v2.ClassFactory$1] (value [com.sun.xml.bind.v2.ClassFactory$1#911a094]) and a value of type [java.util.WeakHashMap] (value [{class javax.xml.bind.annotation.W3CDomHandler=java.lang.ref.WeakReference#64455932}]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Sep 15, 2012 9:19:33 PM org.apache.catalina.startup.HostConfig checkResources
INFO: Undeploying context []
Sep 15, 2012 9:19:33 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor C:\Users\adubi_000\AppData\Roaming\NetBeans\7.2\apache-tomcat-7.0.27.0_base\conf\Catalina\localhost\ROOT.xml
Sep 15, 2012 9:19:36 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
Sep 15, 2012 9:19:36 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Sat Sep 15 21:19:36 EST 2012]; root of context hierarchy
Sep 15, 2012 9:19:36 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
Sep 15, 2012 9:19:37 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#6b63d42f: defining beans [...]; root of factory hierarchy
Sep 15, 2012 9:19:37 PM org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
Sep 15, 2012 9:19:37 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.1.6.Final}
Sep 15, 2012 9:19:37 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Sep 15, 2012 9:19:37 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
Sep 15, 2012 9:19:38 PM org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator instantiateExplicitConnectionProvider
INFO: HHH000130: Instantiating explicit connection provider: org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider
Sep 15, 2012 9:19:38 PM org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider configure
INFO: HHH010002: C3P0 using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://127.0.0.1:3306/....
Sep 15, 2012 9:19:38 PM org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider configure
INFO: HHH000046: Connection properties: {user=root, autocommit=true, release_mode=auto}
Sep 15, 2012 9:19:38 PM org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider configure
INFO: HHH000006: Autocommit mode: true
Sep 15, 2012 9:19:38 PM com.mchange.v2.log.MLog <clinit>
INFO: MLog clients using java 1.4+ standard logging.
Sep 15, 2012 9:19:38 PM com.mchange.v2.c3p0.C3P0Registry banner
INFO: Initializing c3p0-0.9.1 [built 16-January-2007 14:46:42; debug? true; trace: 10]
Sep 15, 2012 9:19:38 PM com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager
INFO: Initializing c3p0 pool...
Sep 15, 2012 9:19:38 PM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect
Sep 15, 2012 9:19:38 PM org.hibernate.engine.jdbc.internal.LobCreatorBuilder useContextualLobCreation
INFO: HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
Sep 15, 2012 9:19:38 PM org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService
INFO: HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jdbc.JdbcTransactionFactory
Sep 15, 2012 9:19:38 PM org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init>
INFO: HHH000397: Using ASTQueryTranslatorFactory
Sep 15, 2012 9:19:39 PM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
INFO: HHH000228: Running hbm2ddl schema update
...
Sep 15, 2012 9:19:40 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 4264 ms
Sep 15, 2012 9:19:40 PM org.apache.catalina.util.LifecycleBase start
INFO: The start() method was called on component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]] after start() had already been called. The second call will be ignored.
Sep 15, 2012 9:19:41 PM com.sun.jersey.spi.spring.container.servlet.SpringServlet getContext
INFO: Using default applicationContext
Sep 15, 2012 9:19:41 PM com.sun.jersey.spi.spring.container.SpringComponentProviderFactory registerSpringBeans
INFO: Registering Spring bean, ...
Sep 15, 2012 9:19:41 PM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
INFO: Initiating Jersey application, version 'Jersey: 1.13 06/29/2012 05:14 PM'
It is the work of Netbean's maven deploy plugin, which waits for tomcat to start (and load the application as specified in Netbeans-generared ROOT.xml) then tells it to reload it (from a different temporary XML).
A workaround is to edit %CATALINA_BASE%/conf/tomcat-users.xml and change the password of user 'ide' (through which netbeans controls tomcat). Tomcat still loads fine, but deploy-on-save and probably other features won't work.
I'll try looking at the source code of netbeans to see if a better solution is available. This behavior of the deploy plugin is just bizare. Surely it could start Tomcat empty, and then load the app as it's doing in the second step.