• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Strange STS behavior in the creation of Spring MVC project using STS template help, wrong URL

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am quite new in the Spring MVC world and I have a doubt about the corretct creation of a Spring MVC project.

When I run an imported project (for example the Spring MVC Showcase example downlodable form the STS dashboard), inside the browser URL bar this project have an URL like: http://localhost:8080/project-name/

For example the Web MVC Showcase example have project name: "spring-mvc-showcase" and have the following URL: for example the Web MVC Showcase example have project name: "spring-mvc-showcase" and have the following URL: http://localhost:8080/spring-mvc-showcase/

Now, my doubt is related to the creation of a new Spring MVC project using Spring Template in STS\Eclipse.

I do the following operation inside STS:

File --> New --> Project and appears to me a wizard where I can chose the type of project.

So I chose Spring Template Project, now appears to me ano other wizard windows where I can chose the specific typology of Spring Project and I chose "Spring MVC Project"

Ok, now appears to me an other wizard windows in which I have to set up:
Project name and I insert: my-spring-project
Top level package and I have insert: org.mycompany.foo

Ok, now I run my project on server, this don't run and inside the URL bar of the browser I have not http://localhost:8080/my-spring-project/ (as I would expect) but I have: http://localhost:8080/foo/

In the stacktrace I have the following error message:

WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/foo/] in DispatcherServlet with name 'appServlet'

Then if I do a project clean of my project, STS rebuild the project and if I try to run it again the project run well and the URL address still remain: http://localhost:8080/foo/

I think that this is a strange behavior and I have not ideas what is the reason about it...

So:

1) Why the URL is not http://localhost:8080/my-spring-project/ but is http://localhost:8080/foo/ ?

2) Why I have to clean and rebuild my project to run it?

3) I am doing some error in the creation of a standard Spring MVC project?

I am going crazy...

Thank you very much

Andrea
 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Click your server in your servers are and select the module tab. It should show you your deployed application. Look at the path, this is your context root. You need to type you context root followed by whatever you have mapped. So if you have a request mapping with a value of "/foo" you would go to http://localhost:8080/my-context-root/foo
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic