|
1 | 1 | /* |
2 | | - * Copyright 2002-2017 the original author or authors. |
| 2 | + * Copyright 2002-2018 the original author or authors. |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
|
47 | 47 | * appropriate weaver implementation: As of Spring Framework 5.0, it detects |
48 | 48 | * Oracle WebLogic 10+, GlassFish 4+, Tomcat 8+, WildFly 8+, IBM WebSphere 8.5+, |
49 | 49 | * {@link InstrumentationSavingAgent Spring's VM agent}, and any {@link ClassLoader} |
50 | | - * supported by Spring's {@link ReflectiveLoadTimeWeaver}. |
| 50 | + * supported by Spring's {@link ReflectiveLoadTimeWeaver} (such as Liberty's). |
51 | 51 | * |
52 | 52 | * @author Juergen Hoeller |
53 | 53 | * @author Ramnivas Laddad |
@@ -104,32 +104,29 @@ else if (InstrumentationLoadTimeWeaver.isInstrumentationAvailable()) { |
104 | 104 | * This method never fails, allowing to try other possible ways to use an |
105 | 105 | * server-agnostic weaver. This non-failure logic is required since |
106 | 106 | * determining a load-time weaver based on the ClassLoader name alone may |
107 | | - * legitimately fail due to other mismatches. Specific case in point: the |
108 | | - * use of WebLogicLoadTimeWeaver works for WLS 10 but fails due to the lack |
109 | | - * of a specific method (addInstanceClassPreProcessor) for any earlier |
110 | | - * versions even though the ClassLoader name is the same. |
| 107 | + * legitimately fail due to other mismatches. |
111 | 108 | */ |
112 | 109 | @Nullable |
113 | 110 | protected LoadTimeWeaver createServerSpecificLoadTimeWeaver(ClassLoader classLoader) { |
114 | 111 | String name = classLoader.getClass().getName(); |
115 | 112 | try { |
116 | | - if (name.startsWith("weblogic")) { |
117 | | - return new WebLogicLoadTimeWeaver(classLoader); |
| 113 | + if (name.startsWith("org.apache.catalina")) { |
| 114 | + return new TomcatLoadTimeWeaver(classLoader); |
118 | 115 | } |
119 | 116 | else if (name.startsWith("org.glassfish")) { |
120 | 117 | return new GlassFishLoadTimeWeaver(classLoader); |
121 | 118 | } |
122 | | - else if (name.startsWith("org.apache.catalina")) { |
123 | | - return new TomcatLoadTimeWeaver(classLoader); |
124 | | - } |
125 | | - else if (name.startsWith("org.jboss")) { |
| 119 | + else if (name.startsWith("org.jboss.modules")) { |
126 | 120 | return new JBossLoadTimeWeaver(classLoader); |
127 | 121 | } |
128 | | - else if (name.startsWith("com.ibm")) { |
| 122 | + else if (name.startsWith("com.ibm.ws.classloader")) { |
129 | 123 | return new WebSphereLoadTimeWeaver(classLoader); |
130 | 124 | } |
| 125 | + else if (name.startsWith("weblogic")) { |
| 126 | + return new WebLogicLoadTimeWeaver(classLoader); |
| 127 | + } |
131 | 128 | } |
132 | | - catch (IllegalStateException ex) { |
| 129 | + catch (Exception ex) { |
133 | 130 | if (logger.isInfoEnabled()) { |
134 | 131 | logger.info("Could not obtain server-specific LoadTimeWeaver: " + ex.getMessage()); |
135 | 132 | } |
|
0 commit comments