• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Spring: Getting web ContextLoaderListener to start without a Servlet...

 
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm writing a simple Spring/Quartz/Hibernate-based job scheduling system (as a web application), and trying to get the Spring ContextLoaderListener to pick up my context.xml. I don't know much about the whole j2ee lifecycle thing, but when I deploy my WAR file, Tomcat picks it up and explodes it, but the ContextLoaderListener never kicks off (never loads my context.xml file). No exceptions, just... nothing.

Here's the web.xml:


Yeah, that's the WHOLE thing. I'm guessing the listener isn't firing because there's just no context to load. Is that possible? How can I force the listener to fire when my entire application is essntially contained in Spring-Injected beans?

help!
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is all you need.

But I think this is wrong

<param-value>/WEB-INF/config/context.xml</param-value>

Try to remove the WEB-INF part, because iirc WEB-INF is the location that it is automatically looked at.

For instance, if you were to name the file applicationContext.xml and put it in the WEB-INF folder at its root, then you don't need the <context-param> tags anymore, because applicationContext.xml is the default file name it searches for if you don't put in a <context-param> tag in your web.xml

Mark
 
Philippe Desrosiers
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Mark!

I've actually used this exact same config in other projects (where there was a servlet configured), and it worked fine, so I don't think that's it. Check out this Spring Beans Docs. They also mention using the ContextLoaderServlet, guess I could do, although I hear that's been deprecated in favor of ContextLoaderListener...

UPDATE: Yeah, ContextLoaderServlet doesn't exist in Spring 3.0.0M1, so that won't work :-(
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic