mirror of
https://github.com/apache/struts.git
synced 2026-08-05 14:47:09 +00:00
0a8b111e36
* WW-5537 fix(core): resolve classloader/memory leaks during Tomcat hot deployment Introduce InternalDestroyable interface with container-based discovery to clean up static caches, daemon threads, and shared references that pin the webapp classloader after undeploy. This prevents OutOfMemoryError (Metaspace) on repeated hot deployments. Changes: - Add InternalDestroyable/ContextAwareDestroyable interfaces for cleanup hooks - Clear OGNL, Component, ScopeInterceptor, DefaultFileManager static caches - Stop FinalizableReferenceQueue daemon thread and null its classloader - Clear FreeMarker template/introspection caches from ServletContext - Replace ContainerHolder ThreadLocal with volatile to prevent thread-pool leaks - Clear static dispatcherListeners list on Dispatcher cleanup - Add JSONCacheDestroyable for json plugin cache cleanup - Register all destroyables via struts-beans.xml / struts-plugin.xml Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * WW-5537 chore(showcase): add log4j-web for proper Log4j2 lifecycle in Servlet container Without log4j-web, Log4j2 SoftReferences delay classloader GC after undeploy. The log4j-web module provides Log4jServletContextListener which ensures proper Log4j2 shutdown during ServletContext destruction. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * WW-5537 fix(core): use ThreadLocal with generation counter in ContainerHolder Replace the volatile shared reference with a ThreadLocal backed by a volatile generation counter. Per-request clear() only affects the current thread (safe for concurrent requests and tests). On undeploy, invalidateAll() advances the generation counter so idle pool threads detect staleness on next access and self-clear, preventing classloader leaks without breaking test isolation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Struts 2 Apps
These module consists of two example applications, which were built using the Apache Struts project. One is an old-fashioned Web application and another is a modern REST based single page app.
Installation
Enter a given folder, either showcase/ or rest-showcase/ and start the app using Maven:
mvn jetty:run
then open your browser at http://localhost:8080 and navigate to a proper context.