You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are trying to migrate small SAM application from Dockerfile-java17 to Dockerfile-java21. But on java21 our Jenkins job fails while trying to do "mvn clean install" with the error message "The JAVA_HOME environment variable is not defined correctly,
this environment variable is needed to run this program." We don't have such issues on java17.
In short: could you please check that "/var/lang/bin/java" is runnable in Dockerfile-java21 image? As it is in Dockerfile-java17.
According to my investigations %JAVA_HOME is correctly set to "/var/lang". I suppose that here is the code from maven, given us that error:
if [ -z "$JAVA_HOME" ] ; then
JAVACMD=`which java`
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
echo "The JAVA_HOME environment variable is not defined correctly," >&2
echo "this environment variable is needed to run this program." >&2
exit 1
fi
Indeed when I run "test '!' -x /var/lang/bin/java" in Dockerfile-java21 it gives me true, while in Dockerfile-java17 it returns false. So, could you please check that "/var/lang/bin/java" is runnable in Dockerfile-java21 image, as it is in Dockerfile-java17?
Sorry for not providing all the steps-to-reproduce, environment and the rest. I hope that if you confirm that "/var/lang/bin/java" is not runnable in java21 and change it to be so, than the problem will be solved. If it's not the root cause, then I will try to provide you all the details.
The text was updated successfully, but these errors were encountered:
I did a quick test to see if mvn clean install would work for an application and I was able to get it run. Here are the steps;
Run build image and drop to its shell docker run -it public.ecr.aws/sam/build-java21 /bin/bash
Instantiate a SAM application with Java21. By running sam init and selecting 1 -> 1 -> N -> 7 -> 1 -> 2 -> (enter) -> (enter) -> (enter) -> (enter)
Go into the function source code by running cd sam-app/HelloWorldFunction/
Run mvn clean install in that folder
With this experiment I was able to run the Maven commands above. Can you try with this image to see if it is going to work for your case?
Thanks!
mndeveci
added
blocked/more-info-needed
More info is needed from the requester. If no response in 14 days, it will become stale.
and removed
stage/needs-triage
Automatically applied to new issues and PRs, indicating they haven't been looked at.
labels
Nov 12, 2024
That seems to work locally on my machines with MacOs and Docker 20.10.6 and later. But not on our Jenkins "Amazon Linux AI 2018.03" and Docker 18.09.9-ce, build 039a7df. So we switched to a Jenkins machine with a newer OS and Docker and now it works. Thanks for help!
Description:
We are trying to migrate small SAM application from Dockerfile-java17 to Dockerfile-java21. But on java21 our Jenkins job fails while trying to do "mvn clean install" with the error message "The JAVA_HOME environment variable is not defined correctly,
this environment variable is needed to run this program." We don't have such issues on java17.
In short: could you please check that "/var/lang/bin/java" is runnable in Dockerfile-java21 image? As it is in Dockerfile-java17.
According to my investigations %JAVA_HOME is correctly set to "/var/lang". I suppose that here is the code from maven, given us that error:
Indeed when I run "test '!' -x /var/lang/bin/java" in Dockerfile-java21 it gives me true, while in Dockerfile-java17 it returns false. So, could you please check that "/var/lang/bin/java" is runnable in Dockerfile-java21 image, as it is in Dockerfile-java17?
Sorry for not providing all the steps-to-reproduce, environment and the rest. I hope that if you confirm that "/var/lang/bin/java" is not runnable in java21 and change it to be so, than the problem will be solved. If it's not the root cause, then I will try to provide you all the details.
The text was updated successfully, but these errors were encountered: