tomcat9 conflicts with tomcat10
It seems Tomcat 10 packages cannot be installed side-by-side with Tomcat 9 packages, even though they have separate config locations, file locations, etc.
dnfis unhappy with Tomcat 9 being installed already:$ sudo dnf install tomcat10 Amazon Linux 2023 Kernel Livepatch repository 8.1 kB/s | 2.9 kB 00:00 Error: Problem: problem with installed package tomcat9-1:9.0.91-1.amzn2023.0.1.noarch - package tomcat10-1:10.1.29-1.amzn2023.0.1.noarch from amazonlinux conflicts with tomcat9 provided by tomcat9-1:9.0.91-1.amzn2023.0.1.noarch from @System ...snip... - conflicting requests (try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages)This makes migration awkward.
@ozbenh Any plans to address this?
Looking at the package source, it looks like
Conflictsstatements were added to the RPM specification file, when in reality, it does not conflict. It would be nice to remove these from the package.
Originally posted by @rturner-edjuster in #546
Some guidance on how to upgrade would be very helpful if this can't be resolved. e.g. Does tomcat9 need to be completely uninstalled first or does the --allowerasing option work?
Of course, this should ideally allow 9 & 10 to co-exist as in the original post.
@Edwardiv1 if you want to upgrade use dnf swap tomcat9 tomcat10:
[ec2-user@ip-1-2-3-4 ~]$ sudo dnf swap tomcat9 tomcat10
Last metadata expiration check: 0:02:33 ago on Tue Apr 22 14:33:39 2025.
Dependencies resolved.
========================================================================================================================
Package Architecture Version Repository Size
========================================================================================================================
Installing:
tomcat10 noarch 1:10.1.39-1.amzn2023.0.1 amazonlinux 92 k
Installing dependencies:
tomcat10-el-5.0-api noarch 1:10.1.39-1.amzn2023.0.1 amazonlinux 107 k
tomcat10-jsp-3.1-api noarch 1:10.1.39-1.amzn2023.0.1 amazonlinux 75 k
tomcat10-lib noarch 1:10.1.39-1.amzn2023.0.1 amazonlinux 7.0 M
tomcat10-servlet-6.0-api noarch 1:10.1.39-1.amzn2023.0.1 amazonlinux 359 k
Removing:
tomcat9 noarch 1:9.0.102-1.amzn2023.0.1 @amazonlinux 323 k
Removing unused dependencies:
tomcat9-el-3.0-api noarch 1:9.0.102-1.amzn2023.0.1 @amazonlinux 228 k
tomcat9-jsp-2.3-api noarch 1:9.0.102-1.amzn2023.0.1 @amazonlinux 144 k
tomcat9-lib noarch 1:9.0.102-1.amzn2023.0.1 @amazonlinux 10 M
tomcat9-servlet-4.0-api noarch 1:9.0.102-1.amzn2023.0.1 @amazonlinux 611 k
Transaction Summary
========================================================================================================================
Install 5 Packages
Remove 5 Packages
Total download size: 7.6 M
Is this ok [y/N]:
If you inspect tomcat10.spec there is Conflicts: tomcat9 directive, so having tomcat9 and tomcat10 side-by-side will not work if the package manager is used. Try installing both from source.
@zcobol Thanks for the tip! Do you know if it deletes the configuration files in tomcat9/conf/Catalina/ and any custom directories/files under tomcat9 as it removes it? Or is it smart enough to only delete the files it originally installed and leave other customizations there? I'm just planning what to do in case something goes wrong with the update and I need to revert back to tomcat9.
@Edwardiv1 , could you please share with us what a possible usage might look like if you could install both Tomcat's on the same system? Would you use both versions in parallel or it is ok to have only one active with the ability to switch between any installed versions?
Our specific use case is to run both side-by-side on different ports, with NGINX in front of both instances, and mapping some paths to each server. We run a number of old and new versions of our application on a single test server to reduce overhead for very low use systems. To support this currently, I rebuild the Tomcat 10 RPM, removing the "Conflicts" directives from the RPM packaging. Other than that, and the default listening ports (which the user would manually need to change before starting both instances together), there is nothing else that I recall that conflicts out-of-the-box as each Tomcat version is currently deployed with all files throughout the platform in unique folders for the version.
These are my notes on how I rebuild the Tomcat 10 RPM each time I need to upgrade (requires stopping existing instance to rebuild) :
yumdownloader --source tomcat10
mkdir tomcat10-10.1.34-1.amzn2023.0.1.src
cd tomcat10-10.1.34-1.amzn2023.0.1.src
rpm2cpio ../tomcat10-10.1.34-1.amzn2023.0.1.src.rpm | cpio -idmv
vim tomcat.spec # comment out or remove Conflicts: lines
mv tomcat10-10.1.34-1.amzn2023.0.1.src/* rpmbuild/SOURCES/
mv rpmbuild/SOURCES/tomcat.spec rpmbuild/SPECS/
# Need to "move aside" /var/cache/tomcat10 to build RPMs:
sudo mv /var/cache/tomcat10 /var/cache/tomcat10-working
rpmbuild -bb rpmbuild/SPECS/tomcat.spec
# Put back the folder we moved aside:
sudo mv /var/cache/tomcat10-working /var/cache/tomcat10
# Install packages:
cd rpmbuild/RPMS/noarch/
sudo dnf install tomcat10*10.1.34*
cd ../../../
@alexey-tsvetnov In my case, the use-case was to simply test the upgrade from 9 -> 10 without disturbing the 9 configuration. They didn't need to run in parallel, just keep v9 there in case v10 failed (which it did). There are some big, breaking changes between 9 -> 10 (mainly around the javax -> jakarta namespace change), so this was perhaps an unusual scenario.
We ended up completing the upgrade now, so this is no longer an issue for me personally, but we had to do the dnf swap a few times to go back and forth while we resolved the code changes that were needed to run successfully under v10.