diff --git a/java-9-start-up-parameters.conf b/java-9-start-up-parameters.conf
new file mode 100644
index 0000000..341e077
--- /dev/null
+++ b/java-9-start-up-parameters.conf
@@ -0,0 +1,7 @@
+# Add the JAVA 9 specific start-up parameters required by Tomcat
+JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens=java.base/java.lang=ALL-UNNAMED"
+JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens=java.base/java.io=ALL-UNNAMED"
+JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens=java.base/java.util=ALL-UNNAMED"
+JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens=java.base/java.util.concurrent=ALL-UNNAMED"
+JDK_JAVA_OPTIONS="$JDK_JAVA_OPTIONS --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED"
+export JDK_JAVA_OPTIONS
diff --git a/rhbz-1857043.patch b/rhbz-1857043.patch
index 3730769..dd74c3b 100644
--- a/rhbz-1857043.patch
+++ b/rhbz-1857043.patch
@@ -1,16 +1,16 @@
diff -up ./build.xml.orig ./build.xml
---- ./build.xml.orig 2020-07-24 10:24:08.313796968 -0400
-+++ ./build.xml 2020-07-24 10:24:38.027427445 -0400
-@@ -757,7 +757,7 @@
+--- build.xml.orig 2021-07-07 10:53:55.493742841 +0800
++++ build.xml 2021-07-07 11:09:43.107968515 +0800
+@@ -1020,7 +1020,7 @@
filesDir="${tomcat.classes}"
filesId="files.annotations-api"
manifest="${tomcat.manifests}/annotations-api.jar.manifest"
- addOSGi="true" />
+ addOSGi="false" />
-
+
+ addOSGi="false" />
-
+
+
+
++
+
+
+
diff --git a/tomcat-9.0-catalina-policy.patch b/tomcat-9.0-catalina-policy.patch
index 487e2be..dd6a47d 100644
--- a/tomcat-9.0-catalina-policy.patch
+++ b/tomcat-9.0-catalina-policy.patch
@@ -1,8 +1,8 @@
---- conf/catalina.policy.orig 2020-04-22 14:51:13.734893403 -0400
-+++ conf/catalina.policy 2020-04-22 15:14:57.609677967 -0400
-@@ -51,6 +51,17 @@ grant codeBase "file:${java.home}/lib/ex
- };
-
+--- conf/catalina.policy.orig 2022-11-04 16:17:41.227506990 +0800
++++ conf/catalina.policy 2022-11-04 16:21:51.393351415 +0800
+@@ -56,6 +56,15 @@ grant codeBase "file:${java.home}/lib/ex
+ // permission java.security.AllPermission;
+ //};
+// ========== RHEL SPECIFIC CODE PERMISSIONS =======================================
+
@@ -13,8 +13,13 @@
+grant codeBase "file:/usr/share/java/ecj/ecj.jar" {
+ permission java.security.AllPermission;
+};
-+
-+
+
// ========== CATALINA CODE PERMISSIONS =======================================
-
+@@ -261,4 +270,4 @@ grant codeBase "file:${catalina.home}/we
+ //
+ // The permissions granted to a specific JAR
+ // grant codeBase "war:file:${catalina.base}/webapps/examples.war*/WEB-INF/lib/foo.jar" {
+-// };
+\ No newline at end of file
++// };
diff --git a/tomcat-9.0-jsvc.service b/tomcat-9.0-jsvc.service
deleted file mode 100644
index f480324..0000000
--- a/tomcat-9.0-jsvc.service
+++ /dev/null
@@ -1,22 +0,0 @@
-# Systemd unit file for tomcat
-#
-# To create clones of this service:
-# 1) By default SERVICE_NAME=tomcat. When cloned, the value must be defined
-# before tomcat-sysd is called.
-# 2) Create /etc/sysconfig/${SERVICE_NAME} from /etc/sysconfig/tomcat
-# to override tomcat defaults
-
-[Unit]
-Description=Apache Tomcat Web Application Container JSVC wrapper
-After=syslog.target network.target
-
-[Service]
-Type=simple
-EnvironmentFile=/etc/tomcat/tomcat.conf
-Environment="NAME=" "USE_JSVC=true"
-EnvironmentFile=-/etc/sysconfig/tomcat
-ExecStart=/usr/libexec/tomcat/server start
-ExecStop=/usr/libexec/tomcat/server stop
-
-[Install]
-WantedBy=multi-user.target
diff --git a/tomcat-9.0-log4j.properties b/tomcat-9.0-log4j.properties
deleted file mode 100644
index dfc2309..0000000
--- a/tomcat-9.0-log4j.properties
+++ /dev/null
@@ -1,11 +0,0 @@
-log4j.rootLogger=debug, R
-log4j.appender.R=org.apache.log4j.RollingFileAppender
-log4j.appender.R.File=${catalina.base}/logs/tomcat.log
-log4j.appender.R.MaxFileSize=10MB
-log4j.appender.R.MaxBackupIndex=10
-log4j.appender.R.layout=org.apache.log4j.PatternLayout
-log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
-log4j.logger.org.apache.catalina=DEBUG, R
-log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost]=DEBUG, R
-log4j.logger.org.apache.catalina.core=DEBUG, R
-log4j.logger.org.apache.catalina.session=DEBUG, R
diff --git a/tomcat-9.0-memory-leak.patch b/tomcat-9.0-memory-leak.patch
new file mode 100644
index 0000000..00e6e56
--- /dev/null
+++ b/tomcat-9.0-memory-leak.patch
@@ -0,0 +1,345 @@
+diff --git a/java/org/apache/catalina/loader/WebappClassLoaderBase.java b/java/org/apache/catalina/loader/WebappClassLoaderBase.java
+index 8746b6b..dc878c6 100644
+--- a/java/org/apache/catalina/loader/WebappClassLoaderBase.java
++++ b/java/org/apache/catalina/loader/WebappClassLoaderBase.java
+@@ -1820,41 +1820,13 @@ public abstract class WebappClassLoaderBase extends URLClassLoader
+ // shutting down the executor
+ boolean usingExecutor = false;
+ try {
+-
+- // Runnable wrapped by Thread
+- // "target" in Sun/Oracle JDK
+- // "runnable" in IBM JDK
+- // "action" in Apache Harmony
+- Object target = null;
+- for (String fieldName : new String[] { "target", "runnable", "action" }) {
+- try {
+- Field targetField = thread.getClass().getDeclaredField(fieldName);
+- targetField.setAccessible(true);
+- target = targetField.get(thread);
+- break;
+- } catch (NoSuchFieldException nfe) {
+- continue;
+- }
+- }
+-
+- // "java.util.concurrent" code is in public domain,
+- // so all implementations are similar including our
+- // internal fork.
+- if (target != null && target.getClass().getCanonicalName() != null &&
+- (target.getClass().getCanonicalName().equals(
+- "org.apache.tomcat.util.threads.ThreadPoolExecutor.Worker") ||
+- target.getClass().getCanonicalName().equals(
+- "java.util.concurrent.ThreadPoolExecutor.Worker"))) {
+- Field executorField = target.getClass().getDeclaredField("this$0");
+- executorField.setAccessible(true);
+- Object executor = executorField.get(target);
+- if (executor instanceof ThreadPoolExecutor) {
+- ((ThreadPoolExecutor) executor).shutdownNow();
+- usingExecutor = true;
+- } else if (executor instanceof java.util.concurrent.ThreadPoolExecutor) {
+- ((java.util.concurrent.ThreadPoolExecutor) executor).shutdownNow();
+- usingExecutor = true;
+- }
++ Object executor = JreCompat.getInstance().getExecutor(thread);
++ if (executor instanceof ThreadPoolExecutor) {
++ ((ThreadPoolExecutor) executor).shutdownNow();
++ usingExecutor = true;
++ } else if (executor instanceof java.util.concurrent.ThreadPoolExecutor) {
++ ((java.util.concurrent.ThreadPoolExecutor) executor).shutdownNow();
++ usingExecutor = true;
+ }
+ } catch (NoSuchFieldException | IllegalAccessException | RuntimeException e) {
+ // InaccessibleObjectException is only available in Java 9+,
+@@ -2306,6 +2278,12 @@ public abstract class WebappClassLoaderBase extends URLClassLoader
+
+
+ private void clearReferencesObjectStreamClassCaches() {
++ if (JreCompat.isJre19Available()) {
++ // The memory leak this fixes has been fixed in Java 19 onwards,
++ // 17.0.4 onwards and 11.0.16 onwards
++ // See https://bugs.openjdk.java.net/browse/JDK-8277072
++ return;
++ }
+ try {
+ Class> clazz = Class.forName("java.io.ObjectStreamClass$Caches");
+ clearCache(clazz, "localDescs");
+@@ -2333,14 +2311,19 @@ public abstract class WebappClassLoaderBase extends URLClassLoader
+ throws ReflectiveOperationException, SecurityException, ClassCastException {
+ Field f = target.getDeclaredField(mapName);
+ f.setAccessible(true);
+- Map,?> map = (Map,?>) f.get(null);
+- Iterator> keys = map.keySet().iterator();
+- while (keys.hasNext()) {
+- Object key = keys.next();
+- if (key instanceof Reference) {
+- Object clazz = ((Reference>) key).get();
+- if (loadedByThisOrChild(clazz)) {
+- keys.remove();
++ Object map = f.get(null);
++ // Avoid trying to clear references if Tomcat is running on a JRE that
++ // includes the fix for this memory leak
++ // See https://bugs.openjdk.java.net/browse/JDK-8277072
++ if (map instanceof Map,?>) {
++ Iterator> keys = ((Map,?>) map).keySet().iterator();
++ while (keys.hasNext()) {
++ Object key = keys.next();
++ if (key instanceof Reference) {
++ Object clazz = ((Reference>) key).get();
++ if (loadedByThisOrChild(clazz)) {
++ keys.remove();
++ }
+ }
+ }
+ }
+diff --git a/java/org/apache/tomcat/util/compat/JreCompat.java b/java/org/apache/tomcat/util/compat/JreCompat.java
+index 62df145..e5df728 100644
+--- a/java/org/apache/tomcat/util/compat/JreCompat.java
++++ b/java/org/apache/tomcat/util/compat/JreCompat.java
+@@ -19,6 +19,7 @@ package org.apache.tomcat.util.compat;
+ import java.io.File;
+ import java.io.IOException;
+ import java.lang.reflect.AccessibleObject;
++import java.lang.reflect.Field;
+ import java.lang.reflect.InvocationTargetException;
+ import java.lang.reflect.Method;
+ import java.net.SocketAddress;
+@@ -45,6 +46,7 @@ public class JreCompat {
+
+ private static final JreCompat instance;
+ private static final boolean graalAvailable;
++ private static final boolean jre19Available;
+ private static final boolean jre16Available;
+ private static final boolean jre11Available;
+ private static final boolean jre9Available;
+@@ -67,18 +69,26 @@ public class JreCompat {
+
+ // This is Tomcat 9 with a minimum Java version of Java 8.
+ // Look for the highest supported JVM first
+- if (Jre16Compat.isSupported()) {
++ if (Jre19Compat.isSupported()) {
++ instance = new Jre19Compat();
++ jre9Available = true;
++ jre16Available = true;
++ jre19Available = true;
++ } else if (Jre16Compat.isSupported()) {
+ instance = new Jre16Compat();
+ jre9Available = true;
+ jre16Available = true;
++ jre19Available = false;
+ } else if (Jre9Compat.isSupported()) {
+ instance = new Jre9Compat();
+ jre9Available = true;
+ jre16Available = false;
++ jre19Available = false;
+ } else {
+ instance = new JreCompat();
+ jre9Available = false;
+ jre16Available = false;
++ jre19Available = false;
+ }
+ jre11Available = instance.jarFileRuntimeMajorVersion() >= 11;
+
+@@ -124,6 +134,9 @@ public class JreCompat {
+ return jre16Available;
+ }
+
++ public static boolean isJre19Available() {
++ return jre19Available;
++ }
+
+ // Java 8 implementation of Java 9 methods
+
+@@ -303,6 +316,8 @@ public class JreCompat {
+ }
+
+
++ // Java 8 implementations of Java 16 methods
++
+ /**
+ * Return Unix domain socket address for given path.
+ * @param path The path
+@@ -329,4 +344,63 @@ public class JreCompat {
+ public SocketChannel openUnixDomainSocketChannel() {
+ throw new UnsupportedOperationException(sm.getString("jreCompat.noUnixDomainSocket"));
+ }
++
++
++ // Java 8 implementations of Java 19 methods
++
++ /**
++ * Obtains the executor, if any, used to create the provided thread.
++ *
++ * @param thread The thread to examine
++ *
++ * @return The executor, if any, that created the provided thread
++ *
++ * @throws NoSuchFieldException
++ * If a field used via reflection to obtain the executor cannot
++ * be found
++ * @throws SecurityException
++ * If a security exception occurs while trying to identify the
++ * executor
++ * @throws IllegalArgumentException
++ * If the instance object does not match the class of the field
++ * when obtaining a field value via reflection
++ * @throws IllegalAccessException
++ * If a field is not accessible due to access restrictions
++ */
++ public Object getExecutor(Thread thread)
++ throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
++
++ Object result = null;
++
++ // Runnable wrapped by Thread
++ // "target" in Sun/Oracle JDK
++ // "runnable" in IBM JDK
++ // "action" in Apache Harmony
++ Object target = null;
++ for (String fieldName : new String[] { "target", "runnable", "action" }) {
++ try {
++ Field targetField = thread.getClass().getDeclaredField(fieldName);
++ targetField.setAccessible(true);
++ target = targetField.get(thread);
++ break;
++ } catch (NoSuchFieldException nfe) {
++ continue;
++ }
++ }
++
++ // "java.util.concurrent" code is in public domain,
++ // so all implementations are similar including our
++ // internal fork.
++ if (target != null && target.getClass().getCanonicalName() != null &&
++ (target.getClass().getCanonicalName().equals(
++ "org.apache.tomcat.util.threads.ThreadPoolExecutor.Worker") ||
++ target.getClass().getCanonicalName().equals(
++ "java.util.concurrent.ThreadPoolExecutor.Worker"))) {
++ Field executorField = target.getClass().getDeclaredField("this$0");
++ executorField.setAccessible(true);
++ result = executorField.get(target);
++ }
++
++ return result;
++ }
+ }
+diff --git a/java/org/apache/tomcat/util/compat/LocalStrings.properties b/java/org/apache/tomcat/util/compat/LocalStrings.properties
+index 79427da..c4c2f7d 100644
+--- a/java/org/apache/tomcat/util/compat/LocalStrings.properties
++++ b/java/org/apache/tomcat/util/compat/LocalStrings.properties
+@@ -16,6 +16,8 @@
+ jre16Compat.javaPre16=Class not found so assuming code is running on a pre-Java 16 JVM
+ jre16Compat.unexpected=Failed to create references to Java 16 classes and methods
+
++jre19Compat.javaPre19=Class not found so assuming code is running on a pre-Java 19 JVM
++
+ jre9Compat.invalidModuleUri=The module URI provided [{0}] could not be converted to a URL for the JarScanner to process
+ jre9Compat.javaPre9=Class not found so assuming code is running on a pre-Java 9 JVM
+ jre9Compat.unexpected=Failed to create references to Java 9 classes and methods
+diff --git a/webapps/docs/config/context.xml b/webapps/docs/config/context.xml
+index d118196..42dfe38 100644
+--- a/webapps/docs/config/context.xml
++++ b/webapps/docs/config/context.xml
+@@ -769,7 +769,11 @@
+ therefore requires that the command line option
+ -XaddExports:java.base/java.io=ALL-UNNAMED
is set
+ when running on Java 9 and above. If not specified, the default value of
+- true
will be used.
++ true
will be used.
++ The memory leak associated with ObjectStreamClass
has
++ been fixed in Java 19 onwards, Java 17.0.4 onwards and Java 11.0.16
++ onwards. The check will be disabled when running on a version
++ of Java that contains the fix.
+
+
+
+diff --git a/java/org/apache/tomcat/util/compat/Jre19Compat.java b/java/org/apache/tomcat/util/compat/Jre19Compat.java
+new file mode 100644
+index 0000000000..fb94810b40
+--- /dev/null
++++ b/java/org/apache/tomcat/util/compat/Jre19Compat.java
+@@ -0,0 +1,84 @@
++/*
++ * Licensed to the Apache Software Foundation (ASF) under one or more
++ * contributor license agreements. See the NOTICE file distributed with
++ * this work for additional information regarding copyright ownership.
++ * The ASF licenses this file to You under the Apache License, Version 2.0
++ * (the "License"); you may not use this file except in compliance with
++ * the License. You may obtain a copy of the License at
++ *
++ * http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing, software
++ * distributed under the License is distributed on an "AS IS" BASIS,
++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ * See the License for the specific language governing permissions and
++ * limitations under the License.
++ */
++package org.apache.tomcat.util.compat;
++
++import java.lang.reflect.Field;
++
++import org.apache.juli.logging.Log;
++import org.apache.juli.logging.LogFactory;
++import org.apache.tomcat.util.res.StringManager;
++
++public class Jre19Compat extends Jre16Compat {
++
++ private static final Log log = LogFactory.getLog(Jre19Compat.class);
++ private static final StringManager sm = StringManager.getManager(Jre19Compat.class);
++
++ private static final boolean supported;
++
++ static {
++ // Don't need any Java 19 specific classes (yet) so just test for one of
++ // the new ones for now.
++ Class> c1 = null;
++ try {
++ c1 = Class.forName("java.lang.WrongThreadException");
++ } catch (ClassNotFoundException cnfe) {
++ // Must be pre-Java 16
++ log.debug(sm.getString("jre19Compat.javaPre19"), cnfe);
++ }
++
++ supported = (c1 != null);
++ }
++
++ static boolean isSupported() {
++ return supported;
++ }
++
++ @Override
++ public Object getExecutor(Thread thread)
++ throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
++
++ Object result = super.getExecutor(thread);
++
++ if (result == null) {
++ Object holder = null;
++ Object task = null;
++ try {
++ Field holderField = thread.getClass().getDeclaredField("holder");
++ holderField.setAccessible(true);
++ holder = holderField.get(thread);
++
++ Field taskField = holder.getClass().getDeclaredField("task");
++ taskField.setAccessible(true);
++ task = taskField.get(holder);
++ } catch (NoSuchFieldException nfe) {
++ return null;
++ }
++
++ if (task!= null && task.getClass().getCanonicalName() != null &&
++ (task.getClass().getCanonicalName().equals(
++ "org.apache.tomcat.util.threads.ThreadPoolExecutor.Worker") ||
++ task.getClass().getCanonicalName().equals(
++ "java.util.concurrent.ThreadPoolExecutor.Worker"))) {
++ Field executorField = task.getClass().getDeclaredField("this$0");
++ executorField.setAccessible(true);
++ result = executorField.get(task);
++ }
++ }
++
++ return result;
++ }
++}
diff --git a/tomcat-9.0-tomcat-users-webapp.patch b/tomcat-9.0-tomcat-users-webapp.patch
index 860c4cf..85b8b9b 100644
--- a/tomcat-9.0-tomcat-users-webapp.patch
+++ b/tomcat-9.0-tomcat-users-webapp.patch
@@ -1,6 +1,6 @@
--- conf/tomcat-users.xml~ 2008-01-28 17:41:06.000000000 -0500
+++ conf/tomcat-users.xml 2008-03-07 19:40:07.000000000 -0500
-@@ -23,4 +23,14 @@
+@@ -53,4 +53,14 @@
-->
diff --git a/tomcat-9.0.logrotate b/tomcat-9.0.logrotate
index a87b4c0..082092a 100644
--- a/tomcat-9.0.logrotate
+++ b/tomcat-9.0.logrotate
@@ -1,4 +1,7 @@
-@@@TCLOG@@@/catalina.out {
+# This is an example config only and is disabled by default
+# If you wish to use it, you'll need to update /etc/tomcat/logging.properties
+# to prevent catalina*.log from being rotated by Tomcat
+@@@TCLOG@@@/catalina*.log {
copytruncate
weekly
rotate 52
diff --git a/tomcat-build.patch b/tomcat-build.patch
index 97440f1..49c63ff 100644
--- a/tomcat-build.patch
+++ b/tomcat-build.patch
@@ -1,18 +1,3 @@
-diff -up ./build.xml.orig ./build.xml
---- ./build.xml.orig 2020-07-13 12:59:09.555368724 -0400
-+++ ./build.xml 2020-07-13 13:06:51.246135917 -0400
-@@ -3307,6 +3307,11 @@ Read the Building page on the Apache Tom
-
-
-
-+
-+
-+
-+
-+
-
-
-
diff -up ./res/bnd/build-defaults.bnd.orig ./res/bnd/build-defaults.bnd
--- ./res/bnd/build-defaults.bnd.orig 2020-07-13 13:47:01.229077747 -0400
+++ ./res/bnd/build-defaults.bnd 2020-07-13 13:47:12.923095618 -0400
diff --git a/tomcat.spec b/tomcat.spec
index a956deb..2f51a9e 100644
--- a/tomcat.spec
+++ b/tomcat.spec
@@ -31,7 +31,7 @@
%global jspspec 2.3
%global major_version 9
%global minor_version 0
-%global micro_version 44
+%global micro_version 62
%global packdname apache-tomcat-%{version}-src
%global servletspec 4.0
%global elspec 3.0
@@ -53,13 +53,10 @@
%global workdir %{cachedir}/work
%global _systemddir /lib/systemd/system
-# Fedora doesn't seem to have this macro, so we define it if it doesn't exist
-%{!?_mavendepmapfragdir: %global _mavendepmapfragdir /usr/share/maven-metadata}
-
Name: tomcat
Epoch: 1
Version: %{major_version}.%{minor_version}.%{micro_version}
-Release: 2%{?dist}
+Release: 1%{?dist}
Summary: Apache Servlet/JSP Engine, RI for Servlet %{servletspec}/JSP %{jspspec} API
License: ASL 2.0
@@ -72,39 +69,33 @@ Source5: %{name}-%{major_version}.%{minor_version}.logrotate
Source6: %{name}-%{major_version}.%{minor_version}-digest.script
Source7: %{name}-%{major_version}.%{minor_version}-tool-wrapper.script
Source11: %{name}-%{major_version}.%{minor_version}.service
-Source20: %{name}-%{major_version}.%{minor_version}-jsvc.service
Source21: tomcat-functions
Source30: tomcat-preamble
Source31: tomcat-server
Source32: tomcat-named.service
+Source33: java-9-start-up-parameters.conf
Patch0: %{name}-%{major_version}.%{minor_version}-bootstrap-MANIFEST.MF.patch
Patch1: %{name}-%{major_version}.%{minor_version}-tomcat-users-webapp.patch
Patch2: %{name}-build.patch
Patch3: %{name}-%{major_version}.%{minor_version}-catalina-policy.patch
Patch4: rhbz-1857043.patch
+Patch5: %{name}-%{major_version}.%{minor_version}-JDTCompiler.patch
+Patch6: %{name}-%{major_version}.%{minor_version}-bnd-annotation.patch
+# The fixes for memory leak which have been fixed in 9.0.64, remove this patch in the next tomcat update
+Patch7: %{name}-%{major_version}.%{minor_version}-memory-leak.patch
BuildArch: noarch
BuildRequires: ant
BuildRequires: ecj >= 1:4.10
BuildRequires: findutils
-BuildRequires: apache-commons-daemon
-BuildRequires: tomcat-taglibs-standard
BuildRequires: java-devel >= 1:1.8.0
-%if 0%{?fedora} >= 27 || 0%{?rhel} > 7
-# add_maven_depmap is deprecated, using javapackages-local for now
-# See https://fedora-java.github.io/howto/latest/#_add_maven_depmap_macro
BuildRequires: javapackages-local
-%endif
-BuildRequires: geronimo-jaxrpc
-BuildRequires: geronimo-saaj
BuildRequires: aqute-bnd
BuildRequires: aqute-bndlib
-BuildRequires: wsdl4j
BuildRequires: systemd
-Requires: apache-commons-daemon
Requires: java-headless >= 1:1.8.0
Requires: javapackages-tools
Requires: procps
@@ -144,16 +135,6 @@ Requires: %{name} = %{epoch}:%{version}-%{release}
%description docs-webapp
The docs web application for Apache Tomcat.
-%package jsvc
-Summary: Apache jsvc wrapper for Apache Tomcat as separate service
-Requires: %{name} = %{epoch}:%{version}-%{release}
-Requires: apache-commons-daemon-jsvc
-
-%description jsvc
-Systemd service to start tomcat with jsvc,
-which allows tomcat to perform some privileged operations
-(e.g. bind to a port < 1024) and then switch identity to a non-privileged user.
-
%package jsp-%{jspspec}-api
Summary: Apache Tomcat JavaServer Pages v%{jspspec} API Implementation Classes
Provides: jsp = %{jspspec}
@@ -194,12 +175,11 @@ Obsoletes: %{name}-el-2.2-api
Apache Tomcat EL API Implementation Classes.
%package webapps
-Summary: The ROOT and examples web applications for Apache Tomcat
+Summary: The ROOT web application for Apache Tomcat
Requires: %{name} = %{epoch}:%{version}-%{release}
-Requires: tomcat-taglibs-standard >= 0:1.1
%description webapps
-The ROOT and examples web applications for Apache Tomcat.
+The ROOT web application for Apache Tomcat.
%prep
%setup -q -n %{packdname}
@@ -212,50 +192,52 @@ find . -type f \( -name "*.bat" -o -name "*.class" -o -name Thumbs.db -o -name "
%patch2 -p0
%patch3 -p0
%patch4 -p0
+%patch5 -p0
+%patch6 -p0
+%patch7 -p1
+
+# Remove webservices naming resources as it's generally unused
+%{__rm} -rf java/org/apache/naming/factory/webservices
+
+# Configure maven files
+%mvn_package ":tomcat-el-api" tomcat-el-api
+%mvn_alias "org.apache.tomcat:tomcat-el-api" "org.eclipse.jetty.orbit:javax.el"
+%mvn_package ":tomcat-jsp-api" tomcat-jsp-api
+%mvn_alias "org.apache.tomcat:tomcat-jsp-api" "org.eclipse.jetty.orbit:javax.servlet.jsp"
+%mvn_package ":tomcat-servlet-api" tomcat-servlet-api
-%{__ln_s} $(build-classpath tomcat-taglibs-standard/taglibs-standard-impl) webapps/examples/WEB-INF/lib/jstl.jar
-%{__ln_s} $(build-classpath tomcat-taglibs-standard/taglibs-standard-compat) webapps/examples/WEB-INF/lib/standard.jar
%build
export OPT_JAR_LIST="xalan-j2-serializer"
- # we don't care about the tarballs and we're going to replace
- # tomcat-dbcp.jar with apache-commons-{collections,dbcp,pool}-tomcat5.jar
- # so just create a dummy file for later removal
- touch HACK
+# we don't care about the tarballs and we're going to replace
+# tomcat-dbcp.jar with apache-commons-{collections,dbcp,pool}-tomcat5.jar
+# so just create a dummy file for later removal
+touch HACK
- # who needs a build.properties file anyway
- %{ant} -Dbase.path="." \
- -Dbuild.compiler="modern" \
- -Dcommons-daemon.jar="$(build-classpath apache-commons-daemon)" \
- -Dcommons-daemon.native.src.tgz="HACK" \
- -Djdt.jar="$(build-classpath ecj/ecj)" \
- -Dtomcat-native.tar.gz="HACK" \
- -Dtomcat-native.home="." \
- -Dcommons-daemon.native.win.mgr.exe="HACK" \
- -Dnsis.exe="HACK" \
- -Djaxrpc-lib.jar="$(build-classpath jaxrpc)" \
- -Dwsdl4j-lib.jar="$(build-classpath wsdl4j)" \
- -Dsaaj-api.jar="$(build-classpath geronimo-saaj)" \
- -Dbnd.jar="$(build-classpath aqute-bnd/biz.aQute.bnd)" \
- -Dbndlib.jar="$(build-classpath aqute-bnd/biz.aQute.bndlib)" \
- -Dbndlibg.jar="$(build-classpath aqute-bnd/aQute.libg)" \
- -Dbndannotation.jar="$(build-classpath aqute-bnd/biz.aQute.bnd.annotation)" \
- -Dosgi-annotations.jar="$(build-classpath aqute-bnd/biz.aQute.bnd.annotation)" \
- -Dslf4j-api.jar="$(build-classpath slf4j/slf4j-api)" \
- -Dosgi-cmpn.jar="$(build-classpath osgi-compendium/osgi.cmpn)" \
- -Dversion="%{version}" \
- -Dversion.build="%{micro_version}" \
- deploy dist-source
+# who needs a build.properties file anyway
+%{ant} -Dbase.path="." \
+ -Dbuild.compiler="modern" \
+ -Dcommons-daemon.jar="HACK" \
+ -Dcommons-daemon.native.src.tgz="HACK" \
+ -Djdt.jar="$(build-classpath ecj/ecj)" \
+ -Dtomcat-native.tar.gz="HACK" \
+ -Dtomcat-native.home="." \
+ -Dcommons-daemon.native.win.mgr.exe="HACK" \
+ -Dnsis.exe="HACK" \
+ -Djaxrpc-lib.jar="HACK" \
+ -Dwsdl4j-lib.jar="HACK" \
+ -Dbnd.jar="$(build-classpath aqute-bnd/biz.aQute.bnd)" \
+ -Dbnd-annotation.jar="$(build-classpath aqute-bnd/biz.aQute.bnd.annotation)" \
+ -Dversion="%{version}" \
+ -Dversion.build="%{micro_version}" \
+ deploy
+
+# remove some jars that we'll replace with symlinks later
+%{__rm} output/build/bin/commons-daemon.jar output/build/lib/ecj.jar
+# Remove the example webapps per Apache Tomcat Security Considerations
+# see https://tomcat.apache.org/tomcat-9.0-doc/security-howto.html
+%{__rm} -rf output/build/webapps/examples
- # remove some jars that we'll replace with symlinks later
- %{__rm} output/build/bin/commons-daemon.jar output/build/lib/ecj.jar
-pushd output/dist/src/webapps/docs/appdev/sample/src
-%{__mkdir_p} ../web/WEB-INF/classes
-%{javac} -cp ../../../../../../../../output/build/lib/servlet-api.jar -d ../web/WEB-INF/classes mypackage/Hello.java
-pushd ../web
-%{jar} cf ../../../../../../../../output/build/webapps/docs/appdev/sample/sample.war *
-popd
-popd
%install
# build initial path structure
@@ -272,7 +254,6 @@ popd
/bin/echo "Place your custom *.conf files here. Shell expansion is supported." > ${RPM_BUILD_ROOT}%{confdir}/conf.d/README
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{libdir}
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{logdir}
-/bin/touch ${RPM_BUILD_ROOT}%{logdir}/catalina.out
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{_localstatedir}/lib/tomcats
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{homedir}
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{tempdir}
@@ -301,10 +282,8 @@ popd
${RPM_BUILD_ROOT}%{_sbindir}/%{name}
%{__install} -m 0644 %{SOURCE11} \
${RPM_BUILD_ROOT}%{_unitdir}/%{name}.service
-%{__install} -m 0644 %{SOURCE20} \
- ${RPM_BUILD_ROOT}%{_unitdir}/%{name}-jsvc.service
%{__sed} -e "s|\@\@\@TCLOG\@\@\@|%{logdir}|g" %{SOURCE5} \
- > ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/%{name}
+ > ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/%{name}.disabled
%{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \
-e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \
-e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" %{SOURCE6} \
@@ -323,6 +302,8 @@ popd
%{__install} -m 0644 %{SOURCE32} \
${RPM_BUILD_ROOT}%{_unitdir}/%{name}@.service
+%{__install} -m 0644 %{SOURCE33} ${RPM_BUILD_ROOT}%{confdir}/conf.d/
+
# Substitute libnames in catalina-tasks.xml
sed -i \
"s,el-api.jar,%{name}-el-%{elspec}-api.jar,;
@@ -342,10 +323,6 @@ popd
pushd output/build
%{_bindir}/build-jar-repository lib ecj 2>&1
- # need to use -p here with b-j-r otherwise the examples webapp fails to
- # load with a java.io.IOException
- %{_bindir}/build-jar-repository -p webapps/examples/WEB-INF/lib \
- tomcat-taglibs-standard/taglibs-standard-impl.jar tomcat-taglibs-standard/taglibs-standard-compat.jar 2>&1
popd
pushd ${RPM_BUILD_ROOT}%{libdir}
@@ -354,9 +331,6 @@ pushd ${RPM_BUILD_ROOT}%{libdir}
%{__ln_s} ../../java/%{name}-servlet-%{servletspec}-api.jar .
%{__ln_s} ../../java/%{name}-el-%{elspec}-api.jar .
%{__ln_s} $(build-classpath ecj/ecj) jasper-jdt.jar
-
- # Temporary copy the juli jar here from /usr/share/java/tomcat (for maven depmap)
- %{__cp} -a ${RPM_BUILD_ROOT}%{bindir}/tomcat-juli.jar ./
popd
# symlink to the FHS locations where we've installed things
@@ -369,97 +343,20 @@ pushd ${RPM_BUILD_ROOT}%{homedir}
%{__ln_s} %{workdir} work
popd
-# install sample webapp
-%{__mkdir_p} ${RPM_BUILD_ROOT}%{appdir}/sample
-pushd ${RPM_BUILD_ROOT}%{appdir}/sample
-%{jar} xf ${RPM_BUILD_ROOT}%{appdir}/docs/appdev/sample/sample.war
-popd
-%{__rm} ${RPM_BUILD_ROOT}%{appdir}/docs/appdev/sample/sample.war
-
-# Allow linking for example webapp
-%{__mkdir_p} ${RPM_BUILD_ROOT}%{appdir}/examples/META-INF
-pushd ${RPM_BUILD_ROOT}%{appdir}/examples/META-INF
-echo '' > context.xml
-echo '' >> context.xml
-echo ' ' >> context.xml
-echo '' >> context.xml
+# Install the maven metadata for the spec impl artifacts as other projects use them
+#%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_mavenpomdir}
+pushd res/maven
+ for pom in tomcat-el-api.pom tomcat-jsp-api.pom tomcat-servlet-api.pom; do
+ # fix-up version in all pom files
+ sed -i 's/@MAVEN.DEPLOY.VERSION@/%{version}/g' $pom
+ done
popd
-pushd ${RPM_BUILD_ROOT}%{appdir}/examples/WEB-INF/lib
-%{__ln_s} -f $(build-classpath tomcat-taglibs-standard/taglibs-standard-impl) jstl.jar
-%{__ln_s} -f $(build-classpath tomcat-taglibs-standard/taglibs-standard-compat) standard.jar
-popd
-
-
-# Install the maven metadata
-%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_mavenpomdir}
-pushd output/dist/src/res/maven
-for pom in *.pom; do
- # fix-up version in all pom files
- sed -i 's/@MAVEN.DEPLOY.VERSION@/%{version}/g' $pom
-done
-
-# we won't install dbcp, juli-adapters and juli-extras pom files
-for libname in annotations-api catalina jasper-el jasper catalina-ha; do
- %{__cp} -a %{name}-$libname.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP.%{name}-$libname.pom
- %add_maven_depmap JPP.%{name}-$libname.pom %{name}/$libname.jar -f "tomcat-lib"
-done
-
-# tomcat-util-scan
-%{__cp} -a %{name}-util-scan.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP.%{name}-util-scan.pom
-%add_maven_depmap JPP.%{name}-util-scan.pom %{name}/%{name}-util-scan.jar -f "tomcat-lib"
-
-# tomcat-jni
-%{__cp} -a %{name}-jni.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP.%{name}-jni.pom
-%add_maven_depmap JPP.%{name}-jni.pom %{name}/%{name}-jni.jar -f "tomcat-lib"
-
-# servlet-api jsp-api and el-api are not in tomcat subdir, since they are widely re-used elsewhere
-%{__cp} -a tomcat-jsp-api.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP-tomcat-jsp-api.pom
-%add_maven_depmap JPP-tomcat-jsp-api.pom tomcat-jsp-api.jar -f "tomcat-jsp-api" -a "org.eclipse.jetty.orbit:javax.servlet.jsp"
-
-%{__cp} -a tomcat-el-api.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP-tomcat-el-api.pom
-%add_maven_depmap JPP-tomcat-el-api.pom tomcat-el-api.jar -f "tomcat-el-api" -a "org.eclipse.jetty.orbit:javax.el"
-
-%{__cp} -a tomcat-servlet-api.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP-tomcat-servlet-api.pom
-# Generate a depmap fragment javax.servlet:servlet-api pointing to
-# tomcat-servlet-3.0-api for backwards compatibility
-# also provide jetty depmap (originally in jetty package, but it's cleaner to have it here
-%add_maven_depmap JPP-tomcat-servlet-api.pom tomcat-servlet-api.jar -f "tomcat-servlet-api"
-
-# replace temporary copy with link
-%{__ln_s} -f $(abs2rel %{bindir}/tomcat-juli.jar %{libdir}) ${RPM_BUILD_ROOT}%{libdir}/
-
-# two special pom where jar files have different names
-%{__cp} -a tomcat-tribes.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP.%{name}-catalina-tribes.pom
-%add_maven_depmap JPP.%{name}-catalina-tribes.pom %{name}/catalina-tribes.jar
-
-%{__cp} -a tomcat-coyote.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP.%{name}-tomcat-coyote.pom
-%add_maven_depmap JPP.%{name}-tomcat-coyote.pom %{name}/tomcat-coyote.jar
-
-%{__cp} -a tomcat-juli.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP.%{name}-tomcat-juli.pom
-%add_maven_depmap JPP.%{name}-tomcat-juli.pom %{name}/tomcat-juli.jar
-
-%{__cp} -a tomcat-api.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP.%{name}-tomcat-api.pom
-%add_maven_depmap JPP.%{name}-tomcat-api.pom %{name}/tomcat-api.jar
-
-%{__cp} -a tomcat-util.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP.%{name}-tomcat-util.pom
-%add_maven_depmap JPP.%{name}-tomcat-util.pom %{name}/tomcat-util.jar
-
-%{__cp} -a tomcat-jdbc.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP.%{name}-tomcat-jdbc.pom
-%add_maven_depmap JPP.%{name}-tomcat-jdbc.pom %{name}/tomcat-jdbc.jar
-
-# tomcat-websocket-api
-%{__cp} -a tomcat-websocket-api.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP.%{name}-websocket-api.pom
-%add_maven_depmap JPP.%{name}-websocket-api.pom %{name}/websocket-api.jar
-
-# tomcat-tomcat-websocket
-%{__cp} -a tomcat-websocket.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP.%{name}-tomcat-websocket.pom
-%add_maven_depmap JPP.%{name}-tomcat-websocket.pom %{name}/tomcat-websocket.jar
-
-# tomcat-jaspic-api
-%{__cp} -a tomcat-jaspic-api.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP.%{name}-jaspic-api.pom
-%add_maven_depmap JPP.%{name}-jaspic-api.pom %{name}/jaspic-api.jar
-
+# Configure and install maven artifacts
+%mvn_artifact res/maven/tomcat-el-api.pom output/build/lib/el-api.jar
+%mvn_artifact res/maven/tomcat-jsp-api.pom output/build/lib/jsp-api.jar
+%mvn_artifact res/maven/tomcat-servlet-api.pom output/build/lib/servlet-api.jar
+%mvn_install
%pre
# add the tomcat user and group
@@ -528,6 +425,7 @@ fi
%attr(0755,root,root) %{_libexecdir}/%{name}/preamble
%attr(0755,root,root) %{_libexecdir}/%{name}/server
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/%{name}
+%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}.disabled
%attr(0755,root,tomcat) %dir %{basedir}
%attr(0755,root,tomcat) %dir %{confdir}
@@ -545,6 +443,7 @@ fi
%attr(0775,root,tomcat) %dir %{confdir}/Catalina/localhost
%attr(0755,root,tomcat) %dir %{confdir}/conf.d
%{confdir}/conf.d/README
+%{confdir}/conf.d/java-9-start-up-parameters.conf
%config(noreplace) %{confdir}/%{name}.conf
%config(noreplace) %{confdir}/*.policy
%config(noreplace) %{confdir}/*.properties
@@ -573,39 +472,24 @@ fi
%files docs-webapp
%{appdir}/docs
-%files jsp-%{jspspec}-api -f output/dist/src/res/maven/.mfiles-tomcat-jsp-api
-%{_javadir}/%{name}-jsp-%{jspspec}*.jar
-
-%files lib -f output/dist/src/res/maven/.mfiles-tomcat-lib
+%files lib
%dir %{libdir}
%{libdir}/*.jar
%{_javadir}/*.jar
%{bindir}/tomcat-juli.jar
-%{_mavenpomdir}/JPP.%{name}-annotations-api.pom
-%{_mavenpomdir}/JPP.%{name}-catalina-ha.pom
-%{_mavenpomdir}/JPP.%{name}-catalina-tribes.pom
-%{_mavenpomdir}/JPP.%{name}-catalina.pom
-%{_mavenpomdir}/JPP.%{name}-jasper-el.pom
-%{_mavenpomdir}/JPP.%{name}-jasper.pom
-%{_mavenpomdir}/JPP.%{name}-tomcat-api.pom
-%{_mavenpomdir}/JPP.%{name}-tomcat-juli.pom
-%{_mavenpomdir}/JPP.%{name}-tomcat-coyote.pom
-%{_mavenpomdir}/JPP.%{name}-tomcat-util.pom
-%{_mavenpomdir}/JPP.%{name}-tomcat-jdbc.pom
-%{_mavenpomdir}/JPP.%{name}-websocket-api.pom
-%{_mavenpomdir}/JPP.%{name}-tomcat-websocket.pom
-%{_mavenpomdir}/JPP.%{name}-jaspic-api.pom
-%{_datadir}/maven-metadata/tomcat.xml
%exclude %{libdir}/%{name}-el-%{elspec}-api.jar
%exclude %{_javadir}/%{name}-servlet-%{servletspec}*.jar
%exclude %{_javadir}/%{name}-el-%{elspec}-api.jar
%exclude %{_javadir}/%{name}-jsp-%{jspspec}*.jar
-%files servlet-%{servletspec}-api -f output/dist/src/res/maven/.mfiles-tomcat-servlet-api
+%files jsp-%{jspspec}-api -f .mfiles-tomcat-jsp-api
+%{_javadir}/%{name}-jsp-%{jspspec}*.jar
+
+%files servlet-%{servletspec}-api -f .mfiles-tomcat-servlet-api
%doc LICENSE
%{_javadir}/%{name}-servlet-%{servletspec}*.jar
-%files el-%{elspec}-api -f output/dist/src/res/maven/.mfiles-tomcat-el-api
+%files el-%{elspec}-api -f .mfiles-tomcat-el-api
%doc LICENSE
%{_javadir}/%{name}-el-%{elspec}-api.jar
%{libdir}/%{name}-el-%{elspec}-api.jar
@@ -613,16 +497,21 @@ fi
%files webapps
%defattr(0644,tomcat,tomcat,0755)
%{appdir}/ROOT
-%{appdir}/examples
-%{appdir}/sample
-%files jsvc
-%defattr(755,root,root,0755)
-%attr(0644,root,root) %{_unitdir}/%{name}-jsvc.service
-%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
-%attr(0660,tomcat,tomcat) %verify(not size md5 mtime) %{logdir}/catalina.out
%changelog
+* Mon Jan 16 2023 Hui Wang - 1:9.0.62-1
+- Update to 9.0.62. Related: rhbz#2160511
+- Remove examples webapps from subpackage
+- Remove maven artifacts from build as they aren't very useful
+- Drop JSVC support as it's not very useful these days
+- Drop geronimo-saaj as it's no longer required
+- Drop geronimo-jaxrpc, which provided the webservices naming factory resources that are generally unused
+- Cleaning up some unused deps and system properties
+- Add Java 9 start-up parameters to allow reflection
+- Add bnd-annotation which is in bndlib
+- Add fixes for memory leak which have been fixed in 9.0.64
+
* Fri Apr 16 2021 Mohan Boddu - 1:9.0.44-2
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937