[jboss-jira] [JBoss JIRA] (JBWEB-235) "max-active-sessions" functionality to limit the number of sessions works as designed, but does not result in a (configured) error page to be shown to the end-user

Remy Maucherat (JIRA) jira-events at lists.jboss.org
Mon Mar 26 11:23:47 EDT 2012


     [ https://issues.jboss.org/browse/JBWEB-235?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Remy Maucherat resolved JBWEB-235.
----------------------------------

    Resolution: Rejected


JspFactory.getPageContext does not have throws in its signature while PageContext.initialize does. Including an explicit throws IllegalStateException. So this means that the JspFactory implementation should (for whatever reason) catch and log exceptions, since otherwise it would have the same throws clause as PageContext.initialize. Since the exception is caught, no error page is then invoked by the servler container.

To avoid the issue, it is best to use a filter doing request.getSession(true).
                
> "max-active-sessions" functionality to limit the number of sessions works as designed, but does not result in a (configured) error page to be shown to the end-user
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: JBWEB-235
>                 URL: https://issues.jboss.org/browse/JBWEB-235
>             Project: JBoss Web
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: Tomcat
>    Affects Versions: JBossWeb-2.1.12.GA
>         Environment: all
>            Reporter: Tom Fonteyne
>            Assignee: Jean-Frederic Clere
>         Attachments: sessionlimit.war, source.tar.gz
>
>
> Configuring a webapp via jboss-web.xml to limit (and passivate) the number of active sessions work fine, and an exception gets thrown/logged in the server.log:
> 16:45:03,454 FATAL [JspFactoryImpl] Exception initializing page context
> java.lang.IllegalStateException: createSession(): number of active sessions exceeds the maximum limit: 2 when trying to create session
>         at org.jboss.web.tomcat.service.session.JBossCacheManager.createSessionInternal(JBossCacheManager.java:497)
>         at org.jboss.web.tomcat.service.session.JBossCacheManager.createSession(JBossCacheManager.java:448)
>         at org.apache.catalina.connector.Request.doGetSession(Request.java:2373)
>         at org.apache.catalina.connector.Request.getSession(Request.java:2100)
>         at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:833)
>         at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:844)
>         at org.apache.jasper.runtime.PageContextImpl._initialize(PageContextImpl.java:146)
>         at org.apache.jasper.runtime.PageContextImpl.initialize(PageContextImpl.java:124)
>         at org.apache.jasper.runtime.JspFactoryImpl.internalGetPageContext(JspFactoryImpl.java:107)
>         at org.apache.jasper.runtime.JspFactoryImpl.getPageContext(JspFactoryImpl.java:63)
>         at org.apache.jsp.index_jsp._jspService(index_jsp.java:44)
> ...
> so far so good. But, we would expect "java.lang.IllegalStateException" to cause the error mechanisme to kick in due to in web.xml:
>     <error-page>
>         <exception-type>java.lang.IllegalStateException</exception-type>
>         <location>/max.html</location>
>     </error-page>
> This does not happen, and the end-user is presented with an empty screen in his browser likely thinking that the site went down.
> Note that when the 3th user hits a servlet at his first request, the error-page is shown correctly - so this issue is limited to Jasper.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list