Announcement Announcement Module
Collapse
No announcement yet.
HttpSessionEventPublisher exception at application starting Page Title Module
Move Remove Collapse
This topic is closed
X
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • HttpSessionEventPublisher exception at application starting

    Hi all.

    Im using spring + acegi security + tomcat 5.0.28.

    When i deply the app and i start it, tomcat says it cant because this exception:

    Code:
    2005-10-07 15:59:44 StandardContext[/manager]Manager: start: Starting web application at '/latrastienda'
    2005-10-07 15:59:44 StandardContext[/latrastienda]Exception sending context initialized event to listener instance of class net.sf.acegisecurity.ui.session.HttpSessionEventPublisher
    java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?
    	at org.springframework.web.context.support.WebApplicationContextUtils.getRequiredWebApplicationContext(WebApplicationContextUtils.java:83)
    	at net.sf.acegisecurity.ui.session.HttpSessionEventPublisher.contextInitialized(HttpSessionEventPublisher.java:73)
    	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
    	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4343)
    	at org.apache.catalina.core.StandardHostDeployer.start(StandardHostDeployer.java:830)
    	at org.apache.catalina.core.StandardHost.start(StandardHost.java:991)
    	at org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1322)
    	at org.apache.catalina.manager.ManagerServlet.doGet(ManagerServlet.java:345)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
    	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
    	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
    	at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
    	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
    	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540)
    	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
    	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
    	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
    	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
    	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
    	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
    	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
    	at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
    	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
    	at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
    	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
    	at java.lang.Thread.run(Thread.java:534)
    
    2005-10-07 15:59:44 StandardContext[/latrastienda]Loading Spring root WebApplicationContext
    2005-10-07 15:59:44 StandardContext[/latrastienda]Set web app root system property: 'latrastienda.root' = [/usr/local/share/jakarta-tomcat-5.0.28/webapps/latrastienda/]
    2005-10-07 15:59:44 StandardContext[/latrastienda]Initializing Log4J from [/WEB-INF/log4j.properties]
    2005-10-07 15:59:45 StandardContext[/latrastienda]Shutting down Log4J
    2005-10-07 15:59:45 StandardContext[/latrastienda]Closing Spring root WebApplicationContext
    It seems that HttpSessionEventListener acts before the web context is loaded. This is my web.xml:

    Code:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app PUBLIC 
    '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' 
    'http&#58;//java.sun.com/dtd/web-app_2_3.dtd'>
    
    <web-app>
    
    	<context-param>
    		<param-name>webAppRootKey</param-name>
    		<param-value>latrastienda.root</param-value>
    	</context-param>
    	
    	<!-- Log4j -->
    	<context-param>
    		<param-name>log4jConfigLocation</param-name>
    		<param-value>/WEB-INF/log4j.properties</param-value>
    	</context-param>
    
    	<listener>
    		<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
    	</listener>
    	
    	<!-- Context -->
    	<context-param>
    		<param-name>contextConfigLocation</param-name>
    		<param-value>
    			/WEB-INF/applicationContext-security.xml
    		</param-value>
    	</context-param>
    
    	<listener>
    		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    	</listener>	
    
    	<!-- Datos de la aplicación -->
    	<display-name>La Trastienda</display-name>
    	<description>Herramienta de desarrollo colaborativo</description>
    	
    	<!-- Authentication processing filter -->
    	<filter>
        	<filter-name>Acegi Filter Chain Proxy</filter-name>
            <filter-class>net.sf.acegisecurity.util.FilterToBeanProxy</filter-class>
            <init-param>
                <param-name>targetClass</param-name>
                <param-value>net.sf.acegisecurity.util.FilterChainProxy</param-value>
            </init-param>
       	</filter>
        <filter-mapping>
        	<filter-name>Acegi Filter Chain Proxy</filter-name>
          	<url-pattern>/*</url-pattern>
        </filter-mapping>
    
        <!-- Para evitar a un mismo usuario identificarse dos veces simultáneamente --> 	
        <listener>
            <listener-class>net.sf.acegisecurity.ui.session.HttpSessionEventPublisher</listener-class>
        </listener>
        
     	<session-config>
     		<session-timeout>30</session-timeout>
     	</session-config>
    
    	<!-- servlets -->
    	<servlet>
        	<servlet-name>latrastienda</servlet-name>
        	<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        	<load-on-startup>1</load-on-startup>
      	</servlet>
    
    	<servlet-mapping>
        	<servlet-name>latrastienda</servlet-name>
        	<url-pattern>*.html</url-pattern>
      	</servlet-mapping>
      	
    	<!-- Página de entrada -->
      	<welcome-file-list>
        	<welcome-file>index.jsp</welcome-file>
    	</welcome-file-list>
    	
     </web-app>
    I have found that the order its really critical in the web.xml so am i doing something bad in the web.xml? is it maybe a tomcat version problem?

    Thx

  • #2
    The ContextLoaderListener <listener> needs to be defined after the last <filter-mapping>.

    Comment


    • #3
      Thx. But that was not the problem. It seems that tomcat has problems managing two app running the acegi stuff at same time.

      I had deployed the acegi-sample-app while i tried to start my app. I undeployed the acegi sample and it worked.... :O


      Thx again.

      Comment

      Working...
      X