fix: add lib/ to collector and server CLASSPATH in entrypoint.sh#4190
Open
orangeCatDeveloper wants to merge 1 commit into
Open
fix: add lib/ to collector and server CLASSPATH in entrypoint.sh#4190orangeCatDeveloper wants to merge 1 commit into
orangeCatDeveloper wants to merge 1 commit into
Conversation
The JVM collector and server are packaged as a thin jar plus a
separate lib/ directory of dependencies (maven-jar-plugin
classpathPrefix=lib/, assembly dependencySet outputDirectory=lib).
entrypoint.sh launches with `java -cp $CLASSPATH $MAIN_CLASS`, which
ignores the jar's manifest Class-Path entirely (that's only honored
with `java -jar`), so every dependency jar in lib/ was silently
excluded from the classpath. Any real deployment via the Docker image
or the bin/entrypoint.sh script crashes on startup:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/springframework/boot/SpringApplication
Add lib/* to CLASSPATH alongside the jar and ext-lib.
Fixes apache#3296
e05b26b to
61852ea
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Starting the collector or server from the packaged tarball (via Docker or
bin/entrypoint.shdirectly) crashes on boot:Why
The app jar is "thin" — its actual dependencies (Spring, etc.) live in a separate
lib/folder next to it.entrypoint.shbuilds the Java classpath by hand, but forgot to includelib/, so none of those dependency jars were ever loaded.Fix
Add
lib/*to the classpath inentrypoint.sh, for both collector and server.Tested
Built a real image, ran it with the old script — got the exact crash above (matches what was reported in #3296). Swapped in the fixed script — starts up cleanly, Tomcat comes up, collector registers all its protocols.
Fixes #3296