File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Yuta Lolap
Ranch Hand
Posts: 86
Eclipse IDE Java jQuery
  • 0
  • 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?

 
Prajakta Acharya
Ranch Hand
Posts: 138
Java Spring
  • 0
  • 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?
 
Sahil Thadhani
Greenhorn
Posts: 1
  • 0
  • 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.
 
Bill Gorder
Bartender
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • 0
  • 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
Eclipse IDE Java jQuery
  • 0
  • 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
Eclipse IDE Java jQuery
  • 0
  • 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
Eclipse IDE Java jQuery
  • 0
  • 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!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic