Skip to content

"javap" use throws error in containers #3982

Open
@1000TurquoisePogs

Description

Each server startup uses this code to detect if they should do things unique to java 8 vs java 11+ on z/OS:

JAVA_VERSION=$(${JAVA_HOME}/bin/javap -verbose java.lang.String \
    | grep "major version" \
    | cut -d " " -f5)
ADD_OPENS=""
if [ $JAVA_VERSION -ge 61 ]; then
    ADD_OPENS="--add-opens=java.base/java.lang=ALL-UNNAMED
                --add-opens=java.base/java.lang.invoke=ALL-UNNAMED
...
fi

This doesn't work for containers.
Containers print javap not found or similar.
It seems harmless now but to avoid it becoming an issue later I would recommend changing the code slightly:

if [ "${ZWE_RUN_ON_ZOS}" = "true" ]; then
  JAVA_VERSION=$(${JAVA_HOME}/bin/javap -verbose java.lang.String \
      | grep "major version" \
      | cut -d " " -f5)
  ADD_OPENS=""
  if [ $JAVA_VERSION -ge 61 ]; then
      ADD_OPENS="--add-opens=java.base/java.lang=ALL-UNNAMED
                  --add-opens=java.base/java.lang.invoke=ALL-UNNAMED
  ...
  fi
fi

That is, ZWE_RUN_ON_ZOS is a variable that can be used to detect whether to do a z/OS-specific action.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Priority: MediumbugVerified defect in functionalityextenderthis issue has been raised by an extender

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions