Resolves: RHEL-51222

This commit is contained in:
Adam Krajcik 2025-02-04 17:25:10 +01:00
parent 9bc8c42f1a
commit 985723a299
21 changed files with 183 additions and 215 deletions

View File

@ -1,40 +0,0 @@
diff --git a/java/org/apache/catalina/mbeans/JmxRemoteLifecycleListener.java b/java/org/apache/catalina/mbeans/JmxRemoteLifecycleListener.java
index f62f8d1..db19960 100644
--- a/java/org/apache/catalina/mbeans/JmxRemoteLifecycleListener.java
+++ b/java/org/apache/catalina/mbeans/JmxRemoteLifecycleListener.java
@@ -611,34 +611,28 @@ public class JmxRemoteLifecycleListener extends SSLHostConfig implements Lifecyc
* Better to use the internal API than re-invent the wheel.
*/
@SuppressWarnings("restriction")
- private static class JmxRegistry extends sun.rmi.registry.RegistryImpl {
+ private static class JmxRegistry {
private static final long serialVersionUID = -3772054804656428217L;
private final String jmxName;
private final Remote jmxServer;
public JmxRegistry(int port, RMIClientSocketFactory csf,
RMIServerSocketFactory ssf, String jmxName, Remote jmxServer) throws RemoteException {
- super(port, csf, ssf);
this.jmxName = jmxName;
this.jmxServer = jmxServer;
}
- @Override
public Remote lookup(String name)
throws RemoteException, NotBoundException {
return (jmxName.equals(name)) ? jmxServer : null;
}
- @Override
public void bind(String name, Remote obj)
throws RemoteException, AlreadyBoundException, AccessException {
}
- @Override
public void unbind(String name)
throws RemoteException, NotBoundException, AccessException {
}
- @Override
public void rebind(String name, Remote obj)
throws RemoteException, AccessException {
}
- @Override
public String[] list() throws RemoteException {
return new String[] { jmxName };
}

View File

@ -1,7 +0,0 @@
# 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

View File

@ -0,0 +1,7 @@
# Add the module start-up parameters required by Tomcat
JAVA_OPTS="$JAVA_OPTS --add-opens=java.base/java.lang=ALL-UNNAMED"
JAVA_OPTS="$JAVA_OPTS --add-opens=java.base/java.io=ALL-UNNAMED"
JAVA_OPTS="$JAVA_OPTS --add-opens=java.base/java.util=ALL-UNNAMED"
JAVA_OPTS="$JAVA_OPTS --add-opens=java.base/java.util.concurrent=ALL-UNNAMED"
JAVA_OPTS="$JAVA_OPTS --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED"
export JAVA_OPTS

View File

@ -1,7 +1,6 @@
diff -up ./build.xml.orig ./build.xml --- build.xml.orig 2025-02-04 18:48:03.291725907 +0100
--- build.xml.orig 2021-07-07 10:53:55.493742841 +0800 +++ build.xml 2025-02-04 18:56:28.876849900 +0100
+++ build.xml 2021-07-07 11:09:43.107968515 +0800 @@ -1071,7 +1071,7 @@
@@ -1020,7 +1020,7 @@
filesDir="${tomcat.classes}" filesDir="${tomcat.classes}"
filesId="files.annotations-api" filesId="files.annotations-api"
manifest="${tomcat.manifests}/annotations-api.jar.manifest" manifest="${tomcat.manifests}/annotations-api.jar.manifest"
@ -10,7 +9,7 @@ diff -up ./build.xml.orig ./build.xml
<!-- Servlet Implementation JAR File --> <!-- Servlet Implementation JAR File -->
<jarIt jarfile="${servlet-api.jar}" <jarIt jarfile="${servlet-api.jar}"
@@ -1029,41 +1029,41 @@ @@ -1080,48 +1080,48 @@
manifest="${tomcat.manifests}/servlet-api.jar.manifest" manifest="${tomcat.manifests}/servlet-api.jar.manifest"
notice="${tomcat.manifests}/servlet-api.jar.notice" notice="${tomcat.manifests}/servlet-api.jar.notice"
license="${tomcat.manifests}/servlet-api.jar.license" license="${tomcat.manifests}/servlet-api.jar.license"
@ -39,6 +38,14 @@ diff -up ./build.xml.orig ./build.xml
filesId="files.websocket-api" filesId="files.websocket-api"
manifest="${tomcat.manifests}/websocket-api.jar.manifest" manifest="${tomcat.manifests}/websocket-api.jar.manifest"
- addOSGi="true" /> - addOSGi="true" />
+ addOSGi="false" />
<!-- WebSocket Client API JAR File -->
<jarIt jarfile="${websocket-client-api.jar}"
filesDir="${tomcat.classes}"
filesId="files.websocket-client-api"
manifest="${tomcat.manifests}/websocket-client-api.jar.manifest"
- addOSGi="true" />
+ addOSGi="false" /> + addOSGi="false" />
<!-- JASPIC API JAR File --> <!-- JASPIC API JAR File -->
@ -58,7 +65,7 @@ diff -up ./build.xml.orig ./build.xml
<!-- Bootstrap JAR File --> <!-- Bootstrap JAR File -->
<jarIt jarfile="${bootstrap.jar}" <jarIt jarfile="${bootstrap.jar}"
@@ -1075,61 +1075,61 @@ @@ -1133,61 +1133,61 @@
<jarIt jarfile="${tomcat-util.jar}" <jarIt jarfile="${tomcat-util.jar}"
filesDir="${tomcat.classes}" filesDir="${tomcat.classes}"
filesId="files.tomcat-util" filesId="files.tomcat-util"
@ -130,7 +137,7 @@ diff -up ./build.xml.orig ./build.xml
<!-- Catalina Ant Tasks JAR File --> <!-- Catalina Ant Tasks JAR File -->
<jarIt jarfile="${catalina-ant.jar}" <jarIt jarfile="${catalina-ant.jar}"
@@ -1140,27 +1140,27 @@ @@ -1198,27 +1198,27 @@
<jarIt jarfile="${catalina-storeconfig.jar}" <jarIt jarfile="${catalina-storeconfig.jar}"
filesDir="${tomcat.classes}" filesDir="${tomcat.classes}"
filesId="files.catalina-storeconfig" filesId="files.catalina-storeconfig"
@ -162,7 +169,7 @@ diff -up ./build.xml.orig ./build.xml
<!-- i18n JARs --> <!-- i18n JARs -->
<jar jarfile="${tomcat.build}/lib/tomcat-i18n-cs.jar" <jar jarfile="${tomcat.build}/lib/tomcat-i18n-cs.jar"
@@ -1620,7 +1620,7 @@ @@ -1704,7 +1704,7 @@
filesId="files.tomcat-embed-core" filesId="files.tomcat-embed-core"
notice="${tomcat.manifests}/servlet-api.jar.notice" notice="${tomcat.manifests}/servlet-api.jar.notice"
license="${tomcat.manifests}/servlet-api.jar.license" license="${tomcat.manifests}/servlet-api.jar.license"
@ -171,7 +178,7 @@ diff -up ./build.xml.orig ./build.xml
addGraal="true" addGraal="true"
graalPrefix="org.apache.tomcat.embed/tomcat-embed-core" graalPrefix="org.apache.tomcat.embed/tomcat-embed-core"
graalFiles="res/graal/tomcat-embed-core/native-image" graalFiles="res/graal/tomcat-embed-core/native-image"
@@ -1628,7 +1628,7 @@ @@ -1712,7 +1712,7 @@
<jarIt jarfile="${tomcat-embed-el.jar}" <jarIt jarfile="${tomcat-embed-el.jar}"
filesDir="${tomcat.classes}" filesDir="${tomcat.classes}"
filesId="files.tomcat-embed-el" filesId="files.tomcat-embed-el"
@ -180,7 +187,7 @@ diff -up ./build.xml.orig ./build.xml
addGraal="true" addGraal="true"
graalPrefix="org.apache.tomcat.embed/tomcat-embed-el" graalPrefix="org.apache.tomcat.embed/tomcat-embed-el"
graalFiles="res/graal/tomcat-embed-el/native-image" graalFiles="res/graal/tomcat-embed-el/native-image"
@@ -1637,7 +1637,7 @@ @@ -1721,7 +1721,7 @@
filesDir="${tomcat.classes}" filesDir="${tomcat.classes}"
filesId="files.tomcat-embed-jasper" filesId="files.tomcat-embed-jasper"
meta-inf="${tomcat.manifests}/jasper.jar" meta-inf="${tomcat.manifests}/jasper.jar"
@ -189,7 +196,7 @@ diff -up ./build.xml.orig ./build.xml
addGraal="true" addGraal="true"
graalPrefix="org.apache.tomcat.embed/tomcat-embed-jasper" graalPrefix="org.apache.tomcat.embed/tomcat-embed-jasper"
graalFiles="res/graal/tomcat-embed-jasper/native-image" graalFiles="res/graal/tomcat-embed-jasper/native-image"
@@ -1646,7 +1646,7 @@ @@ -1730,7 +1730,7 @@
filesDir="${tomcat.classes}" filesDir="${tomcat.classes}"
filesId="files.tomcat-embed-websocket" filesId="files.tomcat-embed-websocket"
meta-inf="${tomcat.manifests}/tomcat-websocket.jar" meta-inf="${tomcat.manifests}/tomcat-websocket.jar"

View File

@ -1 +1 @@
SHA512 (tomcat-9.0.87.redhat-00005-src.zip) = a8574039027b7fd990dc6a6a705e58fb45e5a2e6051cc2da9e7d46513b0d2b0846ffa85ae33be747436ad108464087ba7029880287903e0a53788cfa18a889cf SHA512 (tomcat-10.1.8.redhat-00022-src.zip) = 78c9fadb1cbe42047860acb3894a6e9c47d07ec05229e0a31813737a9ebdc7c7f8ce72077951741535c7ac5e083ab8bd852897f6f6901fd19fbee5f6ca833be9

View File

@ -0,0 +1,30 @@
--- java/org/apache/jasper/compiler/JDTCompiler.java.orig 2025-02-04 19:19:35.610448198 +0100
+++ java/org/apache/jasper/compiler/JDTCompiler.java 2025-02-04 19:22:46.320745556 +0100
@@ -314,9 +314,9 @@ public class JDTCompiler extends org.apa
} else if(opt.equals("17")) {
settings.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_17);
} else if(opt.equals("18")) {
- settings.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_18);
+ settings.put(CompilerOptions.OPTION_Source, "18");
} else if (opt.equals("19")) {
- settings.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_19);
+ settings.put(CompilerOptions.OPTION_Source, "19");
} else if (opt.equals("20")) {
// Constant not available in latest ECJ version shipped with
// Tomcat. May be supported in a snapshot build.
@@ -389,11 +389,11 @@ public class JDTCompiler extends org.apa
settings.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_17);
settings.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_17);
} else if(opt.equals("18")) {
- settings.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_18);
- settings.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_18);
+ settings.put(CompilerOptions.OPTION_TargetPlatform, "18");
+ settings.put(CompilerOptions.OPTION_Compliance, "18");
} else if (opt.equals("19")) {
- settings.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_19);
- settings.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_19);
+ settings.put(CompilerOptions.OPTION_TargetPlatform, "19");
+ settings.put(CompilerOptions.OPTION_Compliance, "19");
} else if (opt.equals("20")) {
// Constant not available in latest ECJ version shipped with
// Tomcat. May be supported in a snapshot build.

View File

@ -1,6 +1,6 @@
--- build.xml.orig 2023-01-19 10:39:11.163687508 +0800 --- build.xml.orig 2023-01-29 17:38:29.477052402 +0800
+++ build.xml 2023-01-19 10:44:42.960604444 +0800 +++ build.xml 2023-01-29 17:42:03.369583841 +0800
@@ -213,6 +213,7 @@ @@ -216,6 +216,7 @@
<!-- Classpaths --> <!-- Classpaths -->
<path id="compile.classpath"> <path id="compile.classpath">
<pathelement location="${bnd.jar}"/> <pathelement location="${bnd.jar}"/>

View File

@ -0,0 +1,16 @@
--- conf/catalina.policy.orig 2024-05-22 16:12:23.809886452 +0300
+++ conf/catalina.policy 2024-05-22 16:14:38.913939654 +0300
@@ -55,6 +55,14 @@
permission java.security.AllPermission;
};
+// ========== RHEL SPECIFIC CODE PERMISSIONS =======================================
+
+// Allowing everything in /usr/share/java allows too many unknowns to be permitted
+// Specifying the individual jars that tomcat needs to function with the security manager
+// is the safest way forward.
+grant codeBase "file:/usr/share/java/ecj/ecj.jar" {
+ permission java.security.AllPermission;
+};
// ========== CATALINA CODE PERMISSIONS =======================================

View File

@ -28,24 +28,15 @@ CATALINA_HOME="@@@TCHOME@@@"
# System-wide tmp # System-wide tmp
CATALINA_TMPDIR="/var/cache/tomcat/temp" CATALINA_TMPDIR="/var/cache/tomcat/temp"
# You can pass some parameters to java here if you wish to
#JAVA_OPTS="-Xminf0.1 -Xmaxf0.3"
# Use JAVA_OPTS to set java.library.path for libtcnative.so
#JAVA_OPTS="-Djava.library.path=/usr/lib"
# Set default javax.sql.DataSource factory to apache commons one. See rhbz#1214381
JAVA_OPTS="-Djavax.sql.DataSource.Factory=org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory"
# You can change your tomcat locale here # You can change your tomcat locale here
#LANG="en_US" #LANG="en_US"
# Run tomcat under the Java Security Manager # Run tomcat under the Java Security Manager
SECURITY_MANAGER="false" SECURITY_MANAGER="false"
# SHUTDOWN_WAIT has been deprecated. To change the shutdown wait time, set
# TimeoutStopSec in tomcat.service.
# If you wish to further customize your tomcat environment, # If you wish to further customize your tomcat environment,
# put your own definitions here # put your own definitions here
# (i.e. LD_LIBRARY_PATH for some jdbc drivers) # (i.e. LD_LIBRARY_PATH for some jdbc drivers)
# You can also pass parameters to Java here by defining JAVA_OPTS variable
# (e.g. JAVA_OPTS="-Xminf0.1 -Xmaxf0.3")

View File

@ -1,25 +0,0 @@
--- 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 =======================================
+
+
+// Allowing everything in /usr/share/java allows too many unknowns to be permitted
+// Specifying the individual jars that tomcat needs to function with the security manager
+// is the safest way forward.
+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
+// };

19
tomcat-build.patch Normal file
View File

@ -0,0 +1,19 @@
diff -up ./res/bnd/build-defaults.bnd.orig ./res/bnd/build-defaults.bnd
--- res/bnd/build-defaults.bnd.orig 2023-10-16 11:23:04.752754202 +0800
+++ res/bnd/build-defaults.bnd 2023-10-16 11:23:29.931876910 +0800
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-Bundle-Version: ${version_cleanup;${version}}
+Bundle-Version: ${version}
Bundle-License: https://www.apache.org/licenses/LICENSE-2.0.txt
Specification-Title: Apache Tomcat
@@ -36,4 +36,4 @@ X-Compile-Target-JDK: ${compile.release}
-removeheaders: DSTAMP,TODAY,TSTAMP
-module.name: org.apache.${replace;${Bundle-Name};-;.}
\ No newline at end of file
+module.name: org.apache.${replace;${Bundle-Name};-;.}

View File

@ -13,30 +13,9 @@ _save_function() {
eval "$NEWNAME_FUNC" eval "$NEWNAME_FUNC"
} }
run_jsvc(){
if [ -x /usr/bin/jsvc ]; then
TOMCAT_USER="${TOMCAT_USER:-tomcat}"
JSVC="/usr/bin/jsvc"
JSVC_OPTS="-nodetach -pidfile /var/run/jsvc-tomcat${NAME}.pid -user ${TOMCAT_USER} -outfile ${CATALINA_BASE}/logs/catalina.out -errfile ${CATALINA_BASE}/logs/catalina.out"
if [ "$1" = "stop" ]; then
JSVC_OPTS="${JSVC_OPTS} -stop"
fi
exec "${JSVC}" ${JSVC_OPTS} ${FLAGS} -classpath "${CLASSPATH}" ${OPTIONS} "${MAIN_CLASS}" "${@}"
else
echo "Can't find /usr/bin/jsvc executable"
fi
}
_save_function run run_java _save_function run run_java
run() { run() {
if [ "${USE_JSVC}" = "true" ] ; then
run_jsvc $@
else
run_java $@ run_java $@
fi
} }

View File

@ -28,19 +28,17 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# #
%global jspspec 2.3 %global jspspec 3.1
%global major_version 9 %global major_version 10
%global minor_version 0 %global minor_version 1
%global micro_version 87 %global micro_version 8
%global packdname %{name}-%{major_version}.%{minor_version}.%{micro_version}.redhat-00005-src %global packdname %{name}-%{major_version}.%{minor_version}.%{micro_version}.redhat-00022-src
%global servletspec 4.0 %global servletspec 6.0
%global elspec 3.0 %global elspec 5.0
%global tcuid 53 %global tcuid 53
# Recommended version is specified in java/org/apache/catalina/core/AprLifecycleListener.java
%global native_version 1.2.21
# FHS 2.3 compliant tree structure - http://www.pathname.com/fhs/2.3/ # FHS 3.0 compliant tree structure - http://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html
%global basedir %{_var}/lib/%{name} %global basedir %{_var}/lib/%{name}
%global appdir %{basedir}/webapps %global appdir %{basedir}/webapps
%global homedir %{_datadir}/%{name} %global homedir %{_datadir}/%{name}
@ -51,61 +49,58 @@
%global cachedir %{_var}/cache/%{name} %global cachedir %{_var}/cache/%{name}
%global tempdir %{cachedir}/temp %global tempdir %{cachedir}/temp
%global workdir %{cachedir}/work %global workdir %{cachedir}/work
%global _systemddir /lib/systemd/system
Name: tomcat Name: tomcat
Epoch: 1 Epoch: 1
Version: %{major_version}.%{minor_version}.%{micro_version} Version: %{major_version}.%{minor_version}.%{micro_version}
Release: 3%{?dist} Release: 1%{?dist}
Summary: Apache Servlet/JSP Engine, RI for Servlet %{servletspec}/JSP %{jspspec} API Summary: Apache Servlet/JSP Engine, RI for Servlet %{servletspec}/JSP %{jspspec} API
License: ASL 2.0 License: Apache-2.0
URL: http://tomcat.apache.org/ URL: http://tomcat.apache.org/
Source0: %{packdname}.zip Source0: %{packdname}.zip
Source1: %{name}-%{major_version}.%{minor_version}.conf Source1: %{name}-%{major_version}.%{minor_version}.conf
Source3: %{name}-%{major_version}.%{minor_version}.sysconfig Source2: %{name}-%{major_version}.%{minor_version}.sysconfig
Source4: %{name}-%{major_version}.%{minor_version}.wrapper Source3: %{name}-%{major_version}.%{minor_version}.wrapper
Source5: %{name}-%{major_version}.%{minor_version}.logrotate Source4: %{name}-%{major_version}.%{minor_version}.logrotate
Source6: %{name}-%{major_version}.%{minor_version}-digest.script Source5: %{name}-%{major_version}.%{minor_version}-digest.script
Source7: %{name}-%{major_version}.%{minor_version}-tool-wrapper.script Source6: %{name}-%{major_version}.%{minor_version}-tool-wrapper.script
Source11: %{name}-%{major_version}.%{minor_version}.service Source7: %{name}-%{major_version}.%{minor_version}.service
Source21: tomcat-functions Source8: %{name}-functions
Source30: tomcat-preamble Source9: %{name}-preamble
Source31: tomcat-server Source10: %{name}-server
Source32: tomcat-named.service Source11: %{name}-named.service
Source33: java-9-start-up-parameters.conf Source12: module-start-up-parameters.conf
Patch0: %{name}-%{major_version}.%{minor_version}-bootstrap-MANIFEST.MF.patch Patch0: %{name}-%{major_version}.%{minor_version}-bootstrap-MANIFEST.MF.patch
Patch1: %{name}-%{major_version}.%{minor_version}-tomcat-users-webapp.patch Patch1: %{name}-%{major_version}.%{minor_version}-tomcat-users-webapp.patch
Patch3: %{name}-%{major_version}.%{minor_version}-catalina-policy.patch Patch3: %{name}-%{major_version}.%{minor_version}-catalina-policy.patch
Patch4: rhbz-1857043.patch Patch4: %{name}-%{major_version}.%{minor_version}-bnd-annotation.patch
Patch6: %{name}-%{major_version}.%{minor_version}-bnd-annotation.patch Patch5: %{name}-%{major_version}.%{minor_version}-JDTCompiler.patch
Patch7: JmxRemoteLifecycleListener.patch Patch6: rhbz-1857043.patch
BuildArch: noarch BuildArch: noarch
BuildRequires: ant BuildRequires: ant >= 1.10.2
BuildRequires: ecj >= 1:4.10 BuildRequires: ecj >= 4.20
BuildRequires: findutils BuildRequires: findutils
BuildRequires: java-devel BuildRequires: java-devel
BuildRequires: javapackages-local BuildRequires: javapackages-local
BuildRequires: aqute-bnd BuildRequires: aqute-bnd
BuildRequires: aqute-bndlib BuildRequires: aqute-bndlib
BuildRequires: systemd BuildRequires: systemd
BuildRequires: tomcat-jakartaee-migration
Requires: java-headless Requires: java-headless
Requires: javapackages-tools Requires: javapackages-tools
Requires: %{name}-lib = %{epoch}:%{version}-%{release} Requires: %{name}-lib = %{epoch}:%{version}-%{release}
%if 0%{?fedora} || 0%{?rhel} > 7
Recommends: tomcat-native >= %{native_version}
%endif
Requires(pre): shadow-utils Requires(pre): shadow-utils
Requires(post): systemd Requires(post): systemd
Requires(preun): systemd Requires(preun): systemd
Requires(postun): systemd Requires(postun): systemd
# added after log4j sub-package was removed Conflicts: tomcat9
Provides: %{name}-log4j = %{epoch}:%{version}-%{release}
%description %description
Tomcat is the servlet container that is used in the official Reference Tomcat is the servlet container that is used in the official Reference
@ -120,6 +115,8 @@ to be a collaboration of the best-of-breed developers from around the world.
%package admin-webapps %package admin-webapps
Summary: The host-manager and manager web applications for Apache Tomcat Summary: The host-manager and manager web applications for Apache Tomcat
Requires: %{name} = %{epoch}:%{version}-%{release} Requires: %{name} = %{epoch}:%{version}-%{release}
Conflicts: tomcat9
Conflicts: tomcat9-admin-webapps
%description admin-webapps %description admin-webapps
The host-manager and manager web applications for Apache Tomcat. The host-manager and manager web applications for Apache Tomcat.
@ -127,6 +124,8 @@ The host-manager and manager web applications for Apache Tomcat.
%package docs-webapp %package docs-webapp
Summary: The docs web application for Apache Tomcat Summary: The docs web application for Apache Tomcat
Requires: %{name} = %{epoch}:%{version}-%{release} Requires: %{name} = %{epoch}:%{version}-%{release}
Conflicts: tomcat9
Conflicts: tomcat9-docs-webapp
%description docs-webapp %description docs-webapp
The docs web application for Apache Tomcat. The docs web application for Apache Tomcat.
@ -134,8 +133,12 @@ The docs web application for Apache Tomcat.
%package jsp-%{jspspec}-api %package jsp-%{jspspec}-api
Summary: Apache Tomcat JavaServer Pages v%{jspspec} API Implementation Classes Summary: Apache Tomcat JavaServer Pages v%{jspspec} API Implementation Classes
Provides: jsp = %{jspspec} Provides: jsp = %{jspspec}
Obsoletes: %{name}-jsp-api < %{jspspec}
Requires: %{name}-servlet-%{servletspec}-api = %{epoch}:%{version}-%{release} Requires: %{name}-servlet-%{servletspec}-api = %{epoch}:%{version}-%{release}
Requires: %{name}-el-%{elspec}-api = %{epoch}:%{version}-%{release} Requires: %{name}-el-%{elspec}-api = %{epoch}:%{version}-%{release}
Conflicts: tomcat9
Conflicts: tomcat9-jsp-2.3-api
%description jsp-%{jspspec}-api %description jsp-%{jspspec}-api
Apache Tomcat JSP API Implementation Classes. Apache Tomcat JSP API Implementation Classes.
@ -145,8 +148,14 @@ Summary: Libraries needed to run the Tomcat Web container
Requires: %{name}-jsp-%{jspspec}-api = %{epoch}:%{version}-%{release} Requires: %{name}-jsp-%{jspspec}-api = %{epoch}:%{version}-%{release}
Requires: %{name}-servlet-%{servletspec}-api = %{epoch}:%{version}-%{release} Requires: %{name}-servlet-%{servletspec}-api = %{epoch}:%{version}-%{release}
Requires: %{name}-el-%{elspec}-api = %{epoch}:%{version}-%{release} Requires: %{name}-el-%{elspec}-api = %{epoch}:%{version}-%{release}
Requires: ecj >= 1:4.10 Requires: ecj >= 4.20
Recommends: tomcat-jakartaee-migration
Requires(preun): coreutils Requires(preun): coreutils
Conflicts: tomcat9
Conflicts: tomcat9-lib
Conflicts: tomcat9-jsp-2.3-api
Conflicts: tomcat9-servlet-4.0-api
Conflicts: tomcat9-el-3.0-api
%description lib %description lib
Libraries needed to run the Tomcat Web container. Libraries needed to run the Tomcat Web container.
@ -154,8 +163,9 @@ Libraries needed to run the Tomcat Web container.
%package servlet-%{servletspec}-api %package servlet-%{servletspec}-api
Summary: Apache Tomcat Java Servlet v%{servletspec} API Implementation Classes Summary: Apache Tomcat Java Servlet v%{servletspec} API Implementation Classes
Provides: servlet = %{servletspec} Provides: servlet = %{servletspec}
Provides: servlet6 Obsoletes: %{name}-servlet-api < %{servletspec}
Provides: servlet3 Conflicts: tomcat9
Conflicts: tomcat9-servlet-4.0-api
%description servlet-%{servletspec}-api %description servlet-%{servletspec}-api
Apache Tomcat Servlet API Implementation Classes. Apache Tomcat Servlet API Implementation Classes.
@ -163,6 +173,9 @@ Apache Tomcat Servlet API Implementation Classes.
%package el-%{elspec}-api %package el-%{elspec}-api
Summary: Apache Tomcat Expression Language v%{elspec} API Implementation Classes Summary: Apache Tomcat Expression Language v%{elspec} API Implementation Classes
Provides: el_api = %{elspec} Provides: el_api = %{elspec}
Obsoletes: %{name}-el-api < %{elspec}
Conflicts: tomcat9
Conflicts: tomcat9-el-3.0-api
%description el-%{elspec}-api %description el-%{elspec}-api
Apache Tomcat EL API Implementation Classes. Apache Tomcat EL API Implementation Classes.
@ -170,6 +183,8 @@ Apache Tomcat EL API Implementation Classes.
%package webapps %package webapps
Summary: The ROOT web application for Apache Tomcat Summary: The ROOT web application for Apache Tomcat
Requires: %{name} = %{epoch}:%{version}-%{release} Requires: %{name} = %{epoch}:%{version}-%{release}
Conflicts: tomcat9
Conflicts: tomcat9-webapps
%description webapps %description webapps
The ROOT web application for Apache Tomcat. The ROOT web application for Apache Tomcat.
@ -180,28 +195,26 @@ The ROOT web application for Apache Tomcat.
find . -type f \( -name "*.bat" -o -name "*.class" -o -name Thumbs.db -o -name "*.gz" -o \ find . -type f \( -name "*.bat" -o -name "*.class" -o -name Thumbs.db -o -name "*.gz" -o \
-name "*.jar" -o -name "*.war" -o -name "*.zip" \) -delete -name "*.jar" -o -name "*.war" -o -name "*.zip" \) -delete
%patch -P0 -p0 %patch 0 -p0
%patch -P1 -p0 %patch 1 -p0
%patch -P3 -p0 %patch 3 -p0
%patch -P4 -p0 %patch 4 -p0
%patch -P6 -p0 %patch 5 -p0
%patch -P7 -p1 %patch 6 -p0
# Remove webservices naming resources as it's generally unused # Remove webservices naming resources as it's generally unused
%{__rm} -rf java/org/apache/naming/factory/webservices %{__rm} -rf java/org/apache/naming/factory/webservices
# Configure maven files # Configure maven files
%mvn_package ":tomcat-el-api" tomcat-el-api %mvn_package ":tomcat-el-api" tomcat-el-api
%mvn_alias "org.apache.tomcat:tomcat-el-api" "org.eclipse.jetty.orbit:javax.el" %mvn_alias "org.apache.tomcat:tomcat-el-api" "jakarta.servlet:jakarta.servlet-api"
%mvn_package ":tomcat-jsp-api" tomcat-jsp-api %mvn_package ":tomcat-jsp-api" tomcat-jsp-api
%mvn_alias "org.apache.tomcat:tomcat-jsp-api" "org.eclipse.jetty.orbit:javax.servlet.jsp" %mvn_alias "org.apache.tomcat:tomcat-jsp-api" "jakarta.servlet:jakarta.servlet.jsp"
%mvn_package ":tomcat-servlet-api" tomcat-servlet-api %mvn_package ":tomcat-servlet-api" tomcat-servlet-api
%build %build
export OPT_JAR_LIST="xalan-j2-serializer" # we don't care about the tarballs and we're going to replace jars
# 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 # so just create a dummy file for later removal
touch HACK touch HACK
@ -221,12 +234,13 @@ touch HACK
-Dbnd-annotation.jar="$(build-classpath aqute-bnd/biz.aQute.bnd.annotation)" \ -Dbnd-annotation.jar="$(build-classpath aqute-bnd/biz.aQute.bnd.annotation)" \
-Dversion="%{version}" \ -Dversion="%{version}" \
-Dversion.build="%{micro_version}" \ -Dversion.build="%{micro_version}" \
-Dmigration-lib.jar="$(build-classpath tomcat-jakartaee-migration/jakartaee-migration.jar)" \
deploy deploy
# remove some jars that we'll replace with symlinks later # remove some jars that we'll replace with symlinks later
%{__rm} output/build/lib/ecj.jar %{__rm} output/build/bin/commons-daemon.jar output/build/lib/ecj.jar output/build/lib/jakartaee-migration.jar
# Remove the example webapps per Apache Tomcat Security Considerations # Remove the example webapps per Apache Tomcat Security Considerations
# see https://tomcat.apache.org/tomcat-9.0-doc/security-howto.html # see https://tomcat.apache.org/tomcat-10.1-doc/security-howto.html
%{__rm} -rf output/build/webapps/examples %{__rm} -rf output/build/webapps/examples
@ -234,7 +248,6 @@ touch HACK
# build initial path structure # build initial path structure
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_bindir} %{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_bindir}
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_sbindir} %{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_sbindir}
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_systemddir}
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d %{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig %{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{appdir} %{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{appdir}
@ -267,33 +280,33 @@ popd
> ${RPM_BUILD_ROOT}%{confdir}/%{name}.conf > ${RPM_BUILD_ROOT}%{confdir}/%{name}.conf
%{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \ %{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \
-e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \ -e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \
-e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" %{SOURCE3} \ -e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" %{SOURCE2} \
> ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/%{name} > ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/%{name}
%{__install} -m 0644 %{SOURCE4} \ %{__install} -m 0755 %{SOURCE3} \
${RPM_BUILD_ROOT}%{_sbindir}/%{name} ${RPM_BUILD_ROOT}%{_sbindir}/%{name}
%{__install} -m 0644 %{SOURCE11} \ %{__install} -m 0644 %{SOURCE7} \
${RPM_BUILD_ROOT}%{_unitdir}/%{name}.service ${RPM_BUILD_ROOT}%{_unitdir}/%{name}.service
%{__sed} -e "s|\@\@\@TCLOG\@\@\@|%{logdir}|g" %{SOURCE5} \ %{__sed} -e "s|\@\@\@TCLOG\@\@\@|%{logdir}|g" %{SOURCE4} \
> ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/%{name}.disabled > ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/%{name}.disabled
%{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \ %{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \
-e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \ -e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \
-e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" %{SOURCE6} \ -e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" %{SOURCE5} \
> ${RPM_BUILD_ROOT}%{_bindir}/%{name}-digest > ${RPM_BUILD_ROOT}%{_bindir}/%{name}-digest
%{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \ %{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \
-e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \ -e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \
-e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" %{SOURCE7} \ -e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" %{SOURCE6} \
> ${RPM_BUILD_ROOT}%{_bindir}/%{name}-tool-wrapper > ${RPM_BUILD_ROOT}%{_bindir}/%{name}-tool-wrapper
%{__install} -m 0644 %{SOURCE21} \ %{__install} -m 0644 %{SOURCE8} \
${RPM_BUILD_ROOT}%{_libexecdir}/%{name}/functions ${RPM_BUILD_ROOT}%{_libexecdir}/%{name}/functions
%{__install} -m 0755 %{SOURCE30} \ %{__install} -m 0755 %{SOURCE9} \
${RPM_BUILD_ROOT}%{_libexecdir}/%{name}/preamble ${RPM_BUILD_ROOT}%{_libexecdir}/%{name}/preamble
%{__install} -m 0755 %{SOURCE31} \ %{__install} -m 0755 %{SOURCE10} \
${RPM_BUILD_ROOT}%{_libexecdir}/%{name}/server ${RPM_BUILD_ROOT}%{_libexecdir}/%{name}/server
%{__install} -m 0644 %{SOURCE32} \ %{__install} -m 0644 %{SOURCE11} \
${RPM_BUILD_ROOT}%{_unitdir}/%{name}@.service ${RPM_BUILD_ROOT}%{_unitdir}/%{name}@.service
%{__install} -m 0644 %{SOURCE33} ${RPM_BUILD_ROOT}%{confdir}/conf.d/ %{__install} -m 0644 %{SOURCE12} ${RPM_BUILD_ROOT}%{confdir}/conf.d/
# Substitute libnames in catalina-tasks.xml # Substitute libnames in catalina-tasks.xml
sed -i \ sed -i \
@ -314,6 +327,7 @@ popd
pushd output/build pushd output/build
%{_bindir}/build-jar-repository lib ecj 2>&1 %{_bindir}/build-jar-repository lib ecj 2>&1
%{_bindir}/build-jar-repository lib tomcat-jakartaee-migration 2>&1
popd popd
pushd ${RPM_BUILD_ROOT}%{libdir} pushd ${RPM_BUILD_ROOT}%{libdir}
@ -322,7 +336,9 @@ pushd ${RPM_BUILD_ROOT}%{libdir}
%{__ln_s} ../../java/%{name}-servlet-%{servletspec}-api.jar . %{__ln_s} ../../java/%{name}-servlet-%{servletspec}-api.jar .
%{__ln_s} ../../java/%{name}-el-%{elspec}-api.jar . %{__ln_s} ../../java/%{name}-el-%{elspec}-api.jar .
%{__ln_s} $(build-classpath ecj/ecj) jasper-jdt.jar %{__ln_s} $(build-classpath ecj/ecj) jasper-jdt.jar
%{__cp} -a ../../%{name}/bin/tomcat-juli.jar . %{__ln_s} $(build-classpath tomcat-jakartaee-migration/jakartaee-migration) jakartaee-migration.jar
cp ../../%{name}/bin/tomcat-juli.jar .
popd popd
# symlink to the FHS locations where we've installed things # symlink to the FHS locations where we've installed things
@ -389,7 +405,9 @@ popd
%mvn_file org.apache.tomcat:tomcat-websocket-api tomcat/websocket-api %mvn_file org.apache.tomcat:tomcat-websocket-api tomcat/websocket-api
%mvn_artifact res/maven/tomcat-websocket-api.pom ${RPM_BUILD_ROOT}%{libdir}/websocket-api.jar %mvn_artifact res/maven/tomcat-websocket-api.pom ${RPM_BUILD_ROOT}%{libdir}/websocket-api.jar
%mvn_artifact res/maven/tomcat-websocket.pom ${RPM_BUILD_ROOT}%{libdir}/tomcat-websocket.jar %mvn_artifact res/maven/tomcat-websocket.pom ${RPM_BUILD_ROOT}%{libdir}/tomcat-websocket.jar
%mvn_artifact res/maven/tomcat-websocket-client-api.pom ${RPM_BUILD_ROOT}%{libdir}/websocket-client-api.jar
%mvn_artifact res/maven/tomcat.pom %mvn_artifact res/maven/tomcat.pom
%mvn_install %mvn_install
%pre %pre
@ -407,18 +425,6 @@ exit 0
# install but don't activate # install but don't activate
%systemd_post %{name}.service %systemd_post %{name}.service
%post jsp-%{jspspec}-api
%{_sbindir}/update-alternatives --install %{_javadir}/jsp.jar jsp \
%{_javadir}/%{name}-jsp-%{jspspec}-api.jar 20200
%post servlet-%{servletspec}-api
%{_sbindir}/update-alternatives --install %{_javadir}/servlet.jar servlet \
%{_javadir}/%{name}-servlet-%{servletspec}-api.jar 30000
%post el-%{elspec}-api
%{_sbindir}/update-alternatives --install %{_javadir}/elspec.jar elspec \
%{_javadir}/%{name}-el-%{elspec}-api.jar 20300
%preun %preun
# clean tempdir and workdir on removal or upgrade # clean tempdir and workdir on removal or upgrade
%{__rm} -rf %{workdir}/* %{tempdir}/* %{__rm} -rf %{workdir}/* %{tempdir}/*
@ -427,24 +433,6 @@ exit 0
%postun %postun
%systemd_postun_with_restart %{name}.service %systemd_postun_with_restart %{name}.service
%postun jsp-%{jspspec}-api
if [ "$1" = "0" ]; then
%{_sbindir}/update-alternatives --remove jsp \
%{_javadir}/%{name}-jsp-%{jspspec}-api.jar
fi
%postun servlet-%{servletspec}-api
if [ "$1" = "0" ]; then
%{_sbindir}/update-alternatives --remove servlet \
%{_javadir}/%{name}-servlet-%{servletspec}-api.jar
fi
%postun el-%{elspec}-api
if [ "$1" = "0" ]; then
%{_sbindir}/update-alternatives --remove elspec \
%{_javadir}/%{name}-el-%{elspec}-api.jar
fi
%files %files
%defattr(0664,root,tomcat,0755) %defattr(0664,root,tomcat,0755)
%doc {LICENSE,NOTICE,RELEASE*} %doc {LICENSE,NOTICE,RELEASE*}
@ -477,7 +465,7 @@ fi
%attr(0775,root,tomcat) %dir %{confdir}/Catalina/localhost %attr(0775,root,tomcat) %dir %{confdir}/Catalina/localhost
%attr(0755,root,tomcat) %dir %{confdir}/conf.d %attr(0755,root,tomcat) %dir %{confdir}/conf.d
%{confdir}/conf.d/README %{confdir}/conf.d/README
%{confdir}/conf.d/java-9-start-up-parameters.conf %{confdir}/conf.d/module-start-up-parameters.conf
%config(noreplace) %{confdir}/%{name}.conf %config(noreplace) %{confdir}/%{name}.conf
%config(noreplace) %{confdir}/*.policy %config(noreplace) %{confdir}/*.policy
%config(noreplace) %{confdir}/*.properties %config(noreplace) %{confdir}/*.properties
@ -544,6 +532,9 @@ fi
%{appdir}/ROOT %{appdir}/ROOT
%changelog %changelog
* Wed Feb 05 2025 Adam Krajcik <akrajcik@redhat.com> - 1:10.1.8-1
- Resolves: RHEL-51222 Upgrade tomcat to 10.1.8
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 1:9.0.87-3 * Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 1:9.0.87-3
- Bump release for October 2024 mass rebuild: - Bump release for October 2024 mass rebuild:
Resolves: RHEL-64018 Resolves: RHEL-64018