Explicit notes for load-time weaving on Tomcat 7.0.63+ and WildFly 9
Issue: SPR-13210
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2013 the original author or authors.
|
* Copyright 2002-2015 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -26,7 +26,7 @@ import org.springframework.util.ClassUtils;
|
|||||||
/**
|
/**
|
||||||
* {@link LoadTimeWeaver} implementation for JBoss's instrumentable ClassLoader.
|
* {@link LoadTimeWeaver} implementation for JBoss's instrumentable ClassLoader.
|
||||||
* Autodetects the specific JBoss version at runtime: currently supports
|
* Autodetects the specific JBoss version at runtime: currently supports
|
||||||
* JBoss AS 6 and 7, as well as WildFly 8 (as of Spring 4.0).
|
* JBoss AS 6 and 7, as well as WildFly 8 and 9 (as of Spring 4.2).
|
||||||
*
|
*
|
||||||
* <p><b>NOTE:</b> On JBoss 6, to avoid the container loading the classes before the
|
* <p><b>NOTE:</b> On JBoss 6, to avoid the container loading the classes before the
|
||||||
* application actually starts, one needs to add a <tt>WEB-INF/jboss-scanning.xml</tt>
|
* application actually starts, one needs to add a <tt>WEB-INF/jboss-scanning.xml</tt>
|
||||||
@@ -62,7 +62,7 @@ public class JBossLoadTimeWeaver implements LoadTimeWeaver {
|
|||||||
public JBossLoadTimeWeaver(ClassLoader classLoader) {
|
public JBossLoadTimeWeaver(ClassLoader classLoader) {
|
||||||
Assert.notNull(classLoader, "ClassLoader must not be null");
|
Assert.notNull(classLoader, "ClassLoader must not be null");
|
||||||
if (classLoader.getClass().getName().startsWith("org.jboss.modules")) {
|
if (classLoader.getClass().getName().startsWith("org.jboss.modules")) {
|
||||||
// JBoss AS 7 or WildFly 8
|
// JBoss AS 7 or WildFly
|
||||||
this.adapter = new JBossModulesAdapter(classLoader);
|
this.adapter = new JBossModulesAdapter(classLoader);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2013 the original author or authors.
|
* Copyright 2002-2015 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -44,6 +44,9 @@ import org.springframework.instrument.classloading.WeavingTransformer;
|
|||||||
* in the LoadTimeWeaver interface, as expected by ReflectiveLoadTimeWeaver.
|
* in the LoadTimeWeaver interface, as expected by ReflectiveLoadTimeWeaver.
|
||||||
*
|
*
|
||||||
* <p><b>NOTE:</b> Requires Apache Tomcat version 6.0 or higher, as of Spring 4.0.
|
* <p><b>NOTE:</b> Requires Apache Tomcat version 6.0 or higher, as of Spring 4.0.
|
||||||
|
* This class does not work on Tomcat 7.0.63 and higher; please rely on Tomcat's own
|
||||||
|
* {@code InstrumentableClassLoader} facility instead, as autodetected by Spring's
|
||||||
|
* {@link org.springframework.instrument.classloading.tomcat.TomcatLoadTimeWeaver}.
|
||||||
*
|
*
|
||||||
* @author Costin Leau
|
* @author Costin Leau
|
||||||
* @author Juergen Hoeller
|
* @author Juergen Hoeller
|
||||||
@@ -51,6 +54,7 @@ import org.springframework.instrument.classloading.WeavingTransformer;
|
|||||||
* @see #addTransformer
|
* @see #addTransformer
|
||||||
* @see #getThrowawayClassLoader
|
* @see #getThrowawayClassLoader
|
||||||
* @see org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver
|
* @see org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver
|
||||||
|
* @see org.springframework.instrument.classloading.tomcat.TomcatLoadTimeWeaver
|
||||||
*/
|
*/
|
||||||
public class TomcatInstrumentableClassLoader extends WebappClassLoader {
|
public class TomcatInstrumentableClassLoader extends WebappClassLoader {
|
||||||
|
|
||||||
|
|||||||
@@ -3332,21 +3332,22 @@ environment (summarized in the following table).
|
|||||||
|===
|
|===
|
||||||
| Runtime Environment| `LoadTimeWeaver` implementation
|
| Runtime Environment| `LoadTimeWeaver` implementation
|
||||||
|
|
||||||
| Running in
|
| Running in Oracle's
|
||||||
http://www.bea.com/framework.jsp?CNT=index.htm&FP=/content/products/weblogic/server[BEA's
|
http://www.oracle.com/technetwork/middleware/weblogic/overview/index-085209.html[WebLogic]
|
||||||
Weblogic 10]
|
|
||||||
| `WebLogicLoadTimeWeaver`
|
| `WebLogicLoadTimeWeaver`
|
||||||
|
|
||||||
| Running in http://www-01.ibm.com/software/webservers/appserv/was/[IBM WebSphere
|
| Running in Oracle's http://glassfish.dev.java.net/[GlassFish]
|
||||||
Application Server 7]
|
|
||||||
| `WebSphereLoadTimeWeaver`
|
|
||||||
|
|
||||||
| Running in http://glassfish.dev.java.net/[GlassFish]
|
|
||||||
| `GlassFishLoadTimeWeaver`
|
| `GlassFishLoadTimeWeaver`
|
||||||
|
|
||||||
| Running in http://www.jboss.org/jbossas/[JBoss AS]
|
| Running in http://tomcat.apache.org/[Apache Tomcat]
|
||||||
|
| `TomcatLoadTimeWeaver`
|
||||||
|
|
||||||
|
| Running in Red Hat's http://www.jboss.org/jbossas/[JBoss AS] or http://www.wildfly.org/[WildFly]
|
||||||
| `JBossLoadTimeWeaver`
|
| `JBossLoadTimeWeaver`
|
||||||
|
|
||||||
|
| Running in IBM's http://www-01.ibm.com/software/webservers/appserv/was/[WebSphere]
|
||||||
|
| `WebSphereLoadTimeWeaver`
|
||||||
|
|
||||||
| JVM started with Spring `InstrumentationSavingAgent` __(java
|
| JVM started with Spring `InstrumentationSavingAgent` __(java
|
||||||
-javaagent:path/to/spring-instrument.jar)__
|
-javaagent:path/to/spring-instrument.jar)__
|
||||||
| `InstrumentationLoadTimeWeaver`
|
| `InstrumentationLoadTimeWeaver`
|
||||||
@@ -3443,12 +3444,22 @@ containers.
|
|||||||
|
|
||||||
[[aop-aj-ltw-environment-tomcat]]
|
[[aop-aj-ltw-environment-tomcat]]
|
||||||
===== Tomcat
|
===== Tomcat
|
||||||
http://tomcat.apache.org/[Apache Tomcat]'s default class loader does not support class
|
Historically, http://tomcat.apache.org/[Apache Tomcat]'s default class loader did not
|
||||||
transformation which is why Spring provides an enhanced implementation that addresses
|
support class transformation which is why Spring provides an enhanced implementation
|
||||||
this need. Named `TomcatInstrumentableClassLoader`, the loader works on Tomcat 5.0 and
|
that addresses this need. Named `TomcatInstrumentableClassLoader`, the loader works on
|
||||||
above and can be registered individually for __each__ web application as follows:
|
Tomcat 6.0 and above.
|
||||||
|
|
||||||
|
[TIP]
|
||||||
|
====
|
||||||
|
Do not define `TomcatInstrumentableClassLoader` anymore as of Tomcat 7.0.44+ / 8.0.
|
||||||
|
Instead, let Spring automatically use Tomcat's new native `InstrumentableClassLoader`
|
||||||
|
facility through the `TomcatLoadTimeWeaver` strategy, in particular on Tomcat 7.0.63+
|
||||||
|
where `TomcatInstrumentableClassLoader` does not work at all anymore.
|
||||||
|
====
|
||||||
|
|
||||||
|
If you still need to use `TomcatInstrumentableClassLoader`, it can be registered
|
||||||
|
individually for __each__ web application as follows:
|
||||||
|
|
||||||
* Tomcat 6.0.x or higher
|
|
||||||
* Copy `org.springframework.instrument.tomcat.jar` into __$CATALINA_HOME__/lib, where
|
* Copy `org.springframework.instrument.tomcat.jar` into __$CATALINA_HOME__/lib, where
|
||||||
__$CATALINA_HOME__ represents the root of the Tomcat installation)
|
__$CATALINA_HOME__ represents the root of the Tomcat installation)
|
||||||
* Instruct Tomcat to use the custom class loader (instead of the default) by editing the
|
* Instruct Tomcat to use the custom class loader (instead of the default) by editing the
|
||||||
|
|||||||
Reference in New Issue
Block a user