-
Notifications
You must be signed in to change notification settings - Fork 917
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
Error opening zip file or JAR manifest missing : /app/opentelemetry-javaagent.jar #13127
Comments
Do you have some requirement to run such an old version of the agent (1.28.0), when the latest is 2.12? Also, why are you including the elastic apm agent in your container? I copied the code you used to embed the javaagent into an image and I am not able to reproduce your issue, everything works fine as far as I can tell. Can you run your container, exec into it, and look to make sure the OTel javaagent file is where you expect it to be? |
Verify that |
@jaydeluca @laurit HEY Stage 1: Dependency identification (18-alpine)FROM amazoncorretto:18-alpine as deps Identify dependenciesCOPY ./app/build/libs/app--SNAPSHOT.jar /app/app.jar Stage 2: Build JRE (17-alpine)FROM amazoncorretto:17-alpine as openjdk Required for strip-debug to workRUN apk add --no-cache binutils Copy module dependencies infoCOPY --from=deps /deps.info /deps.info RUN echo " Build small JRE imageRUN $JAVA_HOME/bin/jlink Stage 3: Main application image (alpine)FROM alpine:latest Set Java Home and PATHENV JAVA_HOME=/jre Copy JRE from the previous imageCOPY --from=openjdk /customjre $JAVA_HOME Add application userARG APPLICATION_USER=flc Prepare app directoryRUN mkdir /app && USER $APPLICATION_USER # Use application user Copy the application JARCOPY --chown=1000:1000 ./app/build/libs/app-*-SNAPSHOT.jar /app/app.jar Add OpenTelemetry Java Agent (use version 2.12.0 as per recommendation)ENV OTEL_AGENT_VERSION=2.12.0 WORKDIR /app Expose application portEXPOSE 8081 Define entrypoint with OpenTelemetry agentCMD /jre/bin/java $JAVA_MEMORY_OPTS $GC_OPTS $JAVA_OPTS still getting the error |
@kramchas could you provide a sample project that reproduces this issue |
I wonder if the problem is that the github url to fetch the agent goes through a redirect: https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v${OTEL_AGENT_VERSION}/opentelemetry-javaagent.jar I'm not sure if the docker |
Describe the bug
Help!!!
My dockerfile
Stage 1: Dependency identification (18-alpine)
FROM amazoncorretto:18-alpine as deps
Identify dependencies
COPY ./app/build/libs/app--SNAPSHOT.jar /app/app.jar
RUN mkdir /app/unpacked &&
cd /app/unpacked &&
unzip ../app.jar &&
cd .. &&
$JAVA_HOME/bin/jdeps
--ignore-missing-deps
--print-module-deps
-q
--recursive
--multi-release 17
--class-path="./unpacked/BOOT-INF/lib/"
--module-path="./unpacked/BOOT-INF/lib/*"
./app.jar > /deps.info
Stage 2: Build JRE (17-alpine)
FROM amazoncorretto:17-alpine as openjdk
Required for strip-debug to work
RUN apk add --no-cache binutils
Copy module dependencies info
COPY --from=deps /deps.info /deps.info
RUN echo "
cat deps.info
,jdk.crypto.ec,jdk.zipfs" > /deps.infoBuild small JRE image
RUN $JAVA_HOME/bin/jlink
--verbose
--add-modules $(cat deps.info)
--strip-debug
--no-man-pages
--no-header-files
--compress=2
--output /customjre
Stage 3: Main application image (alpine)
FROM alpine:latest
Set Java Home and PATH
ENV JAVA_HOME=/jre
ENV PATH="${JAVA_HOME}/bin:${PATH}"
Copy JRE from the previous image
COPY --from=openjdk /customjre $JAVA_HOME
Add application user
ARG APPLICATION_USER=flc
RUN adduser --no-create-home -u 1000 -D $APPLICATION_USER
Prepare app directory
RUN mkdir /app &&
chown -R $APPLICATION_USER /app
USER 1000
Copy the application JAR
COPY --chown=1000:1000 ./app/build/libs/app-*-SNAPSHOT.jar /app/app.jar
Copy the Elastic APM agent and OpenTelemetry Java agent
COPY --chown=1000:1000 ./elastic-apm-agent-1.35.0.jar /app/elastic-apm-agent-1.35.0.jar
Add OpenTelemetry Java Agent
ENV OTEL_AGENT_VERSION=1.28.0
ADD https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v${OTEL_AGENT_VERSION}/opentelemetry-javaagent.jar /app/opentelemetry-javaagent.jar
USER root
RUN chmod 777 /app/opentelemetry-javaagent.jar
Verify if the OpenTelemetry Java agent is successfully added
RUN ls -lh /app/opentelemetry-javaagent.jar
USER 1000
WORKDIR /app
Expose application port
EXPOSE 8081
Define entrypoint with OpenTelemetry agent and Elastic APM agent
CMD /jre/bin/java $JAVA_MEMORY_OPTS $GC_OPTS $JAVA_OPTS
-javaagent:/app/opentelemetry-javaagent.jar
-Djava.security.egd=file:/dev/./urandom
-jar app.jar
LOGS:
Error opening zip file or JAR manifest missing : /app/opentelemetry-javaagent.jar
Error occurred during initialization of VM
agent library failed to init: instrument
Steps to reproduce
?
Expected behavior
?
Actual behavior
?
Javaagent or library instrumentation version
1.28, 1.27
Environment
JDK:
OS:
Additional context
No response
The text was updated successfully, but these errors were encountered: