File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes Simple program to print Hello Spring MVC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Simple program to print Hello Spring MVC " Watch "Simple program to print Hello Spring MVC " New topic

Simple program to print Hello Spring MVC

Vinayak Hosamani

Joined: Nov 19, 2013
Posts: 2
Hello friends,
I am new to springs, tried to execute a simple web application in eclipse.
But unfortunately even after trying as directed in the tutorial, I am unable to execute the code

On running the application i get HTTP Status 404 -
eclipse console says:

Nov 19, 2013 2:55:31 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\Java\jre7\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre7/bin/client;C:/Program Files/Java/jre7/bin;C:/Program Files/Java/jre7/lib/i386;C:\Program Files\PC Connectivity Solution\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Java\jdk1.7.0_01\bin;\;C:\Program Files\MySQL\MySQL Server 5.5\bin;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\eclipse;;.
Nov 19, 2013 2:55:31 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:HelloWeb' did not find a matching property.
Nov 19, 2013 2:55:31 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Nov 19, 2013 2:55:31 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Nov 19, 2013 2:55:31 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 435 ms
Nov 19, 2013 2:55:31 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Nov 19, 2013 2:55:31 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.32
Nov 19, 2013 2:55:32 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(E:\New workspace after CORN\test workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\HelloWeb\WEB-INF\lib\servlet-api-2.3.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
log4j:WARN No appenders could be found for logger (org.springframework.web.servlet.DispatcherServlet).
log4j:WARN Please initialize the log4j system properly.
Nov 19, 2013 2:55:34 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'HelloWeb'
Nov 19, 2013 2:55:35 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Nov 19, 2013 2:55:35 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Nov 19, 2013 2:55:35 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 3157 ms

Can anyone tell me what the problem is and how to get the application run properly.
Any kind of help is appreciated.

following is the listing of my code:

Web.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xsi:schemaLocation="" >


<beans xmlns=""

<context:component-scan base-package="com.tutorialspoint" />

<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />

package com.tutorialspoint;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.ui.ModelMap;

public class HelloController{

@RequestMapping(method = RequestMethod.GET)
public String printHello(ModelMap model) {
model.addAttribute("message", "Hello Spring MVC Framework!");

return "hello";


<%@ page contentType="text/html; charset=UTF-8" %>
<title>Hello World</title>
Karthik Shiraly

Joined: Apr 04, 2009
Posts: 874

1. Delete servlet-api.jar in your WEB-INF/lib. Other than spring jars and common logging, delete all other jars.
serlvet-api JAR is provided by Tomcat and should never be included in webapp libs.

2. What is the URL you're using to verify? Since "/hello" is the only mapped path, only "http://localhost:8080/<webappname>/hello" will work, not "http://localhost:8080/<webappname>"
The 404 message will mention exactly which resource is not available; pay attention to that.

3. Verify that your hello.jsp is under /WEB-INF/jsp.

4. Verify that HelloWeb-servlet.xml and web.xml are directly under /WEB-INF/.
I agree. Here's the link:
subject: Simple program to print Hello Spring MVC
It's not a secret anymore!