Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 925083 - www-servers/tomcat:10.1 fails to start correcly with dev-java/ant-1.10.14-r1 (java.lang.SecurityException: Invalid signature file digest for Manifest main attributes)
Summary: www-servers/tomcat:10.1 fails to start correcly with dev-java/ant-1.10.14-r1 ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Java team
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2024-02-20 11:40 UTC by Miroslav Šulc
Modified: 2024-02-26 12:53 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
catalina.log (catalina.2024-02-20.log,19.07 KB, text/plain)
2024-02-20 11:40 UTC, Miroslav Šulc
Details
catalina.2024-02-25.log from tomcat built with ant-1.10.14-r2 (catalina.2024-02-25.log,6.06 KB, text/plain)
2024-02-25 16:32 UTC, Volkmar W. Pogatzki
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Miroslav Šulc gentoo-dev 2024-02-20 11:40:18 UTC
Created attachment 885516 [details]
catalina.log

i just tried to bump this version. it compiles and installs fine, but it does not run the bundled apps. tomcat versions in older slots still work fine. it seems there is some manifest signing issue.
Comment 1 Miroslav Šulc gentoo-dev 2024-02-20 11:48:49 UTC
i just recompiled tomcat 10.1.18-r1 (which runs fine on my servers) on the same machine and it behaves the same, so it might be issue with ant rather than with tomcat itself.

# equery list ant
 * Searching for ant ...
[IP-] [  ] dev-java/ant-1.10.14-r1:0

i will do more tests...
Comment 2 Miroslav Šulc gentoo-dev 2024-02-20 11:53:12 UTC
i just tested that on a machine where i still have ant-core installed ant tomcat 10.1.19 runs there without issues.

                                                                                                                                                                                                                                                                                                                      [ ok ]
server /var/db/repos/gentoo/www-servers/tomcat # equery list ant-core
 * Searching for ant-core ...
[IP-] [  ] dev-java/ant-core-1.10.9-r5:0


so i'll bump tomcat but we can't stabilize new ant before we resolve this issue.
Comment 3 Volkmar W. Pogatzki 2024-02-20 13:04:27 UTC
(In reply to Miroslav Šulc from comment #2)
> {...]
> so i'll bump tomcat but we can't stabilize new ant before we resolve this
> issue.

so let's block it.
Comment 4 Volkmar W. Pogatzki 2024-02-20 13:22:09 UTC
Does it need ant-launcher?
There was another regression in https://bugs.gentoo.org/923972.
Comment 5 Volkmar W. Pogatzki 2024-02-24 20:05:37 UTC
(In reply to Miroslav Šulc from comment #0)
> Created attachment 885516 [details]
> catalina.log
> 
> i just tried to bump this version. it compiles and installs fine, but it
> does not run the bundled apps. tomcat versions in older slots still work
> fine. it seems there is some manifest signing issue.

could you please list the exact steps to do after emerge
needed to reproduce "catalina.log"

those wiki articles mentioned in pkg_postinst's einfo look both very outdated
Comment 6 Volkmar W. Pogatzki 2024-02-25 08:19:03 UTC
The summary "[...] does not sign jars correcly with [...]" implies jar files installed by tomcat should be signed.
But even if compiled with ant-core-1.10.9-r5 all these jar files seem unsigned.

Can be checked with:
for i in $(qlist tomcat | grep \.jar); do jarsigner -verify $1; done

There was a similar error when packaging eclipse-ecj:30 which could be solved by removing .RSA and .SF entries.
Comment 7 Miroslav Šulc gentoo-dev 2024-02-25 12:07:58 UTC
(In reply to Volkmar W. Pogatzki from comment #5)
> (In reply to Miroslav Šulc from comment #0)
> > Created attachment 885516 [details]
> > catalina.log
> > 
> > i just tried to bump this version. it compiles and installs fine, but it
> > does not run the bundled apps. tomcat versions in older slots still work
> > fine. it seems there is some manifest signing issue.
> 
> could you please list the exact steps to do after emerge
> needed to reproduce "catalina.log"
> 
> those wiki articles mentioned in pkg_postinst's einfo look both very outdated

i just installed tomcat:10.1. i already have the instance created using
/usr/share/tomcat-10.1/gentoo/tomcat-instance-manager.bash --create
not sure if i changed any settings in the configuration files but i think i did not. so then the last step is to start tomcat
/etc/init.d/tomcat-10.1 start
and then check at localhost:8080 whether tomcat displays the homepage or an error. if the error occurs, the cause can be checked in the log files in /var/log/tomcat-10.1/.
Comment 8 Miroslav Šulc gentoo-dev 2024-02-25 12:11:03 UTC
(In reply to Volkmar W. Pogatzki from comment #6)
> The summary "[...] does not sign jars correcly with [...]" implies jar files
> installed by tomcat should be signed.
> But even if compiled with ant-core-1.10.9-r5 all these jar files seem
> unsigned.
> 
> Can be checked with:
> for i in $(qlist tomcat | grep \.jar); do jarsigner -verify $1; done
> 
> There was a similar error when packaging eclipse-ecj:30 which could be
> solved by removing .RSA and .SF entries.

i did not check deeply the issue, the topic is based on the message "Caused by: java.lang.SecurityException: Invalid signature file digest for Manifest main attributes", so the description might be inaccurate. what remains is that with ant-core i don't have the mentioned issue but with the new ant the issue popped up for me.
Comment 9 Volkmar W. Pogatzki 2024-02-25 16:32:12 UTC
Created attachment 885974 [details]
catalina.2024-02-25.log from tomcat built with ant-1.10.14-r2

Don't know if I should feel happy about, but here it starts as expected and localhost:8080 says:


Apache Tomcat/10.1.19-gentoo
If you're seeing this, you've successfully installed Tomcat. Congratulations!
Comment 10 Miroslav Šulc gentoo-dev 2024-02-25 17:54:09 UTC
(In reply to Volkmar W. Pogatzki from comment #9)
> Created attachment 885974 [details]
> catalina.2024-02-25.log from tomcat built with ant-1.10.14-r2
> 
> Don't know if I should feel happy about, but here it starts as expected and
> localhost:8080 says:
> 
> 
> Apache Tomcat/10.1.19-gentoo
> If you're seeing this, you've successfully installed Tomcat. Congratulations!

i re-emerged ant, tomcat, deleted the tomcat instance and created a new one, but still the same issue. i find it kinda strange that it's only me encountering this issue, no cc so far on this bug. i might as well have something broken here.

so, if it works for you, i guess we can drop the blocker for ant stabilization. if the issue pops up for other users, we would need to handle it.
Comment 11 Volkmar W. Pogatzki 2024-02-25 18:02:43 UTC
(In reply to Miroslav Šulc from comment #10)
> 
> so, if it works for you, i guess we can drop the blocker for ant
> stabilization. if the issue pops up for other users, we would need to handle
> it.

it does, works for me. removing the blocker.
Comment 12 Miroslav Šulc gentoo-dev 2024-02-26 10:08:53 UTC
on my test server tomcat works fine even after ant upgrade, but on my production server just updating to the new ant and restarting tomcat:10.1 caused tomcat not working, so i had to downgrade ant back to the ant-core. after the downgrade, it works fine again.

it seems it fails on a manifest digest ending with -DIGEST-Manifest-Main-Attributes but i did not find such a record, but maybe i didn't search everything.
Comment 13 Miroslav Šulc gentoo-dev 2024-02-26 10:13:32 UTC
i also tried setting JAVA_OPTS="-Djava.security.debug=jar" in /etc/conf.d/tomcat-10.1, which should enable displaying debug output for this issue (java code logs to System.err), but i did not find whether and where it stores the log.
Comment 14 Volkmar W. Pogatzki 2024-02-26 10:31:17 UTC
(In reply to Miroslav Šulc from comment #12)
> on my test server tomcat works fine even after ant upgrade, but on my
> production server just updating to the new ant and restarting tomcat:10.1
> caused tomcat not working, so i had to downgrade ant back to the ant-core.
> after the downgrade, it works fine again.
> [...]

for me this sounds like there is something in the existing instance of your production server causing that trouble (if tomcat was built with new ant).
does the existing instance include signed jar files?
Comment 15 Miroslav Šulc gentoo-dev 2024-02-26 10:48:04 UTC
well, i just debugged tomcat on my laptop to find out on what exactly it is failing, and the conclusion is that the verification of /usr/share/eclipse-ecj-4.26/lib/ecj.jar fails because of those META-INF/ECLIPSE_.{SF|RSA} files. removing them from ecj.jar resolves the issue. so the content of those files seems not to be valid and we should drop them to resolve the issue, as you already wrote.
Comment 16 Miroslav Šulc gentoo-dev 2024-02-26 10:53:19 UTC
i just verified it on my production server.

zip -d /usr/share/eclipse-ecj-4.26/lib/ecj.jar META-INF/ECLIPSE_.RSA META-INF/ECLIPSE_.SF
update world to get the latest ant
/etc/init.d/tomcat-10.1 restart

and tomcat runs without issues.
Comment 17 Larry the Git Cow gentoo-dev 2024-02-26 12:53:19 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1c22228aa61ca1ffdf3f5306e886d09e98e54798

commit 1c22228aa61ca1ffdf3f5306e886d09e98e54798
Author:     Volkmar W. Pogatzki <gentoo@pogatzki.net>
AuthorDate: 2024-02-26 11:27:40 +0000
Commit:     Miroslav Šulc <fordfrog@gentoo.org>
CommitDate: 2024-02-26 12:52:27 +0000

    dev-java/eclipse-ecj: remove .RSA and .SF files from META-INF
    
    Closes: https://bugs.gentoo.org/925083
    Signed-off-by: Volkmar W. Pogatzki <gentoo@pogatzki.net>
    Closes: https://github.com/gentoo/gentoo/pull/35538
    Signed-off-by: Miroslav Šulc <fordfrog@gentoo.org>

 .../{eclipse-ecj-4.26-r1.ebuild => eclipse-ecj-4.26-r2.ebuild}    | 8 ++++++++
 1 file changed, 8 insertions(+)