I was trying to run the basic spring mvc program but when i run i get the above mentioned error
HTTP Status 404 -
--------------------------------------------------------------------------------
type Status report
message
description The requested resource is not available.
--------------------------------------------------------------------------------
Apache Tomcat/7.0.35
console log is
Jun 13, 2017 12:50:01 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: C:\Program Files (x86)\Java\jre7\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files (x86)/Java/jre7/bin/client;C:/Program Files (x86)/Java/jre7/bin;C:/Program Files (x86)/Java/jre7/lib/i386;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\ProgramData\Oracle\Java\javapath;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)\Java\jdk1.7.0\bin;C:\Program Files\Java\jdk1.8.0_65\bin;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\RailsInstaller\Git\cmd;C:\RailsInstaller\Ruby2.3.0\bin;C:\Users\ADMIN\AppData\Local\Programs\Python\Python36-32\Scripts\;C:\Users\ADMIN\AppData\Local\Programs\Python\Python36-32\;C:\Users\ADMIN\AppData\Roaming\npm;D:\Softwares\eclipse\eclipse;
Jun 13, 2017 12:50:01 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:FirstSpringMVCProject' did not find a matching property.
Jun 13, 2017 12:50:01 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-9999"]
Jun 13, 2017 12:50:01 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jun 13, 2017 12:50:01 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1458 ms
Jun 13, 2017 12:50:02 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jun 13, 2017 12:50:02 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.35
Jun 13, 2017 12:50:08 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-9999"]
Jun 13, 2017 12:50:08 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Jun 13, 2017 12:50:08 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 6638 ms
web.xml file is as follows
<?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" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>FirstSpringMVCProject</display-name>
<servlet>
<servlet-name>spring-dispatcher</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>spring-dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
content from spring-dispatcher.xml is as followss
<bean xmlns="https://www.springframework.org/schema/beans"
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://www.springframework.org/schema/beans
https://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="HandlerMapping" class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping"/>
<bean name="/welcome.html" class="com.rohit.hellocontroller.HelloController"/>
<bean id="viewResolver" class ="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/</value>
</property>
<property name="suffix">
<value>.jsp </value>
</property>
</bean>
</bean>
here is my hellocontroller class file
package com.rohit.hellocontroller;
import javax.servlet.http.*;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;
public class HelloController extends AbstractController{
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest arg0,
HttpServletResponse arg1) throws Exception {
ModelAndView modelview= new ModelAndView("HelloPage");
modelview.addObject("welcomeMessage","Hi there user this is my own written message");
return modelview;
}
}
here is my class path stack
i dont think there is a problem with the running of tomcat server because console log shows it as started.Still cant figure out why the resource can't be located..... Any help would be great
console log on hitting url
Jun 14, 2017 10:19:09 AM 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: C:\Program Files (x86)\Java\jre7\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files (x86)/Java/jre7/bin/client;C:/Program Files (x86)/Java/jre7/bin;C:/Program Files (x86)/Java/jre7/lib/i386;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\ProgramData\Oracle\Java\javapath;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)\Java\jdk1.7.0\bin;C:\Program Files\Java\jdk1.8.0_65\bin;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\RailsInstaller\Git\cmd;C:\RailsInstaller\Ruby2.3.0\bin;C:\Users\ADMIN\AppData\Local\Programs\Python\Python36-32\Scripts\;C:\Users\ADMIN\AppData\Local\Programs\Python\Python36-32\;C:\Users\ADMIN\AppData\Roaming\npm;D:\Softwares\eclipse\eclipse;
Jun 14, 2017 10:19:09 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:FirstSpringMVCProject' did not find a matching property.
Jun 14, 2017 10:19:09 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-9999"]
Jun 14, 2017 10:19:09 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jun 14, 2017 10:19:09 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1130 ms
Jun 14, 2017 10:19:10 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jun 14, 2017 10:19:10 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.35
Jun 14, 2017 10:19:16 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-9999"]
Jun 14, 2017 10:19:16 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Jun 14, 2017 10:19:16 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 6669 ms
Jun 14, 2017 10:19:52 AM org.apache.coyote.ajp.AjpMessage processHeader
SEVERE: Invalid message received with signature 18245
Jun 14, 2017 10:19:55 AM org.apache.catalina.core.StandardServer await
WARNING: StandardServer.await: Invalid command 'GET / HTTP/1.1' received
Jun 14, 2017 10:20:05 AM org.apache.catalina.core.StandardServer await
WARNING: StandardServer.await: read:
java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at org.apache.catalina.core.StandardServer.await(StandardServer.java:478)
at org.apache.catalina.startup.Catalina.await(Catalina.java:766)
at org.apache.catalina.startup.Catalina.start(Catalina.java:712)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:456)
Jun 14, 2017 10:20:05 AM org.apache.catalina.core.StandardServer await
WARNING: StandardServer.await: Invalid command '' received
Jun 14, 2017 10:20:07 AM org.apache.catalina.core.StandardServer await
WARNING: StandardServer.await: Invalid command 'GET / HTTP/1.1' received
Jun 14, 2017 10:20:11 AM org.apache.coyote.ajp.AjpMessage processHeader
SEVERE: Invalid message received with signature 18245
Jun 14, 2017 10:20:17 AM org.apache.catalina.core.StandardServer await
WARNING: StandardServer.await: read:
java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at org.apache.catalina.core.StandardServer.await(StandardServer.java:478)
at org.apache.catalina.startup.Catalina.await(Catalina.java:766)
at org.apache.catalina.startup.Catalina.start(Catalina.java:712)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:456)
Jun 14, 2017 10:20:17 AM org.apache.catalina.core.StandardServer await
WARNING: StandardServer.await: Invalid command '' received
The reasons for this may be-
Make sure the path specified in spring-dispatcher.xml file for your views is correct (/WEB-INF/)
While making the ModelAndView object in the HelloController, you are specifying the correct file name.
Remove the following line from your
spring-dispatcher.xml
Update with the following in your
HelloController
: