summaryrefslogtreecommitdiff
path: root/tomcat-10.1-jakartaee-migration.patch
blob: 80fcbb416406bf8ecefa6943261178838ef1b7df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
--- a/java/org/apache/catalina/loader/WebappLoader.java
+++ b/java/org/apache/catalina/loader/WebappLoader.java
@@ -39,9 +39,11 @@
 import org.apache.catalina.util.ToStringUtil;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
-import org.apache.tomcat.jakartaee.ClassConverter;
-import org.apache.tomcat.jakartaee.EESpecProfile;
-import org.apache.tomcat.jakartaee.EESpecProfiles;
+// Jakarta EE migration support (tomcat-jakartaee-migration) is not available
+// in this distribution, see tomcat-10.1-jakartaee-migration.patch
+// import org.apache.tomcat.jakartaee.ClassConverter;
+// import org.apache.tomcat.jakartaee.EESpecProfile;
+// import org.apache.tomcat.jakartaee.EESpecProfiles;
 import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.compat.JreCompat;
 import org.apache.tomcat.util.modeler.Registry;
@@ -314,8 +316,11 @@
             classLoader.setDelegate(this.delegate);
 
             // Set Jakarta class converter
+            // Jakarta EE migration support is not included in this build, so no
+            // converter is installed even when jakartaConverter has been configured.
             if (getJakartaConverter() != null) {
-                MigrationUtil.addJakartaEETransformer(classLoader, getJakartaConverter());
+                log.warn("Jakarta EE class conversion is not supported in this build, ignoring jakartaConverter=" +
+                        getJakartaConverter());
             }
 
             setPermissions();
@@ -568,22 +573,4 @@
         return name.toString();
     }
 
-
-    /**
-     * Implemented in a subclass so EESpecProfile and EESpecProfiles are not loaded unless a profile is configured.
-     * Otherwise, tomcat-embed-core.jar has a runtime dependency on the migration tool whether it is used or not.
-     */
-    private static class MigrationUtil {
-
-        public static void addJakartaEETransformer(WebappClassLoaderBase webappClassLoader, String profileName) {
-            EESpecProfile profile = null;
-            try {
-                profile = EESpecProfiles.valueOf(profileName);
-            } catch (IllegalArgumentException ignored) {
-                // Use default value
-                log.warn(sm.getString("webappLoader.unknownProfile", profileName));
-            }
-            webappClassLoader.addTransformer(profile != null ? new ClassConverter(profile) : new ClassConverter());
-        }
-    }
 }
--- a/java/org/apache/catalina/startup/HostConfig.java
+++ b/java/org/apache/catalina/startup/HostConfig.java
@@ -67,7 +67,9 @@
 import org.apache.catalina.util.IOTools;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
-import org.apache.tomcat.jakartaee.Migration;
+// Jakarta EE migration support (tomcat-jakartaee-migration) is not available
+// in this distribution, see tomcat-10.1-jakartaee-migration.patch
+// import org.apache.tomcat.jakartaee.Migration;
 import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.buf.UriUtil;
 import org.apache.tomcat.util.digester.Digester;
@@ -1230,17 +1232,12 @@
             // the defaults if necessary than to start adding configuration
             // options. Users that need non-default options can convert manually
             // via migration.[sh|bat]
-            Migration migration = new Migration();
-            migration.setSource(source);
-            migration.setDestination(tempNew);
-            migration.execute();
-
-            // Use rename
-            if (destination.exists()) {
-                Files.move(destination.toPath(), tempOld.toPath());
-            }
-            Files.move(tempNew.toPath(), destination.toPath());
-            ExpandWar.delete(tempOld);
+            //
+            // Jakarta EE migration support (tomcat-jakartaee-migration) is not
+            // available in this build, so the legacy application is left
+            // untouched instead of being converted.
+            log.warn("Jakarta EE web application migration is not supported in this build, skipping migration of " +
+                    source.getAbsolutePath());
 
         } catch (Throwable t) {
             ExceptionUtils.handleThrowable(t);