Struts 2
  1. Struts 2
  2. WW-3772

Struts 2, Thread Locals reported by Tomcat after web application is stopped


    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Duplicate
    • Affects Version/s:,,
    • Fix Version/s: 2.3.3
    • Component/s: Dispatch Filter, Other
    • Labels:
    • Environment:

      Windows 7, Struts, Spring 3.0.1


      When stopping or undeploying my struts 2 web app in Tomcat (7.0.23) I get several severe warnings from tomcat:

      SEVERE: The web application [/myapp] created a ThreadLocal with key of type [com.opensymphony.xwork2.inject.ContainerImpl$10] (value [com.opensymphony.xwork2.inject.ContainerImpl$10@1376afa]) and a value of type [java.lang.Object[]] (value [[Ljava.lang.Object;@15075f9]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.

      I've hunted all over the web and found this error repeated in several places, but I haven't yet found a solution. I then found some posts that lead me to believe this was a problem in the xwork libs but that it had been resolved in the latest version:

      I also found a reference suggesting this could be a problem with using the deprecated FilterDispatcher rather than a StrutsPrepareAndExecuteFilter:

      I was originally using Struts and upgraded to the latest ( which didn't solve the problem, nor did switching back and forth between the FilterDispatcher and StrutsPrepareAndExecuteFilter.

      I also tried an IntrospectorCleanupListener as a shot in the dark but to no avail.

      If I comment out the StrutsPrepareAndExecuteFilter and deploy/stop the web app, the severe warnings regarding ThreadLocals go away (though obviously my web app no longer works).

      I sought further advice on the Struts 2 user mailing list as well as a couple web forums but didn't get any further suggestions other than to file a bug on JIRA.

      It seems at least a few others are experiencing the same issue. From my experimentation it seems something related to the StrutsPrepareAndExecuteFilter starts off threads on startup but they are not shut down properly. I could not find any documentation on additional cleanup I might perform to force any threads started by struts to shutdown.

        Issue Links



            • Assignee:
              Rene Gielen
              Tom Kimzey
            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created: