2

please help me to figure out this strange behavior, I have a project based on Spring here https://github.com/riuvshin/spring-mvc-learn and I want deploy *.war to tomcat 7.0. When I deploy that war to clean tomcat according to logs it's should work every thing is ok, but when I try to open localhost:8080/contacts I've got 404 error...

If I launch that application from my IDE (intellij) it works fine, I will be super happy if any one can explain me what I missed.

Roman Iuvshin
  • 1,872
  • 10
  • 24
  • 40
  • Post the relevant areas of the `catalina.out` log file. – Sotirios Delimanolis Sep 02 '13 at 14:18
  • here is my output: http://freetexthost.com/oq0xlzi3f5 – Roman Iuvshin Sep 02 '13 at 14:25
  • I dont think those logs contain a trace of when you got the 404. Can you upload that? Also what are you using to build a WAR? Maven if so it looks like your not including the required config files in the war, which could be on your classpath in your ide – irishguy Sep 02 '13 at 14:28
  • there is no any traces on console, 404 I've got in browser when trying to open application url. I am using maven (mvn clean install) then get war file from /temp folder and put it in to tomcat/webapps – Roman Iuvshin Sep 02 '13 at 14:33

1 Answers1

3

The catalina.out log clearly shows that your @Controller is mapped to the path /contacts

INFO : org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/contacts],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.apress.prospring3.ch17.web.controller.ContactController.list(org.springframework.ui.Model)

However you are trying to access this handler with the path

localhost:8080/contacts 

This will only work if you webapp is configured to have a context path of / and I'm pretty sure it isn't.

Try using

localhost:8080/[myapp]/contacts

where [myapp] is the name of your application's folder in the webapps folder.

See this answer on how to change that path.

Community
  • 1
  • 1
Sotirios Delimanolis
  • 274,122
  • 60
  • 696
  • 724