-
Notifications
You must be signed in to change notification settings - Fork 881
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
Unable to launch OTel Java Agent from an uber JAR #9702
Comments
hi @rvesse! is this feature what you're looking for? https://github.com/open-telemetry/opentelemetry-java-contrib/tree/main/runtime-attach |
No, I don't think that solves the problem for Uber JARs anyway, I get a slightly different error condition but my application still crashes:
Personally I really don't want to put the agent into an uber JAR because that's not how agents are supposed to be used. But I'd ideally like some documentation saying |
can you describe a bit more why not? runtime attach module should allows you to embed the agent in an uber jar (e.g. spring boot) |
You probably get the Line 96 in 60b6548
|
To summarise:
Note that I'm quite happy for you guys to close this as Won't Fix or your equivalent. My main goal in filing this issue was to have some more easily discoverable discussion of this topic to help future engineers who get asked to try and do this and start Googling and don't waste too much time. |
hi @alagusundarams! if Runtime Attach isn't working for you, can you open an issue in https://github.com/open-telemetry/opentelemetry-java-contrib? |
Hi @alagusundarams and @rvesse -- did you open an issue in the contrib repo? If so, can you please mention it here? Thanks! |
This has been automatically marked as stale because it has been marked as needing author feedback and has not had any activity for 7 days. It will be closed automatically if there is no response from the author within 7 additional days from this comment. |
Describe the bug
In a similar vein to #8227 I've been experimenting with whether you can package the Otel Agent JAR into an uber JAR and have that work. I'm pretty sure the answer is no this won't work, so it would be nice if this were explicitly stated that this isn't supported somewhere in the documentation
Firstly if you're attempting to package into an uber jar you need to set both the
Premain-Class
andLauncher-Agent-Class
attributes inmanifest.mf
. It'sLauncher-Agent-Class
that actually starts the agent in an uber JAR deployment BUT if you don't havePremain-Class
as well OTel baulks with the following error:Clearly implying that the authors didn't expect this to be supported anyway.
If you do specify the
Premain-Class
attribute to force your way past this error you'll get the following error on startup:Which likely is the same underlying bug raphw/byte-buddy/issues/374 mentioned in the comments thread on #8227
Steps to reproduce
Generate an über JAR with the OTel Java Agent using the toolchain of your choice, e.g. Maven Shade plugin:
Expected behavior
N/A, seems this isn't intended to work/can't work so documentation merely needs to be clearer around this
Actual behavior
Errors thrown as shown earlier in description
Javaagent or library instrumentation version
1.24.0
Environment
JDK: Temurin 17 and OpenJDK 17
OS: Mac OX X Ventura, Linux (5.15.40-linuxkit)
Additional context
No response
The text was updated successfully, but these errors were encountered: