Announcement Announcement Module
Collapse
No announcement yet.
XmlWebApplicationContext and classpath Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • XmlWebApplicationContext and classpath

    Hi!

    I am using WebSphere 5.1 as an application server, and therefore (as it says in the api), I need to use a ContextLoaderServlet instead of a listener in order to load my applicationContext.

    My problem is that my applicationContext.xml is located in a shared resource (jar) which is in the classpath. Therefore, I would like to use something like ClassPathXmlApplicationContext to load the config.

    However, ClassPathXmlApplicationContext is not of type ConfigurableWebApplicationContext and therefore I get an initialization failure when trying to use it together with the ContextLoaderServlet (given as a context parameter)

    How can I load a applicationContext.xml into a web environment when the file is NOT placed in Web-Inf, but rather in a shared jar-file?

    Any help is greately appreciated! Thanks.

    /Niklas

  • #2
    Does this help?
    http://forum.springframework.org/showthread.php?t=10248
    Last edited by robyn; May 19th, 2006, 06:06 AM.

    Comment


    • #3
      Problem solved!

      Yes, great!! I must have missed that post...

      I actually solved my problem (while waiting for answers) by extending XmlWebApplicationContext and override getDefaultConfigLocations() to manually look up my resource from the classpath using spring's ClassPathResource, and also pointing out my subclass with the "contextClass" servlet context parameter.

      But using the "classpath:" prefix as suggested by your post is far more elegant. I will switch to that solution.

      Thanks!
      /Niklas

      Comment

      Working...
      X