• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Not able to run basic spring mvc example? -- Resource not found

 
Ranch Hand
Posts: 270
Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
web.xml



spitter-servlet.xml


homeController.java




I am giving the url as http://localhost:8080/SpringMvcExample/home.jsp

and the error is resource not found...In tomcat log i found that showHomePage is invoked..SOP from showHomePage is logged..

whats wrong here?

Please help me..

Thanks in advance..

P.S.: Same posted on stackexchange.com link
 
Ranch Hand
Posts: 672
4
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First, there is no need for you to initialize spitter-servlet.xml using context-param in web.xml, spring libraries will do it for you..
Try, mapping *.htm requests to springs dispatcher servlet, instead of *.jsp..
 
Karnati Sudhakar
Ranch Hand
Posts: 270
Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Prasad Krishnegowda wrote:First, there is no need for you to initialize spitter-servlet.xml using context-param in web.xml, spring libraries will do it for you..



Prasad thanks for your reply..

I commented the following code in web.xml


and i am getting the below error:

I think the above line is necessary as i don't have root level context..i just have dispatcher servlet context.

exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml]

Prasad Krishnegowda wrote:Try, mapping *.htm requests to springs dispatcher servlet, instead of *.jsp..



Same error..

Any other suggestions guys..


EDITED: Prasad, I did not do it correctly, what you said is correct and it is working now..Thanks for reply
 
Karnati Sudhakar
Ranch Hand
Posts: 270
Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys,

This question has been resolved..Please follow this link for the answer link

The issue is for dispatcher servlet url mapping should not be *.jsp..

I don't know why?
 
Prasad Krishnegowda
Ranch Hand
Posts: 672
4
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Karnati Sudhakar wrote:Guys,


The issue is for dispatcher servlet url mapping should not be *.jsp..

I don't know why?



This is because, your view also is a JSP, so when the view is rendered it maps to some .jsp page, and the controller again will route it to spring dispatcher servlet... This results in JSP pages not been rendered..
Anyway, glad that it is working now..
 
Karnati Sudhakar
Ranch Hand
Posts: 270
Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Prasad Krishnegowda wrote:

Karnati Sudhakar wrote:Guys,
The issue is for dispatcher servlet url mapping should not be *.jsp..
I don't know why?


This is because, your view also is a JSP, so when the view is rendered it maps to some .jsp page, and the controller again will route it to spring dispatcher servlet... This results in JSP pages not been rendered..
Anyway, glad that it is working now..



Thanks buddy..seems like these kind of concepts can be learn only through experience..

Thanks for your time.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic