Win a copy of Getting started with Java programming language this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Spring MVC project retunrs 404 in Eclipse IDE  RSS feed

 
Naveen N Kumar
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an issue in running a Spring MVC project on tomcat in eclipse IDE, when I launch the URL, I get 404. The same code is working perfectly fine when I create a war file and deploy from tomcat console.
Does anyone had this issue ? Any inputs would be greatly appreciated, I have been spending lot of time to test small change.
 
Tim Nachreiner
Ranch Hand
Posts: 33
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you say "launch the url", are you doing a right click on your project, then Ran As, then Run on Server?  Sounds more like you are doing all that directly on the .jsp file.
 
Naveen N Kumar
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Tim
I was working on a maven project and when I clean and recompile the project and deploy on Tomcat  which is added Eclipse I get 404 error,

although same is working when I create a war and deploy from tomcat console.

If I don't clean the project, it works fine, wondering whats happening behind ??
 
Tim Nachreiner
Ranch Hand
Posts: 33
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First: Do you have the tomcat plugin in your pom.xml file?

Second: You need to remember that doing a Maven clean install does not start the tomcat server, that's why you are getting the 404 error.

You should launch your application by right-clicking, choosing Run-as, Maven build..., then enter tomcat7:run in the Goals text box (this assumes you have the tomcat7 plugin configured in your pom.xml file.

I'm assuming you are following an online tutorial.  Which one is it?
 
Naveen N Kumar
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Tim

I don't have tomcat plugin in POM.xml. I would give a try with plugin.  I am following JavaBrains tutorials on YouTube and Spring/Hibernate reference documents.

Thanks for your reply
 
Mayank Kumar Sharma
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Naveen

First. Please check location of web pages, are they placed in webcontent folder or not.

Second, also check the path of index page. Is is correct or not


I think there is no need of tomcat plugin in pom.xml


we can add apache tomcat from add server option in IDE.


You may need to add servlet dependency ....


 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!