Unable to run spring template project on STS

By : tintin
Source: Stackoverflow.com

I created a template project named sample and started it with spring tc server. The application gets deployed but then when I go to http://localhost:8080/sample/ I get the following error

INFO: Server startup in 12669 ms WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/sample/] in DispatcherServlet with name 'appServlet'

I followed the same steps as shown in http://www.youtube.com/watch?v=Y0V4oEnCcyA to create a spring web App.

I asked my friend to follow the same steps and test it on his Ubuntu 10.04 machine and it worked fine out of the box. I came up with the conclusion that it must be something with my machine. I'm facing this problem on Mac osx 10.4 and SpringSource Tool Suite Version: 2.6.0.RELEASE

My host file contains the following entry localhost

Can anyone guide me as to how to rectify this problem?


By : tintin

That warning means that you didn't set something up right in your project, plain and simple. Without code we can only guess.

Speaking of guessing, check your web.xml and make sure it actually says "sample".

Template project does not work for me either.

I changed the servlet mapping onto


Follow up the request mapping in the controller

@RequestMapping(value = "/home.do", method = RequestMethod.GET)

Now you can open http://localhost:8080/sample/home.do

By : banterCZ

Check the log in your eclipse server console window (bottom screen). If you're like me, there's a bug when resolving the path for the home.jsp file. It comes from the servlet-context.xml file :

<beans:property name="suffix" value="/" />

should be

<beans:property name="suffix" value=".jsp" />

Make sure you clean and restart the server after doing that change, because it seems like this servlet-context.xml file is heavily cached.

By : Ben G

This video can help you solving your question :)
By: admin