Results 1 to 2 of 2

Thread: ClassPathXmlApplicationContext + Acegi

  1. #1

    Default ClassPathXmlApplicationContext + Acegi

    Hi all

    i'm loading my spring resources in a InitServlet with the ClassPathXmlApplicationContext. That means i have no SpringContextLoader Listener defined in my web.xml. How does that work now with acegi?

    In my web.xml i registered the security filter:
    <filter>
    <filter-name>securityFilter</filter-name>
    <filter-class>org.acegisecurity.util.FilterToBeanProxy</filter-class>
    <init-param>
    <param-name>targetClass</param-name>
    <param-value>org.acegisecurity.util.FilterChainProxy</param-value>
    </init-param>
    </filter>


    And my Servlet which initializes the context:
    <servlet>
    <servlet-name>propertiesInit</servlet-name>
    <description>Initializes the properties...</description>
    <servlet-class>
    najsre7.webapp.action.start.PropertiesInitServlet
    </servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>


    So if i try to start my application i get the following error:
    java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?
    at org.springframework.web.context.support.WebApplica tionContextUtils.getRequiredWebApplicationContext( WebApplicationContextUtils.java:86)


    I also tried to use the ContextListener, but then my Spring files are loaded twice! Once with the COntextListener and once in my PropertiesInitServlet. Maybe there is a way to access the Spring Context in my PropertiesInitServlet, so i don't have to load it twice.

    Any ideas what's the best solution?

    Kind regards
    Angela

  2. #2
    Luke Taylor is offline Senior Member Acegi Security System TeamSpring Team
    Join Date
    Aug 2004
    Location
    Glasgow, Scotland
    Posts
    3,449

    Default

    This doesn't look like it has anything to do with Acegi. Is there a reason why you can't use one of the standard Spring context loaders? If so, you will have to mimic the same behaviour which involves storing the app context in the ServletContext.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •