Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification 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
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

springDispatcher-servlet.xml: java.io.FileNotFoundException

 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,
I'm new to Spring framework, I'm trying to build the sample application mentioned in http://www.springframework.org/docs/Spring-MVC-step-by-step/part1.html
In the example it is not mentioned that we need to put springDispatcher-servlet.xml in WEB-INF folder but When I start the tomcat server, I get the folloiwng exception:

org.springframework.beans.
factory.BeanDefinitionStoreException:
IOException parsing XML document from ServletContext
resource [/WEB-INF/springDispatcher-servlet.xml]; nested exception is
java.io
FileNotFoundException: Could not open ServletContext
resource [/WEB-INF/springDispatcher-servlet.xml]
at org.springframework.beans.
factory.xml.XmlBeanDefinitionReader.
loadBeanDefinitions
(XmlBeanDefinitionReader.java:320)
at org.springframework.beans.factory.
xml.XmlBeanDefinitionReader.loadBeanDefinitions
(XmlBeanDefinitionReader.java:290)
at org.springframework.beans.factory.
...


Pls help me out of this...
Syam
 
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

they call the servlet 'springapp' and thus the .xml file 'springapp-servlet.xml' and they do put it in the WEB-INF directory.

see 1.6

Herman
 
Shyam kumar
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok... I'll try it out and let you know if this works or not. By the way I'm using Spring 2.5 jars along with tomcat 5.0 and jdk1.4
Is this configuration ok? Iam aware that it is given in the step-by-step example that you need jdk 1.5 and tomcat 6.X
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Iam aware that it is given in the step-by-step example that you need jdk 1.5 and tomcat 6.X


I would follow the instructions to avoid unecessary hair pulling

And as Herman said, it is "springapp-servlet.xml", not "springDispatcher-servlet.xml". What name did you give to the DispatcherServlet in web.xml ? If you call it "springDispatcher", Spring will look for "springDispatcher-servlet.xml". So name the DispatcherServlet "springapp", as written in the tutorial.
 
Shyam kumar
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Herman/Christopher, This problem is resolved by changing the sevleate name in web-xml.
 
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and BTW the JDK 1.5 requirement is because later in the example they have used GENERICS. Otherwise, I was able to do the example using JRE 1.4 by using the 1.4 syntax.
 
A lot of people cry when they cut onions. The trick is not to form an emotional bond. This tiny ad told me:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!