• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Spring DI help

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We'll just get it out there that I'm very new to Spring and just trying to get my feet wet.

That said, I walked through the tutorial: http://static.springframework.org/docs/Spring-MVC-step-by-step/index.html and everything worked fine. A little bit of my problem is that the tutorial covers a bit too much, I'm working with an old servlet and just trying to wade my way into spring (DI in particular) with. So the basic set up is that my servlet uses a class called KMLCreator, no big deal. It's within that class that I want to inject an object called Config. The Config object is a custom Config object that takes and InputStream of an xml file. The KMLCreator will use the config object to pull a few application config parameters.



I'm really not sure if I'm approaching this correctly, so please feel free to comment on that in general. I hope my little preamble made it clear what I'm attempting to do. The error I get is below.

Thanks,
Matt

 
Ranch Hand
Posts: 471
Mac OS X Hibernate Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, everything spring related seems fine to me. The problem you're having is that your code can't find kmlservlet_config.xml. Make sure that the file is available in the place your code looks for it. Go into debug mode in your IDE, and see the absolute path of the file referenced in the code, and make sure that its there.
 
Matt Zollinhofer
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for the response. I put the file at the root of the classpath and up until now I've just been doing:


which has worked fine. I just don't know how to reference the same thing from the spring point of view. Does it just look on the classpath? I'm not exactly sure what you mean about using the debugger to find the absolute path to the file, could you explain that?

Thanks
Matt
 
Squanch that. And squanch this tiny ad:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic