Uploaded image for project: 'OpenJDK'
  1. OpenJDK
  2. OPENJDK-2009

JAVA_OPTS not working on ubi8/openjdk-17

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done-Errata
    • Icon: Major Major
    • UBI8 Containers 1.17.GA
    • UBI8 Containers 1.16.GA
    • container
    • None
    • False
    • Hide

      None

      Show
      None
    • False

      The idea of JAVA_OPTS is to use it for our images to define your own tuning. However, this only seems to work for ubi9 images, not for ubi8:

      $ podman run --rm -ti -e JAVA_OPTS="" registry.access.redhat.com/ubi8/openjdk-17 2>&1 | grep -C3 ERROR
      Starting the Java application using /opt/jboss/container/java/run/run-java.sh ...
      ERROR Neither $JAVA_MAIN_CLASS nor $JAVA_APP_JAR is set and 0 JARs found in /deployments (1 expected)
      INFO exec -a "java" java -XX:MaxRAMPercentage=50.0 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -XX:+ExitOnOutOfMemoryError -cp "." -jar  
      Error: -jar requires jar file specification
      Usage: java [options] <mainclass> [args...]
      

      Note the lines with -XX:MaxRAMPercentage=50.0 etc, which shouldn't be there.

      Contrast this with an ubi9 image run:

      $ podman run --rm -ti -e JAVA_OPTS="" registry.access.redhat.com/ubi9/openjdk-17 2>&1 | grep -C3 ERROR
      Starting the Java application using /opt/jboss/container/java/run/run-java.sh ...
      ERROR Neither $JAVA_MAIN_CLASS nor $JAVA_APP_JAR is set and 0 JARs found in /deployments (1 expected)
      INFO exec  java  -cp "." -jar  
      Error: -jar requires jar file specification
      Usage: java [options] <mainclass> [args...]
      

      *Expected Behaviour*

      As with ubi9 image, don't add auto-tunings if JAVA_OPTS is empty (or has some value; if it has a value only that JVM flag should be present).

              jdowland@redhat.com Jonathan Dowland
              sgehwolf@redhat.com Severin Gehwolf
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: