summaryrefslogtreecommitdiff
path: root/tomcat-10.1-jakartaee-migration.patch
diff options
context:
space:
mode:
Diffstat (limited to 'tomcat-10.1-jakartaee-migration.patch')
-rw-r--r--tomcat-10.1-jakartaee-migration.patch90
1 files changed, 90 insertions, 0 deletions
diff --git a/tomcat-10.1-jakartaee-migration.patch b/tomcat-10.1-jakartaee-migration.patch
new file mode 100644
index 0000000..80fcbb4
--- /dev/null
+++ b/tomcat-10.1-jakartaee-migration.patch
@@ -0,0 +1,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);