No Application in the thread when the web server destroys WicketFilter
----------------------------------------------------------------------

                 Key: WICKET-3168
                 URL: https://issues.apache.org/jira/browse/WICKET-3168
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.5-M3
            Reporter: Martin Grigorov


Playing with Wicket 1.5 + Google AppEngine I saw this exception after modifying 
appengine-web.xml:

WARNING: EXCEPTION 
org.apache.wicket.WicketRuntimeException: There is no application attached to 
current thread Timer-2
        at org.apache.wicket.Application.get(Application.java:250)
        at org.apache.wicket.Session.get(Session.java:154)
        at 
org.apache.wicket.page.DefaultPageManagerContext.getSessionAttribute(DefaultPageManagerContext.java:63)
        at 
org.apache.wicket.pageStore.memory.HttpSessionDataStore.getPageTable(HttpSessionDataStore.java:130)
        at 
org.apache.wicket.pageStore.memory.HttpSessionDataStore.destroy(HttpSessionDataStore.java:116)
        at 
org.apache.wicket.pageStore.DefaultPageStore.destroy(DefaultPageStore.java:66)
        at 
org.apache.wicket.page.PersistentPageManager.destroy(PersistentPageManager.java:374)
        at 
org.apache.wicket.page.PageManagerDecorator.destroy(PageManagerDecorator.java:86)
        at org.apache.wicket.Application.internalDestroy(Application.java:839)
        at 
org.apache.wicket.protocol.http.WebApplication.internalDestroy(WebApplication.java:440)
        at 
org.apache.wicket.protocol.http.WicketFilter.destroy(WicketFilter.java:437)
        at 
org.mortbay.jetty.servlet.FilterHolder.destroyInstance(FilterHolder.java:127)
        ....

I.e. the asynchronous thread that destroys WicketFilter has no ThreadContext 
thread local and thus this exception.

I see two problems/solutions:
1) HttpSessionDataStore should have noop #destroy() - the Application is being 
destroyed, so all its http sessions will be deleted and there is no need to 
clean the special attribute which stores session's pages
2) WicketFilter#destroy() can set/unset the application in ThreadContext, so 
other functionality in all #destroy() methods will have access to the 
Application via Application.get()

Any objections ?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to