Skip to content

WARNINGs when executing analysis with Java 21 #7759

Closed

Description

@andham

Precondition

  • I checked the issues list for existing open or closed reports of the same problem.

Describe the bug
When executing dep-check with OpenJDK 21 to perform analysis WARNING messages are output:ed. The analysis succeeds though.

Version of dependency-check used
The problem occurs using version 12.1.3 of the cli with Java 21 (OpenJDK).

Log file
(https://gist.github.com/andham/bc79e1f8ee3435bbf19ec00cb9d6a8c6)

To Reproduce
Steps to reproduce the behavior:

  1. Install Java 21
  2. Pre-update dep-check
  3. Execute analysis: dependency-check.sh --noupdate --disableCentral --disableNodeAudit --disableYarnAudit --disableOssIndex --disableAssembly --scan ./target/xxx.ear

Expected behavior
Analysis without WARNINGs.

Additional context
Java 21 is currently the latest LTS version. In a few months Java 25 (LTS) is released. LTS versions should work without issues.

Activity

  1. fabianfrz commented on Jul 7, 2025

    @fabianfrz

    I can confirm this with the maven version as well.

    Java version:

    openjdk 21.0.7 2025-04-15
    OpenJDK Runtime Environment (build 21.0.7+6)
    OpenJDK 64-Bit Server VM (build 21.0.7+6, mixed mode, sharing)
    

    Log:

    [INFO] Finished Jar Analyzer (0 seconds)
    [INFO] Finished Dependency Merging Analyzer (0 seconds)
    [INFO] Finished Hint Analyzer (0 seconds)
    [INFO] Finished Version Filter Analyzer (0 seconds)
    WARNING: A restricted method in java.lang.foreign.Linker has been called
    WARNING: java.lang.foreign.Linker::downcallHandle has been called by the unnamed module
    WARNING: Use --enable-native-access=ALL-UNNAMED to avoid a warning for this module
    
    Jul 07, 2025 9:20:23 AM org.apache.lucene.store.MemorySegmentIndexInputProvider <init>
    INFO: Using MemorySegmentIndexInput and native madvise support with Java 21 or later; to disable start with -Dorg.apache.lucene.store.MMapDirectory.enableMemorySegments=false
    Jul 07, 2025 9:20:23 AM org.apache.lucene.internal.vectorization.VectorizationProvider lookup
    WARNING: Java vector incubator module is not readable. For optimal vector performance, pass '--add-modules jdk.incubator.vector' to enable Vector API.
    [INFO] Created CPE Index (1 seconds)
    [INFO] Finished CPE Analyzer (4 seconds)
    [INFO] Finished False Positive Analyzer (0 seconds)
    [INFO] Finished NVD CVE Analyzer (0 seconds)
    [INFO] Finished RetireJS Analyzer (0 seconds)
    [INFO] Finished Vulnerability Suppression Analyzer (0 seconds)
    [INFO] Finished Known Exploited Vulnerability Analyzer (0 seconds)
    [INFO] Finished Dependency Bundling Analyzer (0 seconds)
    

    Maven version

    Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d260186937)
    Maven home: /usr/share/java/maven
    Java version: 21.0.7, vendor: Arch Linux, runtime: /usr/lib/jvm/java-21-openjdk
    Default locale: en_US, platform encoding: UTF-8
    OS name: "linux", version: "6.15.3-1-manjaro", arch: "amd64", family: "unix"
    
  2. chadlwilson commented on Sep 26, 2025

    @chadlwilson
    Collaborator

    The warnings will be different depending on whether you are using the Docker image, and which JVM vendor and version you're using.

    I've cleaned up CLI warnings somewhat within #7979 however the JVM warnings will require a few more decisions.

    They come from Apache Lucene, and the default use of MemorySegments on Java 21+ which triggers the warnings.

    Options

    • Disable them with -Dorg.apache.lucene.store.MMapDirectory.enableMemorySegments=false (goes back to ByteBuffers)
    • Accept that this is intentional and add --enable-native-access=ALL-UNNAMED to start-up JVM args
      • No good solution for Maven/Gradle with this, however.
    • Modularise all of ODC :-)
  3. self-assigned this
    on Sep 26, 2025
  4. chadlwilson commented on Sep 26, 2025

    @chadlwilson
    Collaborator

    IMHO, it's probably best to just add --enable-native-access=ALL-UNNAMED to the CLI args, but in the generic CLI (BYO JVM, non-Docker) it's a bit messy as this option was only added in Java 19+.

  5. removed their assignment
    on Sep 26, 2025
  6. added this to the 12.1.7 milestone on Oct 6, 2025
  7. locked as resolved and limited conversation to collaborators on Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions