Bug 64514 - classes missing from bootstrap.jar
Summary: classes missing from bootstrap.jar
Alias: None
Product: Tomcat 10
Classification: Unclassified
Component: Packaging (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal (vote)
Target Milestone: ------
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2020-06-11 03:18 UTC by rotty3000
Modified: 2020-06-15 18:40 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description rotty3000 2020-06-11 03:18:37 UTC
When performing a jdeps analysis on bootstrap.jar in master we can see that there are two classes missing.

> tomcat]$ jdeps -v -cp output/build/bin/tomcat-juli.jar output/build/bin/bootstrap.jar | grep "not found"
> bootstrap.jar -> not found
>    org.apache.catalina.startup.Bootstrap              -> org.apache.catalina.Globals                        not found
>    org.apache.catalina.startup.Tool                   -> org.apache.catalina.Globals                        not found
>    org.apache.catalina.startup.Tool                   -> org.apache.tomcat.util.ExceptionUtils              not found

The effective result of this is that when calculating either the OSGi or JPMS metadata these packages want to be imported. Since several other classes are cherry-picked into the jar it stands to reason that the assembly should be logically complete as to never encounter any hard to diagnose errors.
Comment 1 rotty3000 2020-06-11 04:27:55 UTC
Comment 2 rotty3000 2020-06-13 21:20:59 UTC
This issue was discussed on list and determined that if the missing parts being small and benign enough to copy into bootstrap, that might be the best solution as proposed by @markt:

> If we created o.a.c.startup.Constants, defined the constants required by
> the bootstrap classes there and then referenced those from o.a.c.Globals
> would that help?

It did!

> Is it Tool's use of ExceptionUtils that is causing that class to be
> needed? If so would making Bootstrap.handleThrowable() package private
> and using that instead help?

It does!

I've tested these changed and they solve the packaging issue for both OSGi and JPMS.

PR update coming.
Comment 3 rotty3000 2020-06-13 21:23:54 UTC
The outcome is essentially that both in usage and now in terms of real java dependencies, bootstrap has no dependencies outside of java.base and tomcat-juli.jar
Comment 4 Mark Thomas 2020-06-15 18:40:16 UTC
Thanks for the PRs.

Fixed in:
- master for 10.0.0-M7 onwards
- 9.0.x for 9.0.37 onwards
- 8.5.x for 8.5.57 onwards

Note that I back-ported this to 8.5.x even though 8.5.x doesn't use bnd to keep the code in sync for easier back-ports of future fixes.