Description
Nick Williams opened SPR-10788 and commented
First, you can see the companion Tomcat enhancement request at the attached reference URL.
For many application servers, Spring provides a LoadTimeWeaver
implementation that can take advantage of the instrumentable ClassLoader
that the server provides. Tomcat's WebappClassLoader
is currently not instrumentable, so Spring provides a custom ClassLoader
that can be used by placing spring-instrument-tomcat.jar
in $TOMCAT_HOME/lib
and putting a loader declaration in META-INF/context.xml
.
It would be nice if load time weaving could "just work" like it does in other application servers. I submitted the attached Tomcat enhancement request and the community seems accepting of the idea of modifying org.apache.catalina.loader.WebappClassLoader
to make it instrumentable so that users no longer have to jump through those hoops to get load time weaving working in Tomcat.
I will be submitting a patch to Tomcat in the next week or two to make WebappClassLoader
instrumentable. I will then submit a pull request to add org.springframework.instrument.classloading.tomcat.TomcatLoadTimeWeaver
(and related classes) to Spring 4.0 (and hopefully also 3.2). The new WebappClassLoader
will exist in Tomcat 7.0.43 or 7.0.44 (depending on when my patch is accepted and assuming they agree to back-port it to 7) and Tomcat 8.0.
However, I need the following questions/items addressed by someone here on the Spring development team:
- I plan on, for the most part, copying-and-pasting the Apache 2.0 licensed code from
org.springframework.instrument.classloading.WeavingTransformer
andorg.springframework.instrument.classloading.tomcat. TomcatInstrumentableClassLoader
to the Apache 2.0 licensed Tomcat. Can someone confirm that Spring is willing to donate this code to Tomcat? - Some of the Tomcat folks are questioning the need for a
getThrowawayClassLoader()
method. I'm not quite sure I understand the point of this method, myself. Can someone please clarify its purpose? - Once I have completed the Tomcat patch, the Tomcat folks would like someone here to state that it A) looks generally correct, and B) is a useful change. There is someone willing to do this, correct?
While the changes will actually be quite minor, I think this will serve as a huge improvement to using load time weaving in a Tomcat environment.
Affects: 3.2 GA, 4.0 M2
Reference URL: https://issues.apache.org/bugzilla/show_bug.cgi?id=55317
Attachments:
- support.log (551.93 kB)
Issue Links:
- Load Time Weaving not working after upgrading Tomcat from 7.0.50 to 7.0.52 [SPR-11446] #16072 Load Time Weaving not working after upgrading Tomcat from 7.0.50 to 7.0.52
- Hibernate session cannot be found after upgrading Tomcat from 7.0.50 to 8.0.3 [SPR-11447] #16073 Hibernate session cannot be found after upgrading Tomcat from 7.0.50 to 8.0.3
- TomcatInstrumentableClassLoader should support Tomcat 7.0.63+ as well [SPR-13210] #17802 TomcatInstrumentableClassLoader should support Tomcat 7.0.63+ as well