Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Where should web.xml nd psring-servlet.xml be placed in the project struture?

 
Ranch Hand
Posts: 86
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Where should the web.xml and the mvc-dispatcher-servlet.xml be placed exactly in the project structure? Should it be in WEB-INF directly or some place else?

Also i am getting ClassNotFoundException for DispatcherServlet when i am trying to render the jsp. I have loaded all the jars that are required.

The web.xml and spring-servlet.xml are inside WEB_CONTENT/WEB-INF .

Please can you tell me as to why this exception would occur?

 
Ranch Hand
Posts: 138
Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

If you are getting a ClassNotFoundException for DispatcherServlet, that means the container is able to forward request to the Spring controller, which means web.xml is being referred correctly.
I hope you have kept all Spring specific jars in WEB-INF\lib.
Are you using Eclipse for deployment? Quite possible that there is some deployment issue.
Can you check at installed location on server that it is deployed properly?
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can also see if you have included web and web-mvc jar of springs. They also need to be checked. You can also refer to the classpath and see if all the jars are getting picked up. Placing the two files in WEB-INF usually does not create problem.
 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
web.xml should be directly under WEB-INF.

I would hope you use Maven or an alternative build tool to manage your dependencies. The Spring context XMLs can be placed in a number of different places. I suggest you read the following blog by one popular Spring evangelist and Spring trainer. He shows in this blog the entire project structure that he uses. Consequently very similar to that produced by the Spring Roo project which he is very involved with.

http://gordondickens.com/wordpress/2012/07/03/enterprise-spring-best-practices-part-1-project-config/
 
Yuta Lolap
Ranch Hand
Posts: 86
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Prajakta i checked the tomcat installation folder. Yes i am using eclipse. Yes the jars are under the lib folder too.
 
Yuta Lolap
Ranch Hand
Posts: 86
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bill Gorder wrote:web.xml should be directly under WEB-INF.
/



It is under WEB-INF i want to learn the basic setup without maven.
 
Yuta Lolap
Ranch Hand
Posts: 86
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Sahil Thadhani wrote:You can also see if you have included web and web-mvc jar of springs. They also need to be checked. You can also refer to the classpath and see if all the jars are getting picked up. Placing the two files in WEB-INF usually does not create problem.



All the jars are getting picked up!
 
Time is mother nature's way of keeping everything from happening at once. And this is a tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic