Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"javap" use throws error in containers #3982

Open
1000TurquoisePogs opened this issue Feb 7, 2025 · 1 comment
Open

"javap" use throws error in containers #3982

1000TurquoisePogs opened this issue Feb 7, 2025 · 1 comment
Labels
bug Verified defect in functionality extender this issue has been raised by an extender Priority: Medium

Comments

@1000TurquoisePogs
Copy link
Member

1000TurquoisePogs commented Feb 7, 2025

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.

@balhar-jakub balhar-jakub added bug Verified defect in functionality extender this issue has been raised by an extender new New issue that has not been worked on yet labels Feb 11, 2025
@EvaJavornicka EvaJavornicka added Priority: Medium and removed new New issue that has not been worked on yet labels Feb 12, 2025
@pablocarle
Copy link
Contributor

Hi @1000TurquoisePogs,
This code is there to support running Zowe v2 with both Java 8 and Java 17 runtimes.
I think in containers we want to keep the possibility of running Zowe v2 with either of these versions.

Maybe the solution is to find an alternative way of determining the Java version that doesn't depend on javap, but I'm assuming it may be because in the containers there's only a JRE and not the JDK binaries?

@EvaJavornicka EvaJavornicka moved this from Icebox to Unplanned Bugs in API Mediation Layer Backlog Management Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified defect in functionality extender this issue has been raised by an extender Priority: Medium
Projects
Status: Unplanned Bugs
Development

No branches or pull requests

4 participants