Unable to run spring template project on STS
Asked Answered
W

3

1

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

127.0.0.1 localhost

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

Thanks.

Willock answered 8/5, 2011 at 12:23 Comment(0)
D
0

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".

Doloroso answered 8/5, 2011 at 12:42 Comment(1)
The web.xml does not say anything about "sample", it just matches <servlet-mapping><servlet-name>appServlet</servlet-name><url-pattern>/</url-pattern></servlet-mapping>. Doesn't it means matching / to the appServlet servlet-name?Willock
U
0

Template project does not work for me either.

I changed the servlet mapping onto

<servlet-mapping>
    <servlet-name>appServlet</servlet-name>
    <url-pattern>*.do</url-pattern>
</servlet-mapping>

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

Unwind answered 29/11, 2011 at 10:16 Comment(0)
I
0

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.

Islet answered 10/1, 2012 at 22:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.