Spring MVC Fast Tutorial: Hello World

How Spring MVC works

Basically the same way as Struts:

  • Based on the HTTP request URL, the DispatcherServlet calls the corresponding Controller.
  • A View is rendered and sent as HTTP response.

Spring Servlet Declaration

In 'WEB-INF/web.xml', we declare Spring DispatcherServlet and map '*.html' URLs to it:

<?xml version="1.0" encoding="UTF-8"?>
<web-app 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" >
 
  <servlet>
    <servlet-name>springmvc</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
 
  <servlet-mapping>
    <servlet-name>springmvc</servlet-name>
    <url-pattern>*.html</url-pattern>
  </servlet-mapping>
 
  <welcome-file-list>
    <welcome-file>
      jsp/index.jsp
    </welcome-file>
  </welcome-file-list>
 
</web-app>

Spring Servlet Configuration

Let's now create the Spring configuration file 'WEB-INF/springmvc-servlet.xml' (name based on the servlet name above):

<?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 name="/hello_world.html" class="springmvc.web.HelloWorldController"/>
 
  <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
      <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
      <property name="prefix" value="/jsp/"/>
      <property name="suffix" value=".jsp"/>
  </bean>
 
</beans>
  • Map URL /hello_world.html to Controller HelloWorldController
  • Declare View Resolver: when view 'view_name' is called (from the Controller), the file '/jsp/view_name.jsp' will be used.

Controller

Let's create the Controller 'WEB-INF/src/springmvc/web/HelloWorldController.java':

package springmvc.web;
 
import java.io.IOException;
 
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;
 
public class HelloWorldController implements Controller {
 
	public ModelAndView handleRequest(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
 
		String aMessage = "Hello World MVC!";
 
		ModelAndView modelAndView = new ModelAndView("hello_world");
		modelAndView.addObject("message", aMessage);
 
		return modelAndView;
	}
}

This Controller calls the view 'hello_world', passing 'message' to it (like a Struts attribute).

View

Now the view: 'jsp/hello_world.jsp':

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<body>
	<p>This is my message: ${message}</p>
</body>
</html>

Displays the message attribute previously set in the Controller.

Make it work

From 'WEB-INF' folder type

ant

Relaunch Tomcat and check it's working: http://localhost:8180/springmvc/hello_world.html

Summary

Your project should now look like that:

You can download it here. With Java 6, delete the class files (ant clean) before compiling (ant).

  • We declared Spring servlet in web.xml
  • We created a Spring configuration file where we mapped an URL to a controller and defined a way to resolve views.
  • We created a controller and a view

Previous: Setup --- Up: Spring Fast Tutorial --- Next: Model View Controller

 

Feedback

Hi this is a gud tute. I did the example as given but Iam encountering an javax.servlet.ServletException:
Servlet.init() for servlet springmvc threw exception:
Root Cause: org.springframework.beans.factory.CannotLoadBeanClassException:
Cannot find class [springmvc.web.HelloWorldController] for bean with name '/hello_world.html' defined in ServletContext resource [/WEB-INF/springmvc-servlet.xml]; nested exception is java.lang.ClassNotFoundException: springmvc.web.HelloWorldController.
Can anyone help me out with this
Mitra
May 29, 2008
#1
Hi, I have done this hello world example as said here. But my output is only showing "This is my message: " It is not displaying the message from Controller. Can someone help me with this issue
Mitra
May 29, 2008
#2
Hi Mitra, Did you run the "ant" command before you started tomcat? That compiles the classes. The HelloWorldController class should be in <tomcat>/webapps/springmvc/WEB-INF/classes/springmvc/web folder. Suran WSO2, Inc.
Suran
Jun 25, 2008
#3
in eclipse IDE can we run above application with out use of build.xml (ant script)?
shrinivas
Jul 9, 2008
#4
if i want to run the above application in eclipse3.3 IDE what are the changes i have to do plz suggest. regards shrini
shrinivas
Jul 9, 2008
#5
even though i followed all the steps of configuration am getting these errors. can anybody solve this stuff. Error: Context initialization failed org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/springmvc-servlet.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/springmvc-servlet.xml] at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:320) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:290)
shrini
Jul 16, 2008
#6
Its working. we can run above code in eclipse with out use of ant script.only we need to take care of folder structure of web application. :)
shrinivas
Jul 16, 2008
#7
syntax is not correct :<p>This is my message: ${message}</p> syntax correct is <p>This is my message:<c:out value="${message} "/></p>

Jul 28, 2008
#8
syntax is not correct :<p>This is my message: ${message}</p> syntax correct is <br> <p>This is my message:<c:out value="${message} "/></p>
igor
Jul 28, 2008
#9
Its not working for me... It gives me a 404... any help will be appreciated..
Paps
Jul 29, 2008
#10
Hi Paps. System.out.println("My log from HelloWorldController.handleRequest."); ******************************* Check the log console.U shoud see the message.The most likely u are missing some *.jar,
Igor
Jul 29, 2008
#11
Igor, this cumbersome <c:out/> syntax is useful only when you need XML escaping.
Jérôme Jaglale
Jul 29, 2008
#12
Hi Igor, Thanks for ur reply. My SOP's are not getting printed. I get the previous index.jsp page if i type "http://localhost/springmvc" but for "http://localhost/springmvc/hello_world.html" it gives 404. Nothing on tomcat console not even in log file of springmvc. I re-verified my jar's. I have allo em.. up2date.. wat cud be the problem??.. I m lil bit confused abt the springmvc-servlet.xml file.. I think thats the culprit.. Please go thro it an lemmi kno where i m wrong.. [code] <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"><!-- - Application context definition for "springapp" DispatcherServlet. --> <beans> <bean name = "/hello_world.html" class= "springmvc.web.HelloWorldController"> </bean> <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <property name="mappings"> <props> <prop key="/hello_world.html">hello_world</prop> </props> </property> </bean> <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/> <property name="prefix" value="/jsp/"/> <property name="suffix" value=".jsp"/> </bean> </beans>[/code]
Paps
Jul 30, 2008
#13
I resolved it.. there was some error in my springmvc-servlet.xml resolved it. this snippet was missing.. [code] <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.0.xsd"> [/code] what i was having was.. [code] <beans> somecode... </beans> [/code] sorry Jérôme Jaglale for spoiling ur blog space :D.. hope u dont mind ;)...
Paps
Jul 30, 2008
#14
Hi Jérôme I used c:out in 1.st 1.This is my message1:Hello World MVC! and from posted tutorial I'm getting: 2.This is my message2:${message} do u have some idea what can be wrong in 2.nd case? anyway perfect tutorial Thanks Igor

Jul 30, 2008
#15
I tried but it doesn't work, i got the message:
javax.servlet.ServletException: Servlet.init() for servlet springmvc threw exception at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:908) ...
when i accessed http://localhost:8080/springmvc/hello_world.html
What is the problem? I typed ant, to build the xml file from web-inf folder
Please help me
Thanks
Sorin
Sep 6, 2008
#16
Guys...the index page just has a "Hi" printed.It doesnt have any forward mapping or any kinda link to either of springmvc-servlet.xml or HelloWorldController.java.We do have index page in Struts application but they usually forward the control to other pages via the struts-config.xml...can anyone please cast some light on this doubt of mine!!
Soham
Sep 11, 2008
#17
@Soham Just use the below for index.jsp:

{{{
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<c:redirect url="/hello_world.html"/>
}}}
Nestor Urquiza
Sep 11, 2008
#18
thanx Nestor....that infact was the missing link..appreciated!!
soham
Sep 12, 2008
#19
ultimate.......... thnks 4 great efforts!!!
ariesrana
Oct 1, 2008
#20
It is a very good tutorial.. and most important thing is it works..
makarchus
Oct 12, 2008
#21
Please help. I follow this tutorial however I got HTTP Status 404 - type Status report message description The requested resource () is not available. Any ideas where is wrong? Thanks a lot
David
Dec 2, 2008
#22
It works without c:out. i.e. The code given in the tutorial is correct!! Thanks,
niranjan
Feb 2, 2009
#23
hi team. its wonderful site for spring. please give some more basic examples to know fully abut springs. thanks,
santhoshkumar
Feb 10, 2009
#24
hi, I got same result what David got. Even for source files provided in the Tutorial. Please help me.
Supun
Apr 1, 2009
#25
Hi I am encountring the same problem as mitra, javax.servlet.ServletException: Servlet.init() for servlet springmvc threw exception: Root Cause: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [springmvc.web.HelloWorldController] for bean with name '/hello_world.html' defined in ServletContext resource [/WEB-INF/springmvc-servlet.xml]; nested exception is java.lang.ClassNotFoundException: springmvc.web.HelloWorldController. Mitra how did you do it ? Can anyone help me out with this Thanks
rea
Apr 12, 2009
#26
Nice tuts!!!

May 11, 2009
#27
Thanks Alot
Ajeet
May 15, 2009
#28
The requested resource (?????? springmvc ????????) is not available.
zk
May 16, 2009
#29
Why this message is appear ? The requested resource (servlet springmvc cannot be used) is not available
ZK
May 16, 2009
#30
Very nice

May 22, 2009
#31
it's good example

May 27, 2009
#32
very nice
Dipak P
May 27, 2009
#33
Hi, I do not get error message, but ModelAndView object from controller does not pass to jsp. It does not print the message, when I execute the program. Please let me know where I am doing wrong. Thanks Jay
Jay
May 30, 2009
#34
Unless you copy the spring.jar, spring-webmvc.jar into WEB-INF/lib, you will get a message saying The requested resource (servlet springmvc cannot be used) is not available Cheers, Sandeep
Sandeep Shetty
Jun 3, 2009
#35
What can i say? it's just what i was looking for!!!, thanks guys, it was really helpful
John
Jun 7, 2009
#36
good
krissna
Jun 9, 2009
#37
Good one...good to start with
kasu
Jun 10, 2009
#38
Nice code to start up spring MVC but we need to mention redirect statement mentioned by Nestor Urquiza. Thanks guys
gayathri
Jun 15, 2009
#39
Hai all i have tried this example but giving the This is my message: ${firstName} please let me know the problem I a posting code here EmpFormController-servlet.xml [code] <?xml version="1.0" encoding="UTF-8" ?> <!-- ========================= VIEW DEFINITIONS ========================= --> <!-- ========================= DEFINITIONS OF PUBLIC CONTROLLERS ========================= --> [/code] Please helpme
Swaroop
Jul 8, 2009
#40
oh I am really very sorry I thought data is shown same on the forum page sorry here is the code <?xml version="1.0" encoding="UTF-8" ?>
Swaroop
Jul 8, 2009
#41
[code] <?xml version="1.0" encoding="UTF-8" ?> [/code]
swaroop
Jul 8, 2009
#42
Sorry I am not able to put my code in the blog,how can i display the in my jsp
swaroop
Jul 8, 2009
#43
[code][/code] not working do i need to do any chenages to my servlet.xml,if so where

Jul 8, 2009
#44
Great tutorial !
redhat
Jul 24, 2009
#45
Hi, I am getting this error: Jul 31, 2009 1:31:31 PM org.springframework.web.servlet.DispatcherServlet noHandlerFound WARNING: No mapping found for HTTP request with URI [/springmvc/hello_world.html ] in DispatcherServlet with name 'springmvc' Anybody? Thanks
Ruchi
Jul 31, 2009
#46
Hi All, Generally all will face the same problem due to Ant build file so in build.properties file use this two lines,based on the tomcat folder you installed appserver.home=C:\Tomcat 5.5 appserver.lib=${appserver.home}/common/lib I think after doing this you may not find any problem like ClassNotFoundException
chandra
Aug 2, 2009
#47
Hi, I am getting this error org.springframework.web.servlet.DispatcherServlet noHandlerFound WARNING: No mapping found for HTTP request with URI [/springmvc/hello_world.html ] in DispatcherServlet with name 'springmvc' Anybody? Thanks
Dragon
Aug 4, 2009
#48
man ur probabliy callling the wrong link http://localhost:8180/springmvc/hello_world.html" " make sure no space at the end of the link
trio
Aug 4, 2009
#49
trio
Aug 4, 2009
#50
Hi, I am running this project through Netbeans 6.7 and have installed Spring Framework 2.5 and Spring Web MVC 2.5 and I loaded all the files into the project and have compiled the HelloWorldController.java file again. But it seems that when I run the project I get the following error: Caused by: java.lang.IllegalArgumentException: Servlet mapping specifies an unknown servlet name springmvc Can someone help me in this regard. I am running Tomcat from within Netbeans.
Manis
Aug 5, 2009
#51
Hi i tried to run this example but when i type the taglib it shows an error saying "cannot find taglib discriptor for http://java.sun.com/jstl/core. Please let me know how to fix this
Sonali
Aug 19, 2009
#52
Hi all i tried to run this app ... but end up with the follwoing error. i have used spring-1.1.2.jar. org.springframework.beans.factory.BeanDefinitionStoreException: Line 5 in XML document from ServletContext resource [/WEB-INF/springex-servlet.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null". org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null". plz help me,
Venkatesh
Aug 21, 2009
#53
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> <html> <body> no

This is my message: ${message}

but </body> </html>
Svitlana
Aug 24, 2009
#54
My ant build didn't work. BUILD FAILED C:\apache-tomcat-5.5.28\webapps\springmvc\WEB-INF\build.xml:2 -5.5.28\webapps\springmvc\WEB-INF\${appserver.lib} not found. What am I missing?
CT
Sep 11, 2009
#55
Hi gr8 tutorial, but it creates the confussion ant build, u have not given details about ant build, how to build the application. Vinod Hire
Vinod
Oct 5, 2009
#56
Hi I worked for 2 years on Spring MVC and Hibernate, Now a days working in different environment. Today I read this tutorial and it refreshes my memories.. Very good tutorial It's Beauty is it's Simplicity.. Nice job
Abu Turab Munir
Oct 8, 2009
#57
hellow, i have changed the build.properties file trying to run it on windows: appserver.home=c:\xampp\tomcat appserver.lib=${appserver.home}\lib ant doesn't works: C:\xampp\tomcat\webapps\springmvc\WEB-INF>ant Buildfile: build.xml build: [javac] Compiling 1 source file to C:\xampp\tomcat\webapps\springmvc\WEB-INF \classes BUILD FAILED C:\xampp\tomcat\webapps\springmvc\WEB-INF\build.xml:20: c:\xampp\tomcat\webapps\ springmvc\WEB-INF\xampp omcatlib not found. Total time: 0 seconds thanks
max
Oct 13, 2009
#58
ok, fixed it by changing \ with / thanks
max
Oct 13, 2009
#59
i get error : org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [springmvc.web.HelloWorldController] for bean with name 'hello_world.html' defined in ServletContext resource [/WEB-INF/springmvc-servlet.xml]; nested exception is java.lang.ClassNotFoundException: springmvc.web.HelloWorldController when using the windows version of build.properties
max
Oct 13, 2009
#60
...replay to 'HTTP Status 404' ______________________________ ...into file springmvc-servlet.xml you have to write right path, if you write that’s mean yours hello_world.jsp location onto server is webapps/projectname/jsp/hello_world.jsp ...into my case (I suppose into others too) I wrote because my *.jsp located into webapps/projectname/hello_world.jsp ...URL into both case of course is http://localhost/projectname/hello_world.html
virtualcook
Oct 18, 2009
#61
...replay to 'HTTP Status 404' ...into file springmvc-servlet.xml you have to write right path, if you write property name="prefix" value="/jsp/"/ that’s mean yours hello_world.jsp location onto server is webapps/projectname/jsp/hello_world.jsp ...into my case property name="prefix" value="//"/ (I suppose into others too) I wrote because my *.jsp located into webapps/projectname/hello_world.jsp ...URL into both case of course is http://localhost/projectname/hello_world.html

Oct 18, 2009
#62
worked for me after changing mapping to: thanks!
NOX
Oct 20, 2009
#63
worked for me after changing mapping to: < bean name="/springmvc/hello_world.html" class="springmvc.web.HelloWorldController" /> thanks!
NOX
Oct 20, 2009
#64
Hi Friends, iam new to spring,deploying one existing application in tomcat6.0. iam getting welcome file.but next if click the link, iam getting below error. link is like this:click here WARNING: No mapping for [/shop/jsp/MVC/shop/addNewProduct.form] in DispatcherServlet with name 'shop' my shop-servlet.xml file is like this reqhandler1 reqhandler2 reqhandler3 <!-- reqhandler4--> listDao Please help me. regards Srinivas
Srinivas
Oct 28, 2009
#65
good explation clearly given easy to understand
madhavan
Oct 29, 2009
#66
good explation clearly given easy to understand
madhavan
Oct 29, 2009
#67
Its very Nice to get basic idea
Sarvesh
Oct 30, 2009
#68
Hi Guys i am getting the following error when i am typing the http://localhost:8080/SpringLoginDemo/hello_world.htm in my IE. type Status report message /SpringLoginDemo/jsp/hello_world.jsp description The requested resource (/SpringLoginDemo/jsp/hello_world.jsp) is not available.
Tuna
Nov 6, 2009
#69
i WAS getting the error org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [springmvc.web.HelloWorldController]. I reloaded the Web App through the Tomcat manager. Seemed to clear things up. Hope that helps.
Ray
Dec 3, 2009
#70
Great tuts...........thanks
ashfaque
Dec 4, 2009
#71
goog tuts ...thanks
xcom-vegance
Dec 29, 2009
#72
Good illustration. Thanks
Rajan
Jan 9, 2010
#73
I was getting "This is my message: ${message}" instead of "This is my message: Hello World MVC!" that I expected. The fix was to apply 2 changes to hello_world.jsp: First, use the syntax that Igor mentioned earlier. Second, change the uri in the header of the file from "http://java.sun.com/jsp/jstl/core" to "http://java.sun.com/jstl/core" as suggested by Svitlana. Note, I used WebLogic 8.1 for this example, not Tomcat so I don't know if that necessitated these changes, but it now works.
Vadim
Jan 14, 2010
#74
Thanks Rajan for your answer. That did the trick !
Thanks Subadhra
Jan 20, 2010
#75
I am unable to get this example working with Apache HTTP Server 2.2. It seems like the controller cannot locate the jsp.
beachtowel
Feb 3, 2010
#76
hi this such very good springmvc tutorial, when i was reading other tutorial i didn't understand it completely But when i tried this tutorial i got everything thanks
keyur
Feb 5, 2010
#77
thanx greate job

Feb 9, 2010
#78
Thanks
Ravi
Mar 10, 2010
#79
Nice article: for maven users use the pom below:

  4.0.0
  springmvc
  springmvc
  war
  0.0.1-SNAPSHOT
  springmvc Maven Webapp
  http://maven.apache.org
  
 
  2.5.6.SEC01
 
   
  
    
      junit
      junit
      3.8.1
      test
    
 
  javax.servlet
  servlet-api
  2.4
  provided
 
 
  javax.servlet.jsp
  jsp-api
  2.0
  provided
     
  
   javax.servlet
   jstl
   1.1.2
   runtime
  
  
   taglibs
   standard
   1.1.2
   runtime
   
 
  org.springframework
  spring-webmvc
  ${springFrameworkVersion}
 
 
  org.springframework
  spring-test
  ${springFrameworkVersion}
  test
     
  
  
    springmvc
  

raj
Mar 10, 2010
#80
nice and fast way to learn Spring MVC.

Mar 19, 2010
#81
Hi there!

Only the contents of hello_world.jsp is displaying :( Its not displaying the $message ("Hello World MVC!") is not displaying. Build is successful...
Savvy
Mar 22, 2010
#82
Your tutorial teached me lot of things. thank's.
shankar
Mar 26, 2010
#83
Hey, I am doing the exact things, but i got the below error:
HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: org.springframework.core.CollectionFactory
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:294)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:115)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
java.lang.Thread.run(libgcj.so.90)

root cause

java.lang.NoClassDefFoundError: org.springframework.core.CollectionFactory
java.lang.Class.initializeClass(libgcj.so.90)
org.springframework.core.SimpleAliasRegistry.<init>(SimpleAliasRegistry.java:41)
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.<init>(DefaultSingletonBeanRegistry.java:75)
org.springframework.beans.factory.support.FactoryBeanRegistrySupport.<init>(FactoryBeanRegistrySupport.java:41)
org.springframework.beans.factory.support.AbstractBeanFactory.<init>(AbstractBeanFactory.java:146)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.<init>(AbstractAutowireCapableBeanFactory.java:144)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.<init>(AbstractAutowireCapableBeanFactory.java:155)
org.springframework.beans.factory.support.DefaultListableBeanFactory.<init>(DefaultListableBeanFactory.java:121)
org.springframework.context.support.AbstractRefreshableApplicationContext.createBeanFactory(AbstractRefreshableApplicationContext.java:176)
org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:121)
org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:423)
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:353)
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:402)
org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:316)
org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:282)
org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:126)
javax.servlet.GenericServlet.init(GenericServlet.java:211)
java.lang.reflect.Method.invoke(libgcj.so.90)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:244)
java.security.AccessController.doPrivileged(libgcj.so.90)
javax.security.auth.Subject.doAsPrivileged(libgcj.so.90)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:276)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:115)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
java.lang.Thread.run(libgcj.so.90)

note The full stack trace of the root cause is available in the Apache Tomcat/5.5 logs.
Apache Tomcat/5.5

Every library is there, I am wondering how to fix it
Jacky
Mar 26, 2010
#84
I got the error that many had...
they resolved it.. but i cant...


HTTP Status 404 -

--------------------------------------------------------------------------------

type Status report

message

description The requested resource () is not available.


--------------------------------------------------------------------------------

Apache Tomcat/6.0.18
Madan kumar PC
Mar 27, 2010
#85
do you have any idea that how to resolve it?
jacky
Apr 4, 2010
#86
I tried this code but it didn't work for me it only showed :"This is my message"
if anyone has a clue feel free to share
thanx
ariane
Apr 9, 2010
#87
your application s very good.. But i dint get the output
kambagiri Raju
Apr 14, 2010
#88
I followed the instructions using Notepad++ and the windows console. Got it working first time. Excellent tutorial. My first Spring MVC working example! Thanks very much.
jude
Apr 20, 2010
#89
Simple but good tutorial .......
thanks
BB
May 3, 2010
#90
this is by far the best.
but i want to point out something
dont forget the coding in index.jsp page
ie <c:redirect url="/hello_world.html"></c:redirect>
and also download the required jar
jaspreet999
May 12, 2010
#91
"With Java 6, delete the class files (ant clean) before compiling (ant)."

What does that mean ?
Seb G.
May 14, 2010
#92
Actually the code provided to download is compiled with jdk1.5, so the classes will be behaving accordingly, but if you have jdk1.6 at your end you better clean those class files(delete those class files) and compile those classes with jdk1.6
Neeraj Tiwari
May 21, 2010
#93
Great job. Thanks.
northcloud
Jun 1, 2010
#94
Good Job. It works for me.
Rajan
Jun 2, 2010
#95
what if I get

This is my message: ${message}

printed ????
george
Jun 17, 2010
#96
it works now

changed "http://java.sun.com/jsp/jstl/core" to "http://java.sun.com/jstl/core", thanks vadim
george
Jun 17, 2010
#97
Hello I am not getting the simple "Hi" message as suggested in your link I am trying sample application of springs I have integrated spring in eclipse helios and using tomcat 5.5
HTTP Status 404 - /springapp/

--------------------------------------------------------------------------------

type Status report

message /springapp/

description The requested resource (/springapp/) is not available.


--------------------------------------------------------------------------------

Apache Tomcat/5.5.30

and in the log of tomcat it is showing in catalina notepad like this
Jul 16, 2010 2:07:52 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\Apache Software Foundation\Tomcat 5.5\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Intel\DMIX;C:\Program Files\Java\jdk1.6.0\bin;C:\ANT\bin;
Jul 16, 2010 2:07:52 PM org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Jul 16, 2010 2:07:52 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 547 ms
Jul 16, 2010 2:07:52 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jul 16, 2010 2:07:52 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.30
Jul 16, 2010 2:07:52 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Jul 16, 2010 2:07:53 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile&#40;C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\springexample\WEB-INF\lib\jsp-api.jar&#41; - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/jsp/JspPage.class
Jul 16, 2010 2:07:53 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile&#40;C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\springexample\WEB-INF\lib\servlet-api.jar&#41; - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Jul 16, 2010 2:07:53 PM org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Jul 16, 2010 2:07:53 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Jul 16, 2010 2:07:53 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/31 config=null
Jul 16, 2010 2:07:53 PM org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
Jul 16, 2010 2:07:53 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1015 ms
Jul 16, 2010 2:20:16 PM org.apache.coyote.http11.Http11BaseProtocol pause
INFO: Pausing Coyote HTTP/1.1 on http-8080
Jul 16, 2010 2:20:18 PM org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
Jul 16, 2010 2:20:18 PM org.apache.coyote.http11.Http11BaseProtocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-8080
Jul 16, 2010 2:20: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: C:\Program Files\Apache Software Foundation\Tomcat 5.5\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Intel\DMIX;C:\Program Files\Java\jdk1.6.0\bin;C:\ANT\bin;
Jul 16, 2010 2:20:22 PM org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Jul 16, 2010 2:20:22 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 563 ms
Jul 16, 2010 2:20:22 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jul 16, 2010 2:20:22 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.30
Jul 16, 2010 2:20:22 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Jul 16, 2010 2:20:23 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile&#40;C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\springexample\WEB-INF\lib\jsp-api.jar&#41; - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/jsp/JspPage.class
Jul 16, 2010 2:20:23 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile&#40;C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\springexample\WEB-INF\lib\servlet-api.jar&#41; - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Jul 16, 2010 2:20:23 PM org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Jul 16, 2010 2:20:23 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Jul 16, 2010 2:20:23 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/16 config=null
Jul 16, 2010 2:20:23 PM org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
Jul 16, 2010 2:20:23 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1109 ms
Jul 16, 2010 2:25:45 PM org.apache.coyote.http11.Http11BaseProtocol pause
INFO: Pausing Coyote HTTP/1.1 on http-8080
Jul 16, 2010 2:25:46 PM org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
Jul 16, 2010 2:25:47 PM org.apache.coyote.http11.Http11BaseProtocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-8080
Jul 16, 2010 2:25:51 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\Apache Software Foundation\Tomcat 5.5\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Intel\DMIX;C:\Program Files\Java\jdk1.6.0\bin;C:\ANT\bin;
Jul 16, 2010 2:25:51 PM org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Jul 16, 2010 2:25:51 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 688 ms
Jul 16, 2010 2:25:51 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jul 16, 2010 2:25:51 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.30
Jul 16, 2010 2:25:51 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Jul 16, 2010 2:25:52 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile&#40;C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\springexample\WEB-INF\lib\jsp-api.jar&#41; - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/jsp/JspPage.class
Jul 16, 2010 2:25:52 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile&#40;C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\springexample\WEB-INF\lib\servlet-api.jar&#41; - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Jul 16, 2010 2:25:52 PM org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Jul 16, 2010 2:25:52 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Jul 16, 2010 2:25:52 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/32 config=null
Jul 16, 2010 2:25:52 PM org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
Jul 16, 2010 2:25:52 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1031 ms
Jul 16, 2010 3:07:32 PM org.apache.catalina.startup.HostConfig checkResources
INFO: Undeploying context [/springapp]
Jul 16, 2010 3:20:53 PM org.apache.catalina.core.StandardContext reload
INFO: Reloading this Context has started

and in manager it is showing like
Jul 16, 2010 3:20:53 PM org.apache.catalina.core.ApplicationContext log
INFO: HTMLManager: list: Listing contexts for virtual host 'localhost'
please suggest the answer?????
I am stuck with this problem from yesterday please suggest
kalp
Jul 16, 2010
#98
nenu ipude nerchukuntunnanu.. :)
chari
Jul 26, 2010
#99
org.apache.jasper.JasperException: /login.jsp(2,4) Invalid directive
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:86)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:515)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1552)
org.apache.jasper.compiler.Parser.parse(Parser.java:126)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:211)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:146)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
org.apache.jasper.servlet.JspServlet.serviceJspFile&#40;JspServlet.java:314&#41;
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:142)
org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:247)
org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1123)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:860)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:774)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:460)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:415)
javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

srinivas
Jul 27, 2010
#100
good to start with
madhuri
Aug 4, 2010
#101
my ant not working why is it?
Bhathiya
Aug 9, 2010
#102
Ok. I ported this tutorial in my Netbeans IDE with Glassfish3 Server.
My call was
"http://localhost:8080/SpringTut/HelloWorld.html"

I had the same problem as most of you with the error "The requested resource () is not available."
Then I started the Glassfish with debug mode on and looked on the console output.
I saw a warning like this "No mapping found for HTTP request with URI [/SpringTut/HelloWorld.html]" and a few lines above this info: "Mapped URL path [/helloworld*] onto handler [controller.HelloWorldController@a40050]"

I just tried the following:
"http://localhost:8080/SpringTut/helloworld.html"

And now everything was ok. It's strange that the call is case sensitive even my JSP is called HelloWorld in the filesystem.

Maybe this helps some of you!
rawdog
Aug 20, 2010
#103
why didnt i encounter this tutorial before, awsome!! really great Job buddy!!
Neeraj
Aug 21, 2010
#104
Great Deal Man
Ajay
Aug 26, 2010
#105
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
nageswararao
Aug 27, 2010
#106
a mi me funciono y me dejo de mostrar 404 solo cambien en el servlet /jsp/ por /WEB-INF/jsp/
<property name="prefix" value="/WEB-INF/jsp/"/>
javamaster
Aug 28, 2010
#107
It works for me : thx !

Aug 29, 2010
#108
Thanks so much for this tutorial......
Nuwan
Sep 4, 2010
#109
Thanks! Much easier to make it work if you actually copy the springmvc catalogue to the webapps folder... :)
J-man
Sep 13, 2010
#110
It runs fine. copy this folder into eclipse, delete all src,class folder outside web-inf. also change eclipse project output folder path to SpringMVC/WEB-INF/classes. Just Build it. deploy to tomcat it will run
Kunal Dhande
Oct 12, 2010
#111
Good one to start with..... :-)
Gaurav Bhardwaj
Oct 13, 2010
#112
Hi.. im getting ClassNot Found Exception whenever i execute.
anyone pls me..
thanks in advance:)
Seetha
Oct 14, 2010
#113
Hi all, i don'tn understand "from 'WEB-INF' type ant",Can anybody help me,thanks
dinhsa
Oct 19, 2010
#114
i done as above...but only i get printed message is "this is my message" but not i getting Hello World MVC message..

pls cn any one reply?

and cn any one tell me about build.xml file for reason of using?
Shaunak soni
Dec 1, 2010
#115
this is good tutorial
srinivas
Dec 7, 2010
#116
enaku onume puriyala :P
Arun
Dec 8, 2010
#117
For those who encounter:

'This is my message: ${message}'

instead of

'This is my message: Hello World MVC!'

Check your page's isELIgnored settings. The default setting varies between JSP1.2 (true) and JSP2.0 (false). In order for the ${message} to be displayed, it needs to be set to false. I added this to my jsp to fix the issue:

<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false"%>

Obviously, people who use JSP2.0 should not need to do this since it is the default.

Side-note: this is why the <c:out> fix works: it's not using EL
Rommert de Bruijn
Dec 13, 2010
#118
Excellent Example u have given
Rakesh
Dec 15, 2010
#119
simple and awesome thanku sir
neha
Jan 4, 2011
#120
simple and awesome thanku sir
neha
Jan 4, 2011
#121
merci
nicola
Jan 4, 2011
#122
hi, I am not getting the value in the JSP page for the line
<p>This is my message: ${message}</p>

i.e. message variable is null
thanks
Abhijit
Abhijit das
Jan 11, 2011
#123
How to establish database connection in spring
errors are
IOException parsing XML document from class path resource [dispatcher-servlet.xml]; nested exception is java.io.FileNotFoundException: class path resource [dispatcher-servlet.xml] cannot be opened because it does not exist
teena
Jan 22, 2011
#124
hi guys to those encountering resource not found, somehow the folder /jsp/ is lost during translation and compilation of jsp so it's either you add another 'jsp' folder under webpages and move hello_world.jsp inside or remove the <property name="prefix" value="/jsp/"/> in springmvc-servlet.xml so the container will look at the root folder...

for netbeans, you also need to type in yourself in browser: http://localhost:8080/springmvc/springmvc/hello_world.html as it's hardcoded that any request with hello_world.html will be handled by class class="springmvc.web.HelloWorldController"..just running the web app will start you to you the URL http://localhost:8080/springmvc/springmvc/ which is how it's defined in web.xml..maybe we need to add redirects or something in order for browser to request for hello_world.html at launch..
gimumancer
Jan 26, 2011
#125
yah i think that was it..just add 'jsp' folder and move the 2 jsp inside..once you run the app it will go to index.jsp and you have to type 'http://localhost:8080/springmvc/springmvc/hello_world.html' request in the browser..i think that's how the author wanted it..anyway thanks jerome for that barebones tutorial
gimumancer
Jan 27, 2011
#126
its a nice and simple to understand tutorial
sakshi
Feb 7, 2011
#127
Hey I think u r missing some entries in web.xml file isn't it an listner and the context path for the -servlet mapper?

Feb 8, 2011
#128
First you have to add
irst you have to add the ContextLoaderListener at web.xml file:

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

Then add
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:-servlet.xml</param-value>
</context-param>
Mr VD
Feb 8, 2011
#129
very nice, indeed
Pol
Feb 10, 2011
#130
Hi, its very good example spring web mvc.But same project if iam trying to develop with myeclipse 8.6 -spring.3. and jre 6.0 ,
Iam getting http 404 error.
Kindly help me
shaji
Feb 16, 2011
#131
i read this tutorial and edit aMessage, but after build i found : Error loading class [springmvc.web.HelloWorldController] for bean with name '/SpringMVC/hello_world.html' defined in ServletContext resource [/WEB-INF/springmvc-servlet.xml]: problem with class file or dependent class; nested exception is java.lang.UnsupportedClassVersionError: Bad version number in .class file &#40;unable to load class springmvc.web.HelloWorldController&#41;

i used eclipse to run this code
albino
Feb 17, 2011
#132
I found that I had to reference the jsps as /WEB-INF/jsp/index.jsp in the web.xml file, and in the *servlet.xml spring files.
Extra Terrestrial Jobby Monster
Feb 25, 2011
#133
Did this by Netbeans6.9 using the JBoss AS. The auto generated dispatcher-servlet.xml had additional tag called <url mapping>(or something). Had to delete it to make it work. Vwry helpful Tutorial. Thanx loads!
SeriousSam
Mar 10, 2011
#134
hi, I am new to spring and i am trying the same in IBM Websphere RSA,is that fine or pls let me know wat are all the changes need to be done??
Gayathiri
Mar 18, 2011
#135
hi shaji


check u r package name in u r springmvc-servlet.xml...

smitha
Mar 22, 2011
#136
I know that this thread started 3 years ago, but we're here at work banging our heads on our desks, trying to figure out how Spring interacts with Java, Hibernate, HTML, servlets, and .jsp. We were told to investigate and learn how it works. This is by far the BEST information I've seen. I've not run across a diagram of how Spring affects other components. It's much clearer now. Thank you very much, Jerome!
Tina
May 10, 2011
#137
The type javax.servlet.http.HttpServletResponse cannot be resolved. It is indirectly referenced from required .class files
can any one tell the solu plzzzzz how to resolve it
vic
May 11, 2011
#138
@Rommert de Bruijn thank you very much for solving the ${message} problem for me!
@Jérôme Jaglale Thank you very much for creating that tutorial!
bju
May 19, 2011
#139
[
[[[
Jun 7, 2011
#140
Can someone please tell me how to run this in eclipse? I've the folders all sorted out like given here, but if I right-click on the jsp pages, I can't seen any "run as..." options. Any help is greatly appreciated.
Mith
Jun 7, 2011
#141
Nice Tutorial that's very easy to follow!!! Good Job. To run it in eclipse. On high level...
1. Open a new Static/Dynamic Web Project from File->New
2. You will have to choose a server. select Tomcat from the drop down. Download Tomcat from Apache site if you haven't already done so.
3. Add the folders above into the appropriate locations in the newly created web project.
4. Click on Eclipse's Window->show view->servers and add a new Server (In this case Tomcat) by right clicking in the server window.
5. Right click on the web project and click "Run On Server" and choose the server we created in step 4.
6. After server starts, open the link http://localhost:8080/springmvc/hello_world.html from the browser.
4.
Sunny
Jun 11, 2011
#142
good
kavitha
Jun 27, 2011
#143
Guyz, it could be one of the reason that you cannot display the view: if you're using eclipse the "jsp" directory is probably located under "WEB-INF". in such case, in springmvc-servlet.xml, the viewResolver should has this property :
<property name="prefix" value="/WEB-INF/jsp/" />

better to check ;)
brs
Jun 30, 2011
#144
hi guys,when i m running this .jsp page
<h1>My Message:<c:out value="${message}"/></h1> or
<h1>My Message:${msg}></h1>

it dsplay
My Message:<blank here>

pls someone tell me why it is not displaying my msg from Controller class
Thanks in advance.....
Sumit
Jul 14, 2011
#145
Do not run jsp, run hello_world.html, it is mapped to Spring front controller which will forward to hello_world.jsp with message value set. I didn't run it in Tomcat or Eclipse. I use TJWS and the example worked with second attempt, first I placed .jsp in root, and after moving thme in jsp directory all started work. Thanks, it is great tutorial
Dmitriy R
Aug 6, 2011
#146
If you are using the old JSP 1.2 descriptor, defined by DTD ,for example "web.xml"

<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >

<web-app>
//...
</web-app>

The EL is disabled or ignored by default, you have to enable it manually.


-------------------------------------------------------------
If you are using the standard JSP 2.0 descriptor, defined by w3c schema ,for example "web.xml" use this

&lt;!--******************************************--&gt;
<web-app id="WebApp_ID" version="2.4"
>
//...
</web-app>
&lt;!-- ******************************************* --&gt;

The EL is enabled by default, and you should see the value stored in the “message” model, which is “Hello World MVC!";




Rock
Aug 9, 2011
#147
<web-app id="WebApp_ID" version="2.4"
>
//...
</web-app>

Aug 9, 2011
#148
/*<web-app id="WebApp_ID" version="2.4"
>
//...
</web-app> */

Aug 9, 2011
#149
1<web-app id="WebApp_ID" version="2.4"
2 >
6//...
7</web-app>

Aug 9, 2011
#150
hi,
this is gopal my mail id is gopalmcajava@gmail.com,plese help me,my project is spring mvc based project in that i am developing services part...
i need information about service layer in spring mvc project
gopala krishna
Aug 16, 2011
#151

<p><a href="http://cbbest.info/point-click-commissions/">http://cbbest.info/point-click-commissions/</a><br />
<a href="http://cbbest.info/income-times-ten-review/">http://cbbest.info/income-times-ten-review/</a><br />
<a href="http://cbbest.info/commission-black-ops-review/">http://cbbest.info/commission-black-ops-review/</a><br />
<a href="http://cbbest.info/mobile-money-machines-review/">http://cbbest.info/mobile-money-machines-review/</a><br />
<a href="http://cbbest.info/commission-ignition-review/">http://cbbest.info/commission-ignition-review/</a><br />
sujatha
Aug 21, 2011
#152
Nice Job....
Tilak
Aug 24, 2011
#153
It works and refreshes the memories.....useful to brush up the things again...... :)
Tilak Sharma
Aug 24, 2011
#154
me perdi y no se donde estoy
jorge julio lopez
Sep 7, 2011
#155
Caused by: java.lang.ClassNotFoundException: org.apache.catalina.startup.Bootstrap
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Exception in thread "main"

This is the error message i am getting .. please some one suggest me how to solve it...
kamesh
Sep 19, 2011
#156
Looks Cool
Mallappa
Sep 22, 2011
#157
it workedddddddddd :) Thank you all - its my first spring mvc code ......
ran the program without using ant -
1. included jstl.jar inside WEB-INF/lib folder,
2. included <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<c:redirect url="/hello_world.html"/> inside index.html page
3. included the jsp pages directly inside the WebContent folder and hence changed the springmvc-servlet.xml to <property name="prefix" value="/"/>
danny
Sep 23, 2011
#158
Worked for me....its great..!!!!!!

Above changes are required...
Bond
Sep 27, 2011
#159
javax.servlet.ServletException: Servlet.init() for servlet dispatcher threw exception
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
java.lang.Thread.run(Unknown Source)

This is the error message i am getting .. please some one suggest me how to solve it
raj
Oct 7, 2011
#160
Simple and clear. Thanks for sharing.
vaish
Oct 19, 2011
#161
Ya..Its really good and quick brush up tutorial for spring..thanQ
Rajesh UM
Nov 18, 2011
#162
when i run my project every thing is ok,but when i click a button then there is
HTTP Status 404 - /HappyTour/

type Status report

message /HappyTour/

description The requested resource (/HappyTour/) is not available

message are occured ..what i m doing..plz give me suggestion
pawan kumar
Dec 27, 2011
#163
Very good guide!
Thank you for your wonderful work!
bernie114
Jan 17, 2012
#164
hi i am praveen new to spring. working with spring web. using
DispatchetServlet. i saw different url name in web.xml file for servlet mapping. they are like
1) <url-pattern>*.spr</url-pattern>
but int doc <url-pattern>*.html</url-pattern> is used.
i am not getting the difference and when to go for "*.spr"
and "*.html"
let me know
Praveen
Jan 29, 2012
#165
ek dum eazy
rocky
Jan 31, 2012
#166
nice
siddharth
Jan 31, 2012
#167
superb
nicky
Feb 7, 2012
#168
thanks a lot!!
Fsye12
Feb 12, 2012
#169
Excellent Hands on tutorial for a starter.
Sai T
Feb 29, 2012
#170

Hi everyone,iam using spring toolsuit2.5.6 with jboss 5.0 .iam getting the below error.please give me solution.I dont see any solution in the above many of them got same error.

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Servlet.init() for servlet springmvc threw exception
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
java.lang.Thread.run(Thread.java:662)


root cause

org.springframework.beans.factory.BeanDefinitionStoreException: I/O failure during classpath scanning; nested exception is java.io.FileNotFoundException: C:\ApplicationServer\jboss-5.0.0.GA-jdk6 (1)\jboss-5.0.0.GA\server\default\deploy\MvcAnnotWebProj.war\WEB-INF\classes\com\controller (The system cannot find the path specified)
org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:222)
org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:201)
org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentScanBeanDefinitionParser.java:84)
org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:69)
org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1297)
org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1287)
org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135)
org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)
org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92)
org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:422)
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:402)
org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:316)
org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:282)
org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:126)
javax.servlet.GenericServlet.init(GenericServlet.java:212)
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
java.lang.Thread.run(Thread.java:662)


root cause

java.io.FileNotFoundException: C:\ApplicationServer\jboss-5.0.0.GA-jdk6 (1)\jboss-5.0.0.GA\server\default\deploy\MvcAnnotWebProj.war\WEB-INF\classes\com\controller (The system cannot find the path specified)
java.util.zip.ZipFile.open(Native Method)
java.util.zip.ZipFile.<init>(ZipFile.java:127)
java.util.jar.JarFile.<init>(JarFile.java:135)
java.util.jar.JarFile.<init>(JarFile.java:72)
org.springframework.core.io.support.PathMatchingResourcePatternResolver.doFindPathMatchingJarResources(PathMatchingResourcePatternResolver.java:448)
org.springframework.core.io.support.PathMatchingResourcePatternResolver.findPathMatchingResources(PathMatchingResourcePatternResolver.java:339)
org.springframework.core.io.support.PathMatchingResourcePatternResolver.getResources(PathMatchingResourcePatternResolver.java:263)
org.springframework.context.support.AbstractApplicationContext.getResources(AbstractApplicationContext.java:1018)
org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:182)
org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:201)
org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentScanBeanDefinitionParser.java:84)
org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:69)
org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1297)
org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1287)
org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135)
org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)
org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92)
org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:422)
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:402)
org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:316)
org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:282)
org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:126)
javax.servlet.GenericServlet.init(GenericServlet.java:212)
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
java.lang.Thread.run(Thread.java:662)
Raja
Mar 16, 2012
#171
How to send data like ResultSet to view and how to handle them with and without jstl?
Baibhav
Apr 19, 2012
#172
OMG, this article is still getting hits in 2012 :D
Nice article by the way, I guess shortest tutorial on spring.
rakesh juyal
Apr 27, 2012
#173
@Baibhav: don't u ever try to send the resultSet to view. Nothing, like it is not possible but it is just a wrong approach. ResultSet should not go back from DAO to your controller, instead of that iterate resultset in dao, and create the list of objects. Send this list back to controller. Add this list to ModelAndView. Now, you can show it in your view ( asp, freemarker, velocity or any view )
Rakesh Juyal
Apr 27, 2012
#174
Hi Friends,
I m getting an error->
Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 6 in XML document from class path resource [SpringHelloWorld.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Element type "bean" must be followed by either attribute specifications, ">" or "/>".
by either attribute specifications, ">" or "/>".


My xml file is---&gt;
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
<beans >
<bean id="Spring3HelloWorldBean"class="net.roseindia.Spring3HelloWorld"></bean>
</beans>

Please help me what should I do.
Anshul
May 4, 2012
#175
good example for beginners...!!!!
Mayuri
May 8, 2012
#176
This is a really nice, simple tutorial. Thanks!

On the other hand, I think Spring MVC is RIDICULOUS. I'm trying to figure out how and to what all these strings map, i.e., which strings matter, what each string points to, what filenames need to have what name, what string is about what URL a user types in, what string is about what JSP to use. It is @%#$'ing confusing, convoluted, and simply complicated as @$#%. Does it eventually pay off? I've been struggling for hours just trying to add a second page/controller to your tutorial. Pulling my hair out!

Simplification through complication. Don't get it!
Jack
May 10, 2012
#177
Mr. Jack, i totally agree with you. Spring MVC is somewhat convoluted. It should be simplified further.
Mani
May 13, 2012
#178
ERRROR
java.io.FileNotFoundException: JSPG0036F: Failed to find /Tests/index.jsp
at com.ibm.ws.jsp.webcontainerext.JSPExtensionProcessor.findWrapper (JSPExtensionProcessor.java:246)
at com.ibm.ws.jsp.webcontainerext.JSPExtensionProcessor.handleRequest (JSPExtentionProcessor.java:228)

SOLUTION

All the JSP pages it must have to be in web module root ,not in META-INF and WEB-INF



To find the initial file for the application (for example, index.jsp), you can look at the welcome file list in the Web deployment descriptor. As per J2EE specification, JSP files should reside under web module root or under sub directory other than META-INF and WEB-INF.



Lovelesh Singh J
Jun 14, 2012
#179
Hi, I do not get error message, but ModelAndView object from controller does not pass to jsp. It does not print the message, when I execute the program. Please let me know where I am doing wrong. Thanks Jay
Anush
Jun 21, 2012
#180
Run it from the link
: http://localhost:portno/SpringMVCTest/hello_world.html
and
place the jsp pages outside the Web-INF.

Jul 5, 2012
#181
Nice work! In the keeping it simple and flexible I am giving you highest marks. Consequently this still works with Spring 3.1.2 and Tomcat6 (likely with 7 if Ubuntu played nice with 7).

You will need add to WEB-INF/lib 2 more jars (not shipped with current Spring dist):

Apache Commons Logging (I got commons-logging-1.1.1.jar)
http://commons.apache.org/logging/

Java Standard Tags Library (I got jstl-1.2.jar)
http://repo2.maven.org/maven2/javax/servlet/jstl/1.2/
John M I Davis
Aug 18, 2012
#182
Greate work, thank you. I have successfull at my first attemt
Archana
Oct 6, 2012
#183
HI,
please the msg can't be displayed !
i dont no just how does webside invoke serverside so
that ${message} is known by the browser
i dnt work !!
SamSam
Nov 15, 2012
#184
Thanks ...
Bharat
Nov 22, 2012
#185
HTTP Status 404 - /MyApp/
type Status report

message /MyApp/

description The requested resource (/MyApp/) is not available.

Venki
Nov 26, 2012
#186
Great job ......keep it up
ramukjar
Dec 18, 2012
#187
Good work.. keep it up. Thanks for sharing this example
pradeep
Jan 7, 2013
#188
Excellent work!
Ish
May 29, 2013
#189
How does the Spring configurations work in general?
Let us say that an application is run. What happens from here?
Please explain step by step.
The container looks for the context-path and what happens from there on?

Is there a possibility for you to post a reply here or a new post itself.
Thanks in advance.
Freakyuser
Jun 12, 2013
#190
Thank you, this tutorial help me a lot.
I got 404 error too, but I solved it.
I use spring 3.2.3, and it need some more jar files, like spring-context.jar, spring-context-support.jar, spring-expression.jar,...
For everyone who got 404 error, may be your tomcat server miss some spring jar file, just look at your server log to see what the problem is.
Shreffix
Jul 11, 2013
#191
hi every one
i tried this application but still i am getting an error as shown below please help me..

SEVERE: Error loading WebappClassLoader
delegate: false
repositories:
/WEB-INF/classes/
----------&gt; Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@10dd1f7
org.springframework.web.servlet.DispatcherServlet
java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1516)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1095)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4187)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4496)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
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:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Aug 23, 2013 3:13:15 PM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet /springmvc threw load() exception
java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1516)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1095)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4187)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4496)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
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:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Aug 23, 2013 3:13:15 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Aug 23, 2013 3:13:15 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Aug 23, 2013 3:13:15 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/31 config=null
Aug 23, 2013 3:13:15 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 287 ms
sivakondalu
Aug 23, 2013
#192
This is not working. Kindy shut down this page as it waste a lot of tie for the viewers trying to make this work when it actually does not or it may be lack of instructions.
Jolly Tilo
Oct 17, 2013
#193
ALL MISSING SOLUTIONS
#####################

1) javax.servlet dependency (with maven, pom.xml file) read here: http://stackoverflow.com/questions/1979957/maven-dependency-for-servlet-3-0-api

2) Remove all previously compiled classes and compile them again before starting webserver

3) Use this in JSP file:
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>

4) Use this in JSP file to display parameter:
<c:out value="${message} "/>

stu
Jan 22, 2014
#194
Thank you for this tutorial. It is a great learning resource for someone knew to Spring. There were a few steps where I had confusion, I couldn't find all the jar libraries to add, but netbeans had bundled a few libraries and I included two spring related libs, one was MVC and the other was spring framework. I also did not quite see where the output of the ant command was going, but I was doing this in netbeans so I was able to hobble along and get it to work. Great job
dreamer
Jan 23, 2014
#195