Skip to content

Checking if APR is available logs a warning on Java 24 #44033

Closed
@wilkinsona

Description

@wilkinsona
WARNING: A restricted method in java.lang.System has been called
WARNING: java.lang.System::load has been called by org.apache.tomcat.jni.Library in an unnamed module (file:/Users/aw036093/.gradle/caches/modules-2/files-2.1/org.apache.tomcat.embed/tomcat-embed-core/10.1.34/f610f84be607fbc82e393cc220f0ad45f92afc91/tomcat-embed-core-10.1.34.jar)
WARNING: Use --enable-native-access=ALL-UNNAMED to avoid a warning for callers in this module
WARNING: Restricted methods will be blocked in a future release unless native access is enabled

The above is triggered within org.apache.catalina.core.AprLifecycleListener.isAprAvailable(). It occurs whether or not APR is available. We should do something about this as part of adding support for Java 24. We could:

  1. Make adding the APR lifecycle listener opt-in
  2. Make adding the APR lifecycle listener opt-in on Java 24
  3. Try to detect --enable-native-access and only add the listener when it's set

1 would be a breaking change for those who're already using APR. 2 wouldn't break any existing deployments as a Java 24 upgrade would be required to see a change in behavior. 3 might not be possible and, even if we can detect the flag, knowing that the module name's correct might not be possible. 2's perhaps the least bad option. If we did that for 3.4.x we could then perhaps make it opt-in for everyone in 3.5.

I'd like to see what the rest of the team thinks.

Metadata

Metadata

Assignees

Labels

status: noteworthyA noteworthy issue to call out in the release notestype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions