On Thu, Feb 20, 2025 at 2:42 PM Mark Thomas <ma...@apache.org> wrote:
>
> On 20/02/2025 13:36, Rémy Maucherat wrote:
> > On Thu, Feb 20, 2025 at 1:06 PM Mark Thomas <ma...@apache.org> wrote:
> >>
> >> All,
> >>
> >> The recent releases have improved things for users of embedded Tomcat
> >> but there are still some issues. I am seeing reports via $work related
> >> to Spring Boot.
> >>
> >> The problem is on Windows and Mac. The file systems are case insensitive
> >> and DirResourceSet instances are read/write by default so the reflection
> >> code gets called. The impact varies by Java version:
> >>
> >> Java 21 - no issue as the code doesn't get called
> >>
> >> Java 17 - exception is thrown and the web application fails to start due
> >>             to missing --add-opens
> >
> > Where does the exception come from this time ?
>
> JreCompat.disableCanonCaches()

So in that case useCanonCachesField is not null, but using it fails ?
That's unexpected.
OTOH, some users were randomly saying that things were ok on Java 17,
and others not. So there's something.

Rémy

> Mark
>
>
> >
> > Rémy
> >
> >> Java 11 - warning is logged but otherwise web application starts
> >>             normally
> >>
> >> Java 8  - web application starts normally
> >>
> >>
> >> Having chatted at length with the Spring Boot team, they are going to
> >> make the DirResourceSet instances read only by default which works
> >> around the Java 17 issue but not the Java 11 issue as reflection also
> >> occurs in the init of JreCompat.
> >>
> >> I have performed some testing and confirmed that the java.io.FileSystem
> >> class is loaded by the JRE before any application code gets a chance to
> >> execute. That means we can use checking the command line arguments to
> >> determine whether the cache is enabled/disabled.
> >>
> >> To reduce the impact on anyone using Tomcat in embedded mode - including
> >> but not limited to Spring Boot - I intend to make the following
> >> improvements:
> >>
> >> Java 17
> >> Check the command line arguments to determine if the canonical resource
> >> name cache has been enabled
> >> Switch to lazy initialisation for JreCompat.useCanonCachesField so
> >> reflection is not used unless Tomcat needs to try and disable the cache
> >>
> >> Java 16 and below
> >> Check the command line arguments to determine if the canonical resource
> >> name cache has been disabled
> >> Switch to lazy initialisation for JreCompat.useCanonCachesField so
> >> reflection is not used unless Tomcat needs to try and disable the cache
> >>
> >>
> >> I don't think there is a need to rush out these changes but I'm going to
> >> start work on them now so they are ready if we need them in a hurry.
> >>
> >> Mark
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> >> For additional commands, e-mail: dev-h...@tomcat.apache.org
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> > For additional commands, e-mail: dev-h...@tomcat.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to