Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-10788

Use Tomcat 8's new instrumentable WebappClassLoader




      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:

      1. I plan on, for the most part, copying-and-pasting the Apache 2.0 licensed code from org.springframework.instrument.classloading.WeavingTransformer and org.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?
      2. 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?
      3. 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.


          Issue Links



              juergen.hoeller Juergen Hoeller
              guitarking117 Nick Williams
              Last updater:
              Spring Issuemaster
              0 Vote for this issue
              3 Start watching this issue


                Days since last comment:
                1 year, 46 weeks, 1 day ago