building jdk17 over alpine 3.20.0 getting error java.langpackage not found
Package Information
- Package name: alpine
- Package version: 3.20
- Alpine version: Alpine version from
/etc/alpine-release
--> getting permission denied - Alpine architecture: Architecture obtained via
apk --print-arch
--> x86_64
Summary
I am running a project on alpine 3.2.0 where I am installing openjdk17 on it.
I build and run the docker container, I exec into the shell and run jshell
to validate - I get an error-
error listing module locations for SYSTEM_MODULES: java.io.IOEXCPETION: Cant find system classes
FATAL error: Unable to find package java.lang.InternalError: Unable to find package java.lang in classpath or bootclasspath
Docker version is -
bash-4.2$ docker --version
Docker version 17.06.2-ce, build cec0b72
bash-4.2$
Steps to reproduce
Il add my dockerfile here
FROM alpine:3.20.0
RUN apk update
RUN apk add openjdk17
WORKDIR /app
RUN apk update && apk upgrade --no-cache
EXPOSE 8080
RUN ls -l /app
RUN javac -version
RUN java -version
RUN whoami
CMD ["sh"]
Steps to reproduce the issue
- On docker version 17.06.x`
- Build above docker file
docker build -t test .
- Run the image
docker run -it test /bin/sh
- Inside docker container - run
jshell
you will see the below issue.
/app # apk --print-arch
86_64
/app # jshell
error listing module locations for SYSTEM MODULES: java.io.IOException: can't find system classes
Fatal Error: Unable to find package java.lang in classpath or bootclasspath
Ecxception in thread "main” java.lang.InternalError: Exception during analyze - com.sun.tools.javac.util.FatalError: Fatal Error: Unable to find package java.lang in classpath or bootclasspath
at jdk.jshell/jdk.jshell.TaskFactory$hnalyzeTask.analyze (TaskFactory.java:393)
at jdk.jshell/jdk.jshell.TaskFactory$hnalyzeTask.<init>(TaskFactory.java:384)
at jdk.jshell/jdk.jshell.TaskFactory.lambdaSanalyze$l(TaskFactory.java:177)
at jdk.jshell/jdk.jshell.TaskFactory.lambda$runTask$4 (TaskFactory.java:212)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskPool.getTask (JavacTaskPool.java:
at jdk.jshell/jdk.jshell.TaskFactory.runTask (TaskFactory.java:205)
at jdk.jshell/jdk.jshell.TaskFactory.analyze (TaskFactory.java:174)
at jdk.jshell/jdk.jshell.TaskFactory.analyze (TaskFactory.java:160)
at jdk.jshell/jdk.jshell.Eval.compileAndLoad (Eval.java:1010)
at jdk.jshell/jdk.jshell.Eval.declare (Eval.java:890)
at jdk.jshell/jdk.jshell.Eval.eval(Eval.java:137)
at jdk.jshell/jdk.jshell.Jshell.eval (JShell.java:493)
at jdk.jshell/jdk.internal.jshell.tool.JShellTool.processSource (JShellTool.java:3618)
at jdk.jshell/jdk.internal.jshell.tool.JShellTool.processSourceCatchingReset (JShellTool.java:1342)
at jdk.jshell/jdk.internal.jshell.tool.JshellTool.processInput (JShellTool.java:1240)
at jdk.jshell/jdk.internal.jshell.tool.JShellTool.run(JShellTool.java:1211)
at jdk.jshell/jdk.internal.jshell.tool.JShellTool.startUpRun (JShellTool.java:1172)
at jdk.jshell/3jdk.internal.jshell.tool.JShellTool.resetState (JShellTool.java:1119)
========= The same thing when tried on another machine with docker version =========
C:\Users\ritika.jain\Documents\imageCode> docker --version
Docker version 23.0.5, build bc4487a
Edited by Ritika Jain